# Only setup the encrypted extroot if /.use_crypt_extroot exists on rootfs_data. # This makes it easier disable the encrypted extroot from failsafe mode. mkdir -p /mnt/tmp if [ -e /.use_crypt_extroot ]; then # Setup crypt device which contains the extroot cryptsetup open -d /root/extroot.key /dev/sda1 cextroot umount /overlay # /tmp will get overridden by another tmpfs by mount_root, but we need the # initial one because it contains the ubus named socket. mount --bind /tmp /mnt/tmp # Re-run mount_root now that we have a block device that it will recognize # as an extroot. This sleep is needed, otherwise procd seems to freak out # and the watchdog timer doesn't get reset. Not sure exactly why. sleep 5 PREINIT=1 mount_root # Free the new tmpfs just created by mount_root. Since it will never be used, # its just wasting memory. umount -l /tmp # Put the original tmpfs back to where it was in the VFS, primarily so that # programs can find the ubus socket. mount --bind /rom/mnt/tmp /tmp # Need to re-run this too for some reason, otherwise some other mounts are not # mounted after mount_root, eg. /rwm. block mount # Reload rpcd to register rpc objects on the extroot service rpcd reload fi