summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-09-30 14:42:46 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2011-09-30 14:42:46 +0000
commit192c731713534451c4d5e76c0176a89a34ba6416 (patch)
tree83d6abd3c395a3528d638e4ecbca6e69909efd6e
parentb587245f7a1e0882f654fabc79e54915cd7cee59 (diff)
downloadalpine-conf-192c731713534451c4d5e76c0176a89a34ba6416.tar.bz2
alpine-conf-192c731713534451c4d5e76c0176a89a34ba6416.tar.xz
setup-bootable: use force UUID in syslinux.cfg, even for upgraders
The -k option is to not use UUID
-rw-r--r--setup-bootable.in14
1 files changed, 13 insertions, 1 deletions
diff --git a/setup-bootable.in b/setup-bootable.in
index c0766fb..bde5301 100644
--- a/setup-bootable.in
+++ b/setup-bootable.in
@@ -58,6 +58,8 @@ or a device. If DEST is ommitted /media/usb will be used.
Options:
-f Force overwrite existing files. Will overwrite syslinux.cfg if upgrade.
-h Show this help.
+ -k Keep current alpine_dev in syslinux.cfg. Without this it will be replaced
+ with the UUID.
-u Upgrade mode. Keep existing syslinux.cfg and don't run syslinux.
If apk cache is detected, attempts to upgrade the apk cache
-s Force run syslinux, even if upgrade mode.
@@ -67,10 +69,11 @@ __EOF__
exit 1
}
-while getopts "fhusv" opt; do
+while getopts "fhkusv" opt; do
case "$opt" in
f) force=1;;
h) usage;;
+ k) keep_alpine_dev=1;;
u) upgrade=1;;
s) syslinux=1;;
v) verbose=1;;
@@ -116,6 +119,9 @@ elif [ -b "$dest" ]; then
umounts="$umounts $destdir"
fi
+# fish out label, uuid and type
+eval $(blkid $dest | cut -d: -f2-)
+
# Check for RO mounting
if [ "`grep \"$destdir\" /proc/mount | grep 'ro,'`" = "ro" ]; then
remountneeded="Y"
@@ -218,6 +224,12 @@ for i in $tomove; do
mv "$destdir"/.new/$i "$destdir"/ || die "Failed to move $destdir/.new/ to $destdir"
done
+
+if [ -z "$keep_alpine_dev" ] && [ -n "$UUID" ]; then
+ sed -i -e "s/alpine_dev=[^ \t]\+/alpine_dev=UUID=$UUID/" \
+ "$destdir"/syslinux.cfg
+fi
+
# Update the cache folder on destdir if present
if [ -e "$destdir"/*.apkovl.tar.gz ] && [ -e "$destdir"/cache ]; then
mkdir "$destdir"/tmp.cache