...
 
Commits (4)
......@@ -4,10 +4,24 @@ set -ex
DISK=$1
HOSTNAME=$2
EFI=$3
shift 2
[[ -z "$HOSTNAME" ]] && HOSTNAME=$(host $(ip addr | grep 'inet 147.251' | cut -d/ -f1 | sed 's/.*inet //') | sed 's/^.* \([a-z0-9]*\).fi.muni.cz.*$/\1/')
echo "installing $HOSTNAME to $DISK"
if [[ "$EFI" = "efi" ]]; then
# GPT table
# new partition 1 for EFI
# new partition 2 spanning rest of the disk
# LVM type partition
echo -e 'o\n' \
'n\n\n+128M\n' \
'n\n\n\n' \
'p\n' \
'w\n' \
| fdisk $DISK
PARTN=2
else
# MBR/DOS table
# new partition 1 spanning full disk
# LVM type partition
......@@ -17,9 +31,16 @@ echo -e 'o\n' \
'p\n' \
'w\n' \
| fdisk $DISK
pvcreate ${DISK}1
PARTN=1
fi
if [[ -b ${DISK}${PARTN} ]]; then
PART=${DISK}${PART}
else
PART=${DISK}p${PART}
fi
pvcreate $PART
VG=vg.$HOSTNAME
vgcreate $VG ${DISK}1
vgcreate $VG $PART
lvcreate -L128G -n root $VG
ROOTD=/dev/$VG/root
mkfs.xfs -m reflink=1 $ROOTD
......
......@@ -12,14 +12,14 @@ EOF
PATH=/usr/sbin:$PATH
apt update
tasksel install standard
apt install -yy locales ssh initramfs-tools linux-image-amd64 xfsprogs lvm2
apt install -yy locales ssh initramfs-tools linux-image-amd64 xfsprogs lvm2 vim
export DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_FRONTEND=noninteractive
echo "Europe/Prague" > /etc/timezone
rm -f /etc/localtime || true
dpkg-reconfigure tzdata
for ETH in $(ip link | grep ^[0-9]*: | cut -d: -f2 | grep -v lo); do
cat >> /etc/network/interfaces.d/${ETH}.conf <<EOF
cat >> /etc/network/interfaces.d/${ETH} <<EOF
auto $ETH
allow-hotplug $ETH
iface $ETH inet dhcp
......@@ -75,4 +75,6 @@ EOF
echo raid1 >> /etc/initramfs-tools/modules
update-initramfs -u -k all
passwd --delete root
# vim: ft=sh