summaryrefslogtreecommitdiff
path: root/airootfs/root/.loader
blob: 2daeab8f6ff4241dea0bf01ebc8d7fe5a41c6ae0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
set -e

dd if=/dev/zero of=/swapfile bs=1M count=512 status=progress
chmod 0600 /swapfile
mkswap /swapfile
swapon /swapfile
genfstab -U / | grep -v resolv > /etc/fstab

ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime

hwclock --systohc

echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" >> /etc/locale.conf

echo "$2" > /etc/hostname
echo "127.0.0.1		localhost" >  /etc/hosts
echo "::1		localhost" >> /etc/hosts
echo "127.0.1.1		$2.lan $2" >> /etc/hosts

OLD="HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)"
NEW="HOOKS=(base udev autodetect keyboard keymap consolefont modconf block encrypt filesystems fsck)"
sed -i "s|$OLD|$NEW|g" /etc/mkinitcpio.conf
mkinitcpio -P

UUID=$(lsblk --output UUID,PATH | grep "$3" | cut -f 1 -d ' ')
OLD="GRUB_CMDLINE_LINUX_DEFAULT=\"loglevel=3 quiet\""
NEW="GRUB_CMDLINE_LINUX_DEFAULT=\"loglevel=3 quiet cryptdevice=UUID=$UUID:cryptroot root=/dev/mapper/cryptroot\""
sed -i "s|$OLD|$NEW|g" /etc/default/grub

if ! test -e "/sys/firmware/efi/efivars"; then
	grub-install "$1"
else
	grub-install "$1" --efi-directory=/boot/
fi

grub-mkconfig -o /boot/grub/grub.cfg

passwd
rm /root/loader
echo "good to go !"