diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2011-08-27 16:01:15 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2011-08-27 16:01:15 +0000 |
commit | 99e836cc8c964005a05df3e3a83dd16b9f3d5a58 (patch) | |
tree | f44cd96136c811a92f5319bf175e7fbd7d6c315d /main/openrc/modloop.initd | |
parent | 153eb2dc7cfe3353b56f7d8166973f9151cb045a (diff) | |
download | aports-99e836cc8c964005a05df3e3a83dd16b9f3d5a58.tar.bz2 aports-99e836cc8c964005a05df3e3a83dd16b9f3d5a58.tar.xz |
main/openrc: support for squashfs modloop
Diffstat (limited to 'main/openrc/modloop.initd')
-rw-r--r-- | main/openrc/modloop.initd | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/main/openrc/modloop.initd b/main/openrc/modloop.initd index d2cff4e6a3..3a69498420 100644 --- a/main/openrc/modloop.initd +++ b/main/openrc/modloop.initd @@ -71,25 +71,31 @@ find_media() { } start() { - local modloop mount_opts + local modloop= mount_opts= modloop_mounted= find_media if [ -z "$alpine_dev" ] ; then return 0 fi - modloop=${KOPT_modloop:-$KOPT_BOOT_IMAGE.cmg} - [ -n "$alpine_fs" ] && mount_opts="-t $alpine_fs" - - ebegin "Mounting loopback device for kernel modules" if [ -z "$alpine_mounted" ]; then + ebegin "Mounting $alpine_mnt" + [ -n "$alpine_fs" ] && mount_opts="-t $alpine_fs" mount $mount_opts /dev/$alpine_dev $alpine_mnt 2>/dev/null + eend $? || return 1 fi mkdir -p /.modloop /lib - mount -o loop,ro -t cramfs $alpine_mnt/$modloop /.modloop - - eend $? || return 1 - + for modloop in ${alpine_mnt}$KOPT_modloop \ + ${alpine_mnt}$KOPT_BOOT_IMAGE.modloop.* \ + ${alpine_mnt}$KOPT_BOOT_IMAGE.cmg; do + [ -f "$modloop" ] || continue + ebegin "Mounting modloop $modloop" + mount -o loop,ro $fs_opt $modloop /.modloop \ + && modloop_mounted=1 + eend $? || return 1 + done + [ "$modloop_mounted" = "1" ] || return 1 + #use unionfs is available and configured if grep -q -w "unionfs$" /proc/filesystems && [ -n "$unionfs_size" ]; then ebegin "UnionFS detected. Mounting modloop rw" @@ -110,19 +116,22 @@ start() { rmdir /lib/firmware 2>/dev/null \ && ln -s /lib/modules/firmware /lib/ fi + return 0 } stop() { local rc=0 find_media [ -z "$alpine_dev" ] && return 0 - ebegin "Unmounting loopback device for kernel modules" if mountinfo --quiet /.modloop; then - umount -d /.modloop || rc=1 + ebegin "Unmounting /.modloop" + umount -d /.modloop + eend $? || return 1 fi if mountinfo --quiet $alpine_mnt; then - umount $alpine_mnt || rc=1 + ebegin "Unmounting $alpine_mnt" + umount $alpine_mnt + eend $? fi - eend $rc } |