53 lines
781 B
Bash
Executable file
53 lines
781 B
Bash
Executable file
#!/bin/bash
|
|
|
|
|
|
function first_stage(){
|
|
set -e
|
|
echo foo first_stage
|
|
|
|
apt install debootstrap
|
|
|
|
lsblk -ftpo NAME,FSTYPE,LABEL,UUID,FSAVAIL,MOUNTPOINT
|
|
select DEVICE in $(lsblk -frpno NAME); do
|
|
echo using $DEVICE
|
|
break
|
|
done
|
|
|
|
wipefs -a ${DEVICE}
|
|
|
|
(
|
|
echo o
|
|
echo n
|
|
echo
|
|
echo
|
|
echo
|
|
echo +2G
|
|
echo n
|
|
echo
|
|
echo
|
|
echo
|
|
echo w
|
|
) | fdisk ${DEVICE}
|
|
partprobe
|
|
|
|
lsblk
|
|
|
|
echo mkfs.ext4 ${DEVICE}1
|
|
mkfs.ext4 ${DEVICE}1
|
|
echo mkfs.ext4 ${DEVICE}2
|
|
mkfs.ext4 ${DEVICE}2
|
|
mount ${DEVICE}2 $TARGET
|
|
echo mount ${DEVICE}2 $TARGET
|
|
echo debootstrap sid $TARGET
|
|
debootstrap sid $TARGET
|
|
mount ${DEVICE}1 $TARGET/boot
|
|
echo mount ${DEVICE}1 $TARGET/boot
|
|
}
|
|
|
|
function second_stage(){
|
|
set -e
|
|
echo bar second_stage
|
|
passwd
|
|
echo -n > /etc/motd
|
|
apt install linux-image-amd64 grub2
|
|
}
|