#!/bin/bash set -e apt-get -y install mdadm btrfs-tools "./parted/${1}.sh" # "returns" /dev/md0 as root device echo -n 'Enter luks password: ' read -s md0pwd echo -n $md0pwd | cryptsetup -q luksFormat /dev/md0 unset md0pwd cryptsetup open --type luks /dev/md0 md0-unlocked mkfs.btrfs /dev/mapper/md0-unlocked mkdir /mnt/md0-unlocked mount /dev/mapper/md0-unlocked /mnt/md0-unlocked debootstrap --variant=minbase --arch=amd64 stretch /mnt/md0-unlocked https://deb.debian.org/debian/ mount -t proc none /mnt/md0-unlocked/proc mount -t sysfs none /mnt/md0-unlocked/sys mount -o bind /dev /mnt/md0-unlocked/dev cp docker.key /mnt/md0-unlocked/docker.key cp -a post-debootstrap-installer.sh /mnt/md0-unlocked/post-debootstrap-installer.sh chroot /mnt/md0-unlocked /post-debootstrap-installer.sh