forked from lubiland/hardware-setup
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.1 KiB
Bash
53 lines
1.1 KiB
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
if [[ -z $1 ]] || [[ -z $2 ]]; then
|
|
echo "Missing some arguments!"
|
|
echo "Usage: ./setup.sh <template> <fqdn>"
|
|
exit 1
|
|
fi
|
|
|
|
apt-get -y install lvm2 mdadm cryptsetup debootstrap btrfs-progs
|
|
|
|
# returns /dev/md0 as root device
|
|
# returns "$boot" as boot device
|
|
"./hardware/${1}/parted.sh" "$2"
|
|
root="hardware/${1}/root"
|
|
boot="hardware/${1}/boot"
|
|
esp="hardware/${1}/esp"
|
|
|
|
# format
|
|
chroot=/mnt/root-unlocked
|
|
mkdir "$chroot"
|
|
"./hardware/${1}/mkfs.sh" "$chroot" "$1"
|
|
|
|
|
|
# debootstrap
|
|
|
|
debootstrap --variant=minbase --arch=amd64 trixie "$chroot" https://deb.debian.org/debian/
|
|
|
|
mount -t proc none "$chroot/proc"
|
|
mount -t sysfs none "$chroot/sys"
|
|
mount --bind /dev "$chroot/dev"
|
|
mount --bind /run "$chroot/run"
|
|
|
|
|
|
# set hostname
|
|
echo "$2" > "$chroot/etc/hostname"
|
|
hostname "$2"
|
|
|
|
|
|
# create hardware-setup copy for post-debootstrap
|
|
mkdir "$chroot/hardware-setup"
|
|
cp -a * "$chroot/hardware-setup"
|
|
|
|
chroot "$chroot" /hardware-setup/post-debootstrap-installer.sh "$1"
|
|
|
|
rm -r "$chroot/hardware-setup"
|
|
|
|
echo "Don't forget to set a password with passwd ;-)"
|
|
echo
|
|
ls authorized_keys
|
|
echo
|
|
chroot "$chroot"
|