diff options
-rw-r--r-- | main/openrc/APKBUILD | 4 | ||||
-rw-r--r-- | main/openrc/modloop.initd | 33 |
2 files changed, 31 insertions, 6 deletions
diff --git a/main/openrc/APKBUILD b/main/openrc/APKBUILD index d02e751efc..1170048f58 100644 --- a/main/openrc/APKBUILD +++ b/main/openrc/APKBUILD @@ -2,7 +2,7 @@ pkgname=openrc pkgver=0.8.3 _ver=${pkgver/_git*/} -pkgrel=3 +pkgrel=4 pkgdesc="OpenRC manages the services, startup and shutdown of a host" url="http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git" arch="all" @@ -77,6 +77,6 @@ c32e15b0858eef708497e7ee6355a055 hostname.initd b1e64885f301166df30be3e3cf5338ff hwdrivers.initd 33ca3e558c42cdd17adccbc7807298f7 keymaps.initd 098a1f16812f56fcb56eb6b6f0fa31f6 modules.initd -408e28f247c7cc71fa104c07869417f4 modloop.initd +e9dae56ec441a9d3f1013863751c0e52 modloop.initd af16db0d798392c7c0ed3434e4bad241 networking.initd c1ec888202d868710b5749f7b217d1e3 modloop.confd" diff --git a/main/openrc/modloop.initd b/main/openrc/modloop.initd index 714b6057a3..1a12f6fccd 100644 --- a/main/openrc/modloop.initd +++ b/main/openrc/modloop.initd @@ -20,10 +20,35 @@ init_KOPT() { done } +resolve_dev() { + case "$1" in + UUID=*|LABEL=*) findfs "$1";; + *) readlink -f "$1";; + esac +} + find_mnt() { - local dev="$1" - local fsfile="$2" - awk "\$ == \"$dev\" {print \$2}\"" "$fsfile" 2>/dev/null + local search_dev="$1" fstab="$2" + local dev mnt fs mntopts chk + case "$search_dev" in + UUID=*|LABEL=*|/dev/*);; + *) search_dev=/dev/$search_dev;; + esac + local search_real_dev=$(resolve_dev $search_dev) + while read dev mnt fs mntopts chk; do + local real_dev=$(resolve_dev $dev) + local i j + for i in "$search_dev" "$search_real_dev"; do + [ -z "$i" ] && continue + for j in "$dev" "$real_dev"; do + [ -z "$j" ] && continue + if [ "$i" = "$j" ]; then + echo "$mnt" + return + fi + done + done + done < $fstab 2>/dev/null } # initialies: alpine_dev, alpine_mnt, alpine_fs, alpine_mounted @@ -34,7 +59,7 @@ find_media() { alpine_fs=${KOPT_alpine_dev#*:} [ "$alpine_fs" = "$KOPT_alpine_dev" ] && unset alpine_fs # first we check if alpine_dev is mounted and use this - alpine_mnt=$(find_mnt /dev/$alpine_dev /proc/mounts) + alpine_mnt=$(find_mnt $alpine_dev /proc/mounts) if [ -z "$alpine_mnt" ]; then # then we check fstab alpine_mnt=$(find_mnt /dev/$alpine_dev /etc/fstab) |