]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/bash | |
2 | ||
3 | set -e | |
4 | ||
5 | git_branch="$1" | |
6 | environment="$2" | |
7 | ||
8 | # Randomizer | |
9 | apt-get update | |
10 | apt-get install -y haveged | |
11 | haveged & | |
12 | # /Randomizer | |
13 | ||
14 | # Prepare an arch chroot | |
15 | cd /tmp | |
16 | ||
17 | LATEST=$(curl -L https://mirrors.kernel.org/archlinux/iso/latest/sha1sums.txt | grep "bootstrap" | head -n1) | |
18 | SHA1=$(echo "$LATEST" | cut -d' ' -f1) | |
19 | NAME=$(echo "$LATEST" | cut -d' ' -f3) | |
20 | ||
21 | curl -L -O "https://mirrors.kernel.org/archlinux/iso/latest/$NAME" | |
22 | ||
23 | tar -xzf "$NAME" | |
24 | ||
25 | echo 'Server = http://archlinux.mirrors.ovh.net/archlinux/$repo/os/$arch' > /tmp/root.x86_64/etc/pacman.d/mirrorlist | |
26 | # /Prepare an arch chroot | |
27 | ||
28 | # Prepare device information (not available in chroot) | |
29 | DEVICE_STR=$(cat /proc/mounts | grep "/dev/[sv]d.. /mnt/") | |
30 | DEVICE=$(echo "$DEVICE_STR" | cut -d' ' -f1) | |
31 | MOUNTPOINT=$(echo "$DEVICE_STR" | cut -d' ' -f2) | |
32 | ||
33 | umount "$DEVICE" | |
34 | UUID=$(lsblk -rno UUID "$DEVICE") | |
35 | ||
36 | echo "$UUID" > /tmp/root.x86_64/device_uuid | |
37 | # /Prepare device information | |
38 | ||
39 | # Install very basic system via chroot (base git puppet) | |
40 | cp /tmp/arch_chroot_script.sh /tmp/root.x86_64/ | |
41 | ||
42 | /tmp/root.x86_64/bin/arch-chroot /tmp/root.x86_64/ /arch_chroot_script.sh | |
43 | # /Install very basic system via chroot | |
44 | ||
45 | # Mount and install rest of system (via puppet) | |
46 | mount "$DEVICE" | |
47 | ||
48 | cp /tmp/arch_install_script.sh "$MOUNTPOINT/root/" | |
49 | cp /tmp/puppet_variables.json "$MOUNTPOINT/root/" | |
50 | ||
51 | /tmp/root.x86_64/bin/arch-chroot "$MOUNTPOINT" /root/arch_install_script.sh "$git_branch" "$environment" | |
52 | # /Mount and install rest of system | |
53 |