diff options
Diffstat (limited to 'main/alpine-conf/0001-setup-disk-use-uuid-in-fstab-and-extlinux.conf.patch')
-rw-r--r-- | main/alpine-conf/0001-setup-disk-use-uuid-in-fstab-and-extlinux.conf.patch | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/main/alpine-conf/0001-setup-disk-use-uuid-in-fstab-and-extlinux.conf.patch b/main/alpine-conf/0001-setup-disk-use-uuid-in-fstab-and-extlinux.conf.patch new file mode 100644 index 000000000..6e248ed91 --- /dev/null +++ b/main/alpine-conf/0001-setup-disk-use-uuid-in-fstab-and-extlinux.conf.patch @@ -0,0 +1,74 @@ +From 5531beb030b8e0a2f0da5ba5b8833bb01ba21c85 Mon Sep 17 00:00:00 2001 +From: Natanael Copa <ncopa@alpinelinux.org> +Date: Thu, 17 Sep 2009 11:57:45 +0000 +Subject: [PATCH] setup-disk: use uuid in fstab and extlinux.conf + +This helps us avoid the issues when disk changes from sda to hda +--- + setup-disk.in | 31 ++++++++++++++++++++++++++++--- + 1 files changed, 28 insertions(+), 3 deletions(-) + +diff --git a/setup-disk.in b/setup-disk.in +index a957b09..881c341 100644 +--- a/setup-disk.in ++++ b/setup-disk.in +@@ -15,12 +15,37 @@ in_list() { + return 1 + } + ++# wrapper to only show given device ++_blkid() { ++ blkid | grep "^$1:" ++} ++ ++# if given device have an UUID display it, otherwise return the device ++uuid_or_device() { ++ local i= ++ for i in $(_blkid "$1"); do ++ case "$i" in ++ UUID=*) eval $i;; ++ esac ++ done ++ if [ -n "$UUID" ]; then ++ echo "UUID=$UUID" ++ else ++ echo "$1" ++ fi ++} ++ ++# generate an fstab from a given mountpoint. Convert to UUID if possible + enumerate_fstab() { + local mnt="$1" ++ local fs_spec= fs_file= fs_vfstype= fs_mntops= fs_freq= fs_passno= + [ -z "$mnt" ] && return + local escaped_mnt=$(echo $mnt | sed 's:/:\\/:g') + awk "\$2 ~ /^$escaped_mnt/ {print \$0}" /proc/mounts | \ +- sed "s:$mnt:/:g; s: :\t:g" | sed 's:/\+:/:g' ++ sed "s:$mnt:/:g; s: :\t:g" | sed 's:/\+:/:g' | \ ++ while read fs_spec fs_file fs_vfstype fs_mntops fs_freq fs_passno; do ++ echo -e "$(uuid_or_device $fs_spec)\t${fs_file}\t${fs_vfstype}\t${fs_mntops} ${fs_freq} ${fs_passno}" ++ done + } + + is_vmware() { +@@ -89,7 +114,7 @@ prompt 1 + default grsec + label grsec + kernel /grsec +- append initrd=/grsec.gz root=$rootdev modules=sd-mod,usb-storage,ext3$raidmod ${pax_nouderef}quiet ++ append initrd=/grsec.gz root=$(uuid_or_device $rootdev) modules=sd-mod,usb-storage,ext3$raidmod ${pax_nouderef}quiet + EOF + # fix the fstab + enumerate_fstab "$mnt" >> "$mnt"/etc/fstab +@@ -247,7 +272,7 @@ EOF + rc-update --quiet add swap boot + # the func to generate fstab does not detect swap. add it manually + sed -i -e '/swap/d' /etc/fstab +- echo -e "$swap_dev\tswap\t\tswap\tdefaults 0 0" >> /etc/fstab ++ echo -e "$(uuid_or_device $swap_dev)\tswap\t\tswap\tdefaults 0 0" >> /etc/fstab + install_mounted_root /mnt + } + +-- +1.6.4.2 + |