Now with /run, things are more easy! Needs unionfs-fuse[#1] installed on build enviroment. Note that this include a provisory overlay/rc.d/functions * patched with omit_pid support, waiting for accepted in initscripts, See FS#10536 - [initscripts] internal: save a pid from killall5. * Not included in this email, just push from my git repo. Patch is done agains my "baseline" profile (a minimal setup that I maintain for the Wiki and for doing quicks tests). git clone git://github.com/djgera/archiso.git -b unionfs-fuse cd archiso/archiso make install cd ../configs/baseline make [#1] http://aur.archlinux.org/packages.php?ID=26005 --- archiso/hooks/archiso | 40 ++- archiso/install/archiso | 3 +- configs/baseline/boot-files/syslinux/syslinux.cfg | 2 +- configs/baseline/overlay/etc/rc.d/functions | 389 ++++++++++++++++++++ .../overlay/etc/rc.d/functions.d/omit_kill_unionfs | 6 + 5 files changed, 432 insertions(+), 8 deletions(-) create mode 100644 configs/baseline/overlay/etc/rc.d/functions create mode 100644 configs/baseline/overlay/etc/rc.d/functions.d/omit_kill_unionfs diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index a129b20..408ad08 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -7,6 +7,14 @@ _mnt_aufs() { /bin/mount -t aufs -o remount,append:"${src}"=ro none "${mnt}" } +# args: source, mountpoint (ignored) +_mnt_fuse() { + src="${1}" + mnt="${2}" + msg "::: Adding new unionfs-fuse branch: ${src} to ${mnt}" + fuse_branchs="${fuse_branchs}:${src}=RO" +} + # args: source, mountpoint _mnt_bind() { src="${1}" @@ -43,7 +51,11 @@ _mnt_squashfs() { fi if [ "/${mnt#/*/}" = "/" ]; then - _mnt_aufs "${tmp_mnt}" "${mnt}" + if [ "${fuse}" = "y" ]; then + _mnt_fuse "${tmp_mnt}" "${mnt}" + else + _mnt_aufs "${tmp_mnt}" "${mnt}" + fi else _mnt_bind "${tmp_mnt}" "${mnt}" fi @@ -126,11 +138,13 @@ archiso_mount_handler() { mount -t tmpfs -o "size=${rw_branch_size}",mode=0755 rw_branch /rw_branch msg "done." - msg ":: Mounting root (aufs) filesystem" - /bin/mount -t aufs -o dirs=/rw_branch=rw union "${newroot}" - if [ $? -ne 0 ]; then - echo "ERROR: while mounting root (aufs) filesystem." - launch_interactive_shell + if [ "${fuse}" != "y" ]; then + msg ":: Mounting root (aufs) filesystem" + /bin/mount -t aufs -o dirs=/rw_branch=rw union "${newroot}" + if [ $? -ne 0 ]; then + echo "ERROR: while mounting root (aufs) filesystem." + launch_interactive_shell + fi fi msg ":: Mounting images" @@ -149,6 +163,20 @@ archiso_mount_handler() { fi done < "${isomounts}" + if [ "${fuse}" = "y" ]; then + /sbin/modprobe fuse + msg ":: Mounting root (unionfs-fuse) filesystem" + FUSE_OPTS="allow_other,use_ino,suid,dev,nonempty" + UNION_OPTS="cow,max_files=32768,statfs_omit_ro" + /usr/bin/unionfs -o ${FUSE_OPTS} -o ${UNION_OPTS} "/rw_branch=RW${fuse_branchs}" "${newroot}" + if [ $? -ne 0 ]; then + echo "ERROR: while mounting root (unionfs-fuse) filesystem." + launch_interactive_shell + else + pidof unionfs > /run/unionfs.pid + fi + fi + if [ "${copytoram}" = "y" ]; then /bin/umount /bootmnt else diff --git a/archiso/install/archiso b/archiso/install/archiso index 7ad9d06..f97e634 100644 --- a/archiso/install/archiso +++ b/archiso/install/archiso @@ -1,6 +1,6 @@ install () { - MODULES="cdrom ide-cd_mod ide-core ide-generic aufs squashfs isofs loop $(all_modules '/kernel/fs' | grep -v "nls") " + MODULES="cdrom ide-cd_mod ide-core ide-generic aufs fuse squashfs isofs loop $(all_modules '/kernel/fs' | grep -v "nls") " MODULES="${MODULES} $(checked_modules "/usb/host" | grep -ve "_cs" -e "sl811-hcd" -e "isp116x-hcd")" MODULES=$(echo ${MODULES}) #trim whitespace if [ "x${MODULES}" != "x" ]; then @@ -18,6 +18,7 @@ install () add_device /lib/udev/devices/loop0 b 7 0 add_binary /lib/udev/cdrom_id + add_binary /usr/bin/unionfs add_file /lib/udev/rules.d/60-cdrom_id.rules diff --git a/configs/baseline/boot-files/syslinux/syslinux.cfg b/configs/baseline/boot-files/syslinux/syslinux.cfg index a69e424..e5a03e6 100644 --- a/configs/baseline/boot-files/syslinux/syslinux.cfg +++ b/configs/baseline/boot-files/syslinux/syslinux.cfg @@ -1,3 +1,3 @@ LABEL arch LINUX /%INSTALL_DIR%/boot/%ARCH%/vmlinuz26 -APPEND initrd=/%INSTALL_DIR%/boot/%ARCH%/archiso.img archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% +APPEND initrd=/%INSTALL_DIR%/boot/%ARCH%/archiso.img archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% fuse=y diff --git a/configs/baseline/overlay/etc/rc.d/functions.d/omit_kill_unionfs b/configs/baseline/overlay/etc/rc.d/functions.d/omit_kill_unionfs new file mode 100644 index 0000000..40685be --- /dev/null +++ b/configs/baseline/overlay/etc/rc.d/functions.d/omit_kill_unionfs @@ -0,0 +1,6 @@ +omit_kill_unionfs() { + add_omit_pids $(cat /run/unionfs.pid) +} + +add_hook shutdown_prekillall omit_kill_unionfs +add_hook single_prekillall omit_kill_unionfs -- 1.7.5.1