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