diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-09-29 13:34:39 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-09-29 13:36:32 +0000 |
commit | 3d4d4b6898b3b32b7c5af3d34d9d8e5d976eb9d6 (patch) | |
tree | 93b6f4ec3129b8202656691deb97bf3074246dab /main/alpine-conf | |
parent | 629d4653a2c57a74b322d6689865f935c48c49ee (diff) | |
download | aports-3d4d4b6898b3b32b7c5af3d34d9d8e5d976eb9d6.tar.bz2 aports-3d4d4b6898b3b32b7c5af3d34d9d8e5d976eb9d6.tar.xz |
main/alpine-conf: fix for setup-disk
Diffstat (limited to 'main/alpine-conf')
-rw-r--r-- | main/alpine-conf/0001-setup-disk-fix-find_disks.patch | 76 | ||||
-rw-r--r-- | main/alpine-conf/0001-setup-disk-use-uuid-in-fstab-and-extlinux.conf.patch | 74 | ||||
-rw-r--r-- | main/alpine-conf/APKBUILD | 7 |
3 files changed, 81 insertions, 76 deletions
diff --git a/main/alpine-conf/0001-setup-disk-fix-find_disks.patch b/main/alpine-conf/0001-setup-disk-fix-find_disks.patch new file mode 100644 index 0000000000..2b5453d6bf --- /dev/null +++ b/main/alpine-conf/0001-setup-disk-fix-find_disks.patch @@ -0,0 +1,76 @@ +From 5572e8a3db95f179b3433e5ea5f8c6fa2c8c65ab Mon Sep 17 00:00:00 2001 +From: Natanael Copa <ncopa@alpinelinux.org> +Date: Tue, 29 Sep 2009 09:40:53 +0000 +Subject: [PATCH] setup-disk: fix find_disks + +The old way did not detect ida/c0d0. The new should detect it. +We also filter out md devices. +--- + setup-disk.in | 42 ++++++++++++++++++++++++++++++++---------- + 1 files changed, 32 insertions(+), 10 deletions(-) + +diff --git a/setup-disk.in b/setup-disk.in +index d53fba1..33cc868 100644 +--- a/setup-disk.in ++++ b/setup-disk.in +@@ -146,25 +146,47 @@ find_swap_size() { + + has_mounted_part() { + local p +- # parse /proc/mounts for moutned devices ++ # parse /proc/mounts for mounted devices + for p in $(awk '$1 ~ /^\/dev\// {gsub("/dev/", "", $1); print $1}' \ + /proc/mounts); do +- if [ -e /sys/block/$1/$p ]; then +- return 0 +- fi ++ [ -e /sys/block/$1/$p ] && return 0 + done + return 1 + } + ++has_holders() { ++ local i ++ # check if device is used by any md devices ++ for i in $1/holders/* $1/*/holders/*; do ++ [ -e "$i" ] && return 0 ++ done ++ return 1 ++} ++ ++is_available_disk() { ++ local dev=$1 ++ local b=$(echo $p | sed 's:/:!:g') ++ ++ # check if its a "root" block device and not a partition ++ [ -e /sys/block/$b ] || return 1 ++ ++ # check so it does not have mounted partitions ++ has_mounted_part $dev && return 1 ++ ++ # check so its not part of an md setup ++ has_holders /sys/block/$b && return 1 ++ ++ # check so its not an md device ++ [ -e /sys/block/$b/md ] && return 1 ++ ++ return 0 ++} ++ + find_disks() { +- local p= disks= ++ local p= + for p in $(awk '$1 ~ /[0-9]+/ {print $4}' /proc/partitions); do +- b=$(echo $p | sed 's:/:!:g') +- if [ -e /sys/block/$b/device ] && ! has_mounted_part $p; then +- disks="$disks $p" +- fi ++ is_available_disk $p && echo -n " $p" + done +- echo $disks + } + + useall() { +-- +1.6.4.4 + 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 deleted file mode 100644 index 6e248ed91a..0000000000 --- a/main/alpine-conf/0001-setup-disk-use-uuid-in-fstab-and-extlinux.conf.patch +++ /dev/null @@ -1,74 +0,0 @@ -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 - diff --git a/main/alpine-conf/APKBUILD b/main/alpine-conf/APKBUILD index ce3c3be667..0ffcb1ff10 100644 --- a/main/alpine-conf/APKBUILD +++ b/main/alpine-conf/APKBUILD @@ -1,16 +1,18 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=alpine-conf pkgver=2.0_rc6 -pkgrel=0 +pkgrel=1 pkgdesc="Alpine configuration management scripts" url=http://git.alpinelinux.org/cgit/$pkgname depends="openrc" source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2 + 0001-setup-disk-fix-find_disks.patch " license="GPL-2" build() { cd "$srcdir/$pkgname-$pkgver" + patch -p1 -i ../0001-setup-disk-fix-find_disks.patch || return 1 make || return 1 make install PREFIX= DESTDIR="$pkgdir" @@ -18,4 +20,5 @@ build() { ln -s lbu "$pkgdir"/sbin/lbu_$i done } -md5sums="52d08eaff7ad57581106418deed94d7d alpine-conf-2.0_rc6.tar.bz2" +md5sums="52d08eaff7ad57581106418deed94d7d alpine-conf-2.0_rc6.tar.bz2 +cb6b8b50e4098174ce20245faeeb84ea 0001-setup-disk-fix-find_disks.patch" |