summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2010-07-30 18:12:59 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2010-07-30 18:12:59 -0700
commit5f2ba9dfea24a141c27af726d8a5e2781a6485ab (patch)
treebfcd9185c2af56308e02c4dfe925c52b80e52ca9 /scripts
parent1c8946a09d1a15a5422177ac4bac4fa4180e0554 (diff)
parentdd04275bd3092ae47392f0db91d9befac0cf3bc9 (diff)
downloadvyatta-cfg-system-5f2ba9dfea24a141c27af726d8a5e2781a6485ab.tar.gz
vyatta-cfg-system-5f2ba9dfea24a141c27af726d8a5e2781a6485ab.zip
Merge branch 'mendocino' of git.vyatta.com:/git/vyatta-cfg-system into mendocino
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/install/install-image-existing13
-rwxr-xr-xscripts/install/install-image-new5
2 files changed, 14 insertions, 4 deletions
diff --git a/scripts/install/install-image-existing b/scripts/install/install-image-existing
index 27d19f4d..b05de08e 100755
--- a/scripts/install/install-image-existing
+++ b/scripts/install/install-image-existing
@@ -59,9 +59,18 @@ NEWNAME=$NEWVER
echo -n "What would you like to name this image? [$NEWNAME]: "
read response
if [ -n "$response" ]; then
+ badchars=`echo $response | sed -e 's/[a-zA-Z0-9\.\_+-]//g'`
+ if [ -n "$badchars" ]; then
+ echo "Image name must be composed of a-z, A-Z, 0-9, or one of ._+-"
+ exit 1
+ fi
NEWNAME=$response
fi
+if [ -z "$NEWNAME" ]; then
+ failure_exit 'Invalid image name.'
+fi
+
# Validate image name
if [ "$NEWNAME" = "grub" -o "${NEWNAME:0:7}" = "vmlinuz" -o \
"${NEWNAME:0:6}" = "initrd" -o "${NEWNAME:0:10}" = "System.map" -o \
@@ -70,10 +79,6 @@ if [ "$NEWNAME" = "grub" -o "${NEWNAME:0:7}" = "vmlinuz" -o \
exit 1;
fi
-if [ -z "$NEWNAME" ]; then
- failure_exit 'Invalid image name.'
-fi
-
echo "OK. This image will be named: $NEWNAME"
# this is the default if current install is union
diff --git a/scripts/install/install-image-new b/scripts/install/install-image-new
index 5726fa03..c669da8e 100755
--- a/scripts/install/install-image-new
+++ b/scripts/install/install-image-new
@@ -33,6 +33,11 @@ fi
echo -n "What would you like to name this image? [$image_name]: "
read response
if [ -n "$response" ]; then
+ badchars=`echo $response | sed -e 's/[a-zA-Z0-9\.\_+-]//g'`
+ if [ -n "$badchars" ]; then
+ echo "Image name must be composed of a-z, A-Z, 0-9, or one of ._+-"
+ exit 1
+ fi
image_name=$response
fi