Skip to content

Instantly share code, notes, and snippets.

@meeuw
Last active April 23, 2016 10:12
Show Gist options
  • Save meeuw/d42076688d99bf150a97 to your computer and use it in GitHub Desktop.
Save meeuw/d42076688d99bf150a97 to your computer and use it in GitHub Desktop.
dracut module for loop mounting a root filesystem
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
if getargbool 0 rd.loop; then
info "Mount /sysroot as r/w"
mount -o remount,rw /sysroot
mkdir /run/initramfs/loop
mount -o bind /sysroot /run/initramfs/loop
umount /sysroot
info "Mount /sysroot/loop.img to /sysroot"
mount -o loop /run/initramfs/loop/loop.raw /sysroot
need_shutdown
fi
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
if getargbool 0 rd.loop; then
info "Unmount /run/iniramfs/loop"
umount /oldsys/run/initramfs/loop
fi
#!/bin/bash
check() {
return 0
}
depends() {
return 0
}
installkernel() {
instmods loop
}
install() {
inst_hook pre-pivot 99 "$moddir/loopmount.sh"
inst_hook shutdown 99 "$moddir/loopumount.sh"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment