install.sh 1008 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash

set -e
set -x

if [ -e /dev/vda ]; then
  device=/dev/vda
elif [ -e /dev/sda ]; then
  device=/dev/sda
else
  echo "ERROR: There is no disk available for installation" >&2
  exit 1
fi
export device

memory_size_in_kilobytes=$(free | awk '/^Mem:/ { print $2 }')
swap_size_in_kilobytes=$((memory_size_in_kilobytes * 2))
sfdisk "$device" <<EOF
label: dos
size=${swap_size_in_kilobytes}KiB, type=82
                                   type=83, bootable
EOF

mkswap "${device}1"
Christian Rebischke's avatar
Christian Rebischke committed
25
mkfs.ext4 -L "rootfs" "${device}2"
26
27
mount "${device}2" /mnt

Kristian Klausen's avatar
Kristian Klausen committed
28
29
if [ -n "${MIRROR}" ]; then
  echo "Server = ${MIRROR}" >/etc/pacman.d/mirrorlist
30
31
32
else
  pacman -Sy reflector
  reflector --age 12 --protocol https --sort rate --save /etc/pacman.d/mirrorlist
Kristian Klausen's avatar
Kristian Klausen committed
33
34
fi
pacstrap -M /mnt base linux grub openssh sudo polkit haveged netctl python reflector
35
swapon "${device}1"
36
genfstab -p /mnt >>/mnt/etc/fstab
37
38
swapoff "${device}1"

Kristian Klausen's avatar
Kristian Klausen committed
39
arch-chroot /mnt /usr/bin/sed -i 's/^#Server/Server/' /etc/pacman.d/mirrorlist
40
arch-chroot /mnt /bin/bash