2020-01-25 16:41:16 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-01-29 12:33:53 +00:00
|
|
|
|
2020-01-25 16:41:16 +00:00
|
|
|
function first_stage(){
|
2020-01-29 19:33:36 +00:00
|
|
|
set -e
|
2020-01-25 16:41:16 +00:00
|
|
|
echo foo first_stage
|
2020-01-29 12:37:36 +00:00
|
|
|
|
2020-01-29 20:12:51 +00:00
|
|
|
apt install debootstrap
|
2020-01-29 12:59:43 +00:00
|
|
|
|
2020-01-29 19:41:05 +00:00
|
|
|
lsblk -ftpo NAME,FSTYPE,LABEL,UUID,FSAVAIL,MOUNTPOINT
|
2020-01-29 19:29:15 +00:00
|
|
|
select DEVICE in $(lsblk -frpno NAME); do
|
|
|
|
echo using $DEVICE
|
2020-01-29 19:32:56 +00:00
|
|
|
break
|
2020-01-29 19:29:15 +00:00
|
|
|
done
|
2020-01-29 12:37:36 +00:00
|
|
|
|
2020-01-29 20:02:02 +00:00
|
|
|
wipefs -a ${DEVICE}
|
|
|
|
|
|
|
|
(
|
|
|
|
echo o
|
|
|
|
echo n
|
2020-01-29 20:12:06 +00:00
|
|
|
echo p
|
|
|
|
echo 1
|
2020-01-29 20:06:12 +00:00
|
|
|
echo
|
2020-01-29 20:02:02 +00:00
|
|
|
echo +2G
|
|
|
|
echo n
|
2020-01-29 20:12:06 +00:00
|
|
|
echo p
|
|
|
|
echo 2
|
2020-01-29 20:02:02 +00:00
|
|
|
echo
|
2020-01-29 20:12:06 +00:00
|
|
|
echo
|
2020-01-29 20:02:02 +00:00
|
|
|
echo w
|
|
|
|
) | fdisk ${DEVICE}
|
|
|
|
|
2020-01-29 20:03:26 +00:00
|
|
|
lsblk
|
|
|
|
|
2020-01-29 20:02:02 +00:00
|
|
|
echo mkfs.ext4 ${DEVICE}1
|
|
|
|
mkfs.ext4 ${DEVICE}1
|
2020-01-29 20:03:26 +00:00
|
|
|
echo mkfs.ext4 ${DEVICE}2
|
|
|
|
mkfs.ext4 ${DEVICE}2
|
|
|
|
mount ${DEVICE}2 $TARGET
|
|
|
|
echo mount ${DEVICE}2 $TARGET
|
2020-01-29 12:33:53 +00:00
|
|
|
echo debootstrap sid $TARGET
|
2020-01-29 12:38:18 +00:00
|
|
|
debootstrap sid $TARGET
|
2020-01-29 20:03:26 +00:00
|
|
|
mount ${DEVICE}1 $TARGET/boot
|
|
|
|
echo mount ${DEVICE}1 $TARGET/boot
|
2020-01-25 16:41:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function second_stage(){
|
2020-01-29 19:33:36 +00:00
|
|
|
set -e
|
2020-01-25 16:41:16 +00:00
|
|
|
echo bar second_stage
|
2020-01-29 19:29:15 +00:00
|
|
|
passwd
|
|
|
|
echo -n > /etc/motd
|
2020-01-29 19:38:04 +00:00
|
|
|
apt install linux-image-amd64 grub2
|
2020-01-25 16:41:16 +00:00
|
|
|
}
|