aboutsummaryrefslogtreecommitdiffstats
path: root/roles/space_server/bootstrap.sh
blob: 17f8c7ad742f359935829c1badc4c2e8f9afb2e9 (plain) (blame)
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
#!/bin/bash
#
# This script assumes filesystems and syslinux are already
# set up. If not here is a short, incomplete guide:
#
# Create a gpt partition table similar to this:
# Disk /dev/sda: 14,9 GiB, 16013942784 bytes, 31277232 sectors
# Units: sectors of 1 * 512 = 512 bytes
# Sector size (logical/physical): 512 bytes / 512 bytes
# I/O size (minimum/optimal): 512 bytes / 512 bytes
# Disklabel type: gpt
# Disk identifier: 45AA3BC2-C3B8-B24D-A5AF-59C9F2577554
#
# Device       Start      End  Sectors  Size Type
# /dev/sda1     2048  1048575  1046528  511M EFI System
# /dev/sda2  1048576 31277198 30228623 14,4G Linux filesystem
#
# Create boot filesystem:
# mkfs.vfat -v -F32 -n BOOT /dev/sda1
#
# Create root filesystem:
# mkfs.btrfs -m single -d single -L BTRFS /dev/sda2
#
# Install syslinux:
# mount -o noatime,fmask=0133,dmask=0022,utf8 /dev/sda1 /boot
# syslinux -d syslinux -i /dev/sda1
# cp /usr/share/syslinux/{ldlinux,libutil,menu}.c32 /boot/syslinux/
# dd bs=440 count=1 if=/usr/share/syslinux/gptmbr.bin of=/dev/sda
#
# Mount root filesystem:
# mount -o noatime,ssd,compress=lzo /dev/sda2 /mnt
#
# Create and mount home subvolume:
# btrfs subvolume create /mnt/home
# mount -o noatime,ssd,compress=lzo,subvol=/home /dev/sda2 /home
#
# Clone the labitat-ansible git repo to /home/ansible
# git clone <URL> /home/ansible
#
# Run this script

set -e
set -x

release=26
dest="/mnt/fedora$release"
if [[ -e "$dest" ]]; then
  echo "Destination '$dest' already exists. Aborting." >&2
  exit 1
fi

btrfs subvolume create "$dest"

dnf \
  --assumeyes \
  --installroot="$dest" \
  --releasever=$release \
  --disablerepo='*' \
  --enablerepo=fedora \
  --enablerepo=updates \
  install dnf python2-dnf ansible

systemd-nspawn -D "$dest" --bind /boot --bind /home -- \
  ansible-playbook -i space, -c local /home/ansible/space.yml

# vim: set ts=2 sw=2 et: