#!/bin/sh # check if private.img (xvdb) is empty - all zeros private_size_512=`blockdev --getsz /dev/xvdb` if dd if=/dev/zero bs=512 count=$private_size_512 2>/dev/null | diff /dev/xvdb - >/dev/null; then # the device is empty, create filesystem echo "--> Virgin boot of the VM: creating filesystem on private.img" mkfs.ext4 -m 0 -q /dev/xvdb || exit 1 fi tune2fs -m 0 /dev/xvdb mount /rw resize2fs /dev/xvdb 2> /dev/null || echo "'resize2fs /dev/xvdb' failed" if ! [ -d /rw/home ] ; then echo echo "--> Virgin boot of the VM: Populating /rw/home" mkdir -p /rw/config touch /rw/config/rc.local cat > /rw/config/rc.local < /rw/config/qubes-firewall-user-script < /rw/config/suspend-module-blacklist < /rw/home; now we use mount --bind if [ -L /home ]; then rm /home mkdir /home fi if [ -e /var/run/qubes-service/qubes-dvm ]; then mount --bind /home_volatile /home touch /etc/this-is-dvm #If user have customized DispVM settings, use its home instead of default dotfiles if [ -e /rw/home/user/.qubes-dispvm-customized ]; then cp -af /rw/home/user /home/ else cat /etc/dispvm-dotfiles.tbz | tar -xjf- --overwrite -C /home/user --owner user 2>&1 >/tmp/dispvm-dotfiles-errors.log fi else mount /home fi