blob: 764097808b8d0c82b8ada97d44327f58cdbaf554 (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
#!/bin/sh
INSTALL_DRIVE=/dev/sda
PARTITION_BOOT=1
PARTITION_SWAP=2
PARTITION_ROOT=3
LABEL_BOOT=BOOT
LABEL_SWAP=SWAP
LABEL_ROOT=ROOT
MOUNT_PATH=/mnt
echo "Installing minimalistic base system.."
sgdisk -Z ${INSTALL_DRIVE}
sgdisk -a 2048 -o ${INSTALL_DRIVE}
sgdisk -n ${PARTITION_BOOT}:0:+100M ${INSTALL_DRIVE}
sgdisk -t ${PARTITION_BOOT}:ef02 ${INSTALL_DRIVE}
sgdisk -c ${PARTITION_BOOT}:"${LABEL_BOOT}" ${INSTALL_DRIVE}
sgdisk -n ${PARTITION_SWAP}:0:+900M ${INSTALL_DRIVE}
sgdisk -t ${PARTITION_SWAP}:8200 ${INSTALL_DRIVE}
sgdisk -c ${PARTITION_SWAP}:"${LABEL_SWAP}" ${INSTALL_DRIVE}
sgdisk -n ${PARTITION_ROOT}:0:0 ${INSTALL_DRIVE}
sgdisk -t ${PARTITION_ROOT}:8300 ${INSTALL_DRIVE}
sgdisk -c ${PARTITION_ROOT}:"${LABEL_ROOT}" ${INSTALL_DRIVE}
sgdisk -G ${INSTALL_DRIVE}
mkswap ${INSTALL_DRIVE}${PARTITION_SWAP}
swapon ${INSTALL_DRIVE}${PARTITION_SWAP}
mkfs.ext4 ${INSTALL_DRIVE}${PARTITION_ROOT}
mkdir -p ${MOUNT_PATH}
mount ${INSTALL_DRIVE}${PARTITION_ROOT} ${MOUNT_PATH}
export http_proxy=http://192.168.1.12:3128
pacstrap ${MOUNT_PATH} filesystem grep findutils coreutils glibc bash pacman mkinitcpio kernel26 dhcpcd
arch-chroot ${MOUNT_PATH} pacman --noconfirm -S grub-bios
arch-chroot ${MOUNT_PATH} grub-install --target=i386-pc --recheck ${INSTALL_DRIVE}
cp ${MOUNT_PATH}/usr/share/locale/en@quot/LC_MESSAGES/grub.mo ${MOUNT_PATH}/boot/grub/locale/en.mo
# disable quiet mode, set text mode instead of graphical mode
# also ban cirrus KVM
# set correct path of systemd binary (symlink /sbin/init has gone)
sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="quiet"/GRUB_CMDLINE_LINUX_DEFAULT="modprobe.blacklist=cirrus init=\/usr\/lib\/systemd\/systemd"/g' ${MOUNT_PATH}/etc/default/grub
sed -i 's/GRUB_GFXMODE=auto/GRUB_GFXMODE=text/g' ${MOUNT_PATH}/etc/default/grub
sed -i 's/#GRUB_TERMINAL_OUTPUT=console/GRUB_TERMINAL_OUTPUT=console/g' ${MOUNT_PATH}/etc/default/grub
arch-chroot ${MOUNT_PATH} grub-mkconfig -o /boot/grub/grub.cfg
genfstab -p ${MOUNT_PATH} >> ${MOUNT_PATH}/etc/fstab
sed -i 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' ${MOUNT_PATH}/etc/locale.gen
arch-chroot ${MOUNT_PATH} locale-gen
echo LANG=en_US.UTF-8 > ${MOUNT_PATH}/etc/locale.conf
ln -s /usr/share/zoneinfo/Europe/Zurich ${MOUNT_PATH}/etc/localtime
arch-chroot ${MOUNT_PATH} hwclock --systohc --utc
echo "archiso" > ${MOUNT_PATH}/etc/hostname
arch-chroot ${MOUNT_PATH} systemctl enable dhcpcd@ens3.service
arch-chroot ${MOUNT_PATH} sh -c "echo 'root:xx' | chpasswd"
# switch off signature for now
arch-chroot ${MOUNT_PATH} sed -i 's/^SigLevel.*/SigLevel = Never/g' /etc/pacman.conf
# monitord needs netstat
arch-chroot ${MOUNT_PATH} pacman --noconfirm -S net-tools
# we use 'git' to manage our promises
arch-chroot ${MOUNT_PATH} pacman --noconfirm -S git-core
# switch proxy off now, we go local now
unset http_proxy
arch-chroot ${MOUNT_PATH} pacman --noconfirm -v -U http://10.0.2.2:8080/qdbm-1.8.78-1-x86_64.pkg.tar.xz
arch-chroot ${MOUNT_PATH} pacman --noconfirm -v -U http://10.0.2.2:8080/cfengine-3.4.4-2-x86_64.pkg.tar.xz
# install rules for the machine from git
# TODO
# enable cfengine
arch-chroot ${MOUNT_PATH} systemctl enable cf-execd.service
arch-chroot ${MOUNT_PATH} systemctl enable cf-monitord.service
arch-chroot ${MOUNT_PATH} systemctl enable cf-serverd.service
echo "Done. Press any key to poweroff."
read x
systemctl poweroff
|