#!/bin/sh ### BEGIN INIT INFO # Provides: protect-fs # Required-Start: mountall-bootclean # Required-Stop: # Default-Start: S # Default-Stop: # X-Start-Before: procps udev-mtab urandom # Short-Description: UnionFS mode # Descrition: Shutdown process will not be required ### END INIT INFO # Copyright: Bernd Schubert # BSD license, see LICENSE file for details FUSE_OPT="-o allow_other,use_ino,suid,dev,nonempty" CHROOT_PATH="/tmp/unionfs" UNION_OPT="-ocow,chroot=$CHROOT_PATH,max_files=32768" UBIN=/usr/bin/unionfs-fuse cd /etc/protect-fs file=noprotect if [ -e ${file} ]; then echo "protect-fs: disable" exit 0 fi echo "protect-fs: enable" #mount -o remount,ro /dev/mmcblk0p1 /boot #mount -t proc proc /proc mount -t tmpfs tmpfs /tmp mkdir -p $CHROOT_PATH/root mkdir -p $CHROOT_PATH/rw mkdir -p /tmp/union mount --bind / $CHROOT_PATH/root $UBIN $FUSE_OPT $UNION_OPT /rw=RW:/root=RO /tmp/union mount -t proc proc /tmp/union/proc cd /tmp/union mkdir -p oldroot pivot_root . oldroot # exit 0 mount -r -t ext4 -o remount /dev/root /oldroot #for d in dev run run/lock sys run/shm dev/pts boot for d in dev run run/lock sys run/shm dev/pts do mount --bind /oldroot/$d /$d done init q #/usr/local/sbin/a-unionfs-fuse-omit-pid.sh exit 0