WIP
parent
c0b46ea867
commit
a326c20ca2
@ -0,0 +1,2 @@
|
|||||||
|
# <target> <source device> <key file> <options>
|
||||||
|
md0-unlocked /dev/md0 none luks,discard
|
@ -0,0 +1,7 @@
|
|||||||
|
#
|
||||||
|
# /etc/fstab: static file system information
|
||||||
|
#
|
||||||
|
# <file system> <dir> <type> <options> <dump> <pass>
|
||||||
|
|
||||||
|
/dev/mapper/md0-unlocked / btrfs relatime,ssd 0 0
|
||||||
|
/dev/md1 /boot btrfs relatime,ssd 0 0
|
@ -1,30 +0,0 @@
|
|||||||
#!/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
|
|
@ -0,0 +1,52 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
|
||||||
|
apt-get -y install mdadm btrfs-tools
|
||||||
|
|
||||||
|
# returns /dev/md0 as root device
|
||||||
|
# returns /dev/md1 as boot device
|
||||||
|
"./parted/${1}.sh"
|
||||||
|
|
||||||
|
# encrypt and unlock root device
|
||||||
|
echo 'Enter luks password: '
|
||||||
|
read -s md0pwd
|
||||||
|
echo -n $md0pwd | cryptsetup -q luksFormat /dev/md0
|
||||||
|
echo -n $md0pwd | cryptsetup open --type luks /dev/md0 md0-unlocked
|
||||||
|
unset md0pwd
|
||||||
|
|
||||||
|
|
||||||
|
# format
|
||||||
|
|
||||||
|
chroot=/mnt/md0-unlocked
|
||||||
|
|
||||||
|
# root device
|
||||||
|
mkfs.btrfs /dev/mapper/md0-unlocked
|
||||||
|
mkdir /mnt/md0-unlocked
|
||||||
|
mount /dev/mapper/md0-unlocked /mnt/md0-unlocked
|
||||||
|
|
||||||
|
# boot device
|
||||||
|
mkfs.btrfs /dev/md1
|
||||||
|
mkdir "$chroot/boot"
|
||||||
|
mount /dev/md1 "$chroot/boot"
|
||||||
|
|
||||||
|
|
||||||
|
# debootstrap
|
||||||
|
|
||||||
|
debootstrap --variant=minbase --arch=amd64 stretch "$chroot" https://deb.debian.org/debian/
|
||||||
|
|
||||||
|
mount -t proc none "$chroot/proc"
|
||||||
|
mount -t sysfs none "$chroot/sys"
|
||||||
|
mount -o bind /dev "$chroot/dev"
|
||||||
|
|
||||||
|
cp -a "$chroot/docker.key" \
|
||||||
|
"$chroot/post-debootstrap-installer.sh" \
|
||||||
|
/mnt/md0/unlocked/
|
||||||
|
|
||||||
|
# set hostname
|
||||||
|
echo "$2" > "$chroot/etc/hostname"
|
||||||
|
|
||||||
|
chroot "$chroot" /post-debootstrap-installer.sh
|
||||||
|
|
||||||
|
rm "$chroot/docker.key" \
|
||||||
|
"$chroot/post-debootstrap-installer.sh"
|
Loading…
Reference in New Issue