summaryrefslogtreecommitdiff
path: root/scripts/install/install-image-existing
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/install/install-image-existing')
-rwxr-xr-xscripts/install/install-image-existing13
1 files changed, 9 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