Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/http/install.sh
diff options
context:
space:
mode:
Diffstat (limited to 'http/install.sh')
-rw-r--r--http/install.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/http/install.sh b/http/install.sh
new file mode 100644
index 0000000..f1c97cc
--- /dev/null
+++ b/http/install.sh
@@ -0,0 +1,33 @@
+#!/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"
+mkfs.btrfs -L "rootfs" "${device}2"
+mount "${device}2" /mnt
+
+pacstrap /mnt base grub openssh sudo
+swapon "${device}1"
+genfstab -p /mnt >> /mnt/etc/fstab
+swapoff "${device}1"
+
+arch-chroot /mnt /bin/bash