summaryrefslogtreecommitdiff
path: root/scripts/install/install-image-new
diff options
context:
space:
mode:
authorBob Gilligan <gilligan@vyatta.com>2010-04-30 15:45:44 -0700
committerBob Gilligan <gilligan@vyatta.com>2010-04-30 15:45:44 -0700
commitc634b7d41c241a9b033e16ff32ba26a6d99bc227 (patch)
tree202b35528992e8fd22a66d33eb3b36085dfa0c21 /scripts/install/install-image-new
parentccbcc2939853cfc877970b3750a625d536fe219f (diff)
downloadvyatta-cfg-system-c634b7d41c241a9b033e16ff32ba26a6d99bc227.tar.gz
vyatta-cfg-system-c634b7d41c241a9b033e16ff32ba26a6d99bc227.zip
Allow user to name system images when installing them.
Now we ask the user what they would like to name an image when they are installing. The default answer is the same string used previously: The Vyatta version string.
Diffstat (limited to 'scripts/install/install-image-new')
-rwxr-xr-xscripts/install/install-image-new31
1 files changed, 26 insertions, 5 deletions
diff --git a/scripts/install/install-image-new b/scripts/install/install-image-new
index 7294fc35..5726fa03 100755
--- a/scripts/install/install-image-new
+++ b/scripts/install/install-image-new
@@ -24,15 +24,36 @@ if ! try_mount "/dev/$ROOT_PARTITION $WRITE_ROOT"; then
fi
version=$(get_new_version)
-if [ -z "$version" ]; then
+image_name=$version
+if [ -z "$image_name" ]; then
echo 'Cannot find new version. Exiting...'
exit 1
fi
+echo -n "What would you like to name this image? [$image_name]: "
+read response
+if [ -n "$response" ]; then
+ image_name=$response
+fi
+
+# Validate image name
+if [ "$image_name" = "grub" -o "${image_name:0:7}" = "vmlinuz" -o \
+ "${image_name:0:6}" = "initrd" -o "${image_name:0:10}" = "System.map" -o \
+ "$image_name" = "Old-non-image-installation" ]; then
+ echo "Can't use $image_name. It is a reserved image name."
+ exit 1;
+fi
+
+if [ -z "$image_name" ]; then
+ failure_exit 'Invalid image name.'
+fi
+
+echo "OK. This image will be named: $image_name"
+
# make the dir for the new version
-mkdir -p $WRITE_ROOT/boot/$version
+mkdir -p $WRITE_ROOT/boot/$image_name
# make dir for backing store
-rw_dir=$WRITE_ROOT/boot/$version/live-rw
+rw_dir=$WRITE_ROOT/boot/$image_name/live-rw
mkdir -p $rw_dir
echo Copying squashfs image...
@@ -53,10 +74,10 @@ if [ ! -f "$squash_img" ] || [ -z "$boot_files" ]; then
fi
fi
-target_squash=$WRITE_ROOT/boot/$version/$version.squashfs
+target_squash=$WRITE_ROOT/boot/$image_name/$version.squashfs
cp -p $squash_img $target_squash
echo Copying kernel and initrd images...
-cp -dp $boot_files $WRITE_ROOT/boot/$version/
+cp -dp $boot_files $WRITE_ROOT/boot/$image_name/
# set up union root for postinst
mkdir -p $INST_ROOT $READ_ROOT