37 lines
859 B
Bash
Executable File
37 lines
859 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if ! [ "$EUID" -eq 0 ]
|
|
then
|
|
echo "This must be run as root!" >&2
|
|
exit 1
|
|
fi
|
|
|
|
set -e
|
|
|
|
echo -n "Password for data storage: "
|
|
read -s password
|
|
echo
|
|
|
|
echo $password | cryptsetup luksOpen /dev/sda3 zfs_hd_1
|
|
echo $password | cryptsetup luksOpen /dev/sdb3 zfs_hd_2
|
|
|
|
echo "import zfs pool"
|
|
retry=0
|
|
until [ $retry -ge 10 ]; do
|
|
zpool list | grep -q data && break || true
|
|
zpool import -f data
|
|
retry=$[$retry+1]
|
|
sleep 1
|
|
done
|
|
|
|
echo "mount zfs datasets"
|
|
zfs mount -a
|
|
|
|
echo "do bind mounts"
|
|
ruby /etc/lxc/hooks/update-mounts
|
|
mount -o bind /data/containers/login/rootfs/home/joerg /home/joerg/login
|
|
mount -o bind /data/containers/login/rootfs/home/devkid /home/devkid/login
|
|
mount -o bind /data/containers/pyload/rootfs/var/lib/pyload /data/pyload
|
|
mount -o bind /data/pacman/pkg /var/cache/pacman/pkg
|
|
mount -o bind /data/pacman/sync /var/lib/pacman/sync
|