Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/http
diff options
context:
space:
mode:
authorChristian Rebischke <Chris.Rebischke@posteo.de>2017-05-06 03:38:46 +0200
committerChristian Rebischke <Chris.Rebischke@posteo.de>2017-05-06 03:38:46 +0200
commit5eab5731066846c624909f48e8629f4550173b29 (patch)
tree6776f3a66b098eab506ff164a4b2730a66271276 /http
parent02227c3029362fec100413f026e8982efb0b08e9 (diff)
added first version of new install scripts
Diffstat (limited to 'http')
-rw-r--r--http/install-chroot.sh38
-rw-r--r--http/install.sh33
2 files changed, 71 insertions, 0 deletions
diff --git a/http/install-chroot.sh b/http/install-chroot.sh
new file mode 100644
index 0000000..392e24f
--- /dev/null
+++ b/http/install-chroot.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+set -e
+set -x
+
+ln -sf /usr/share/zoneinfo/UTC /etc/localtime
+hostnamectl set-hostname "archlinux"
+sed -i -e 's/^#\(en_US.UTF-8\)/\1/' /etc/locale.gen
+locale-gen
+localectl set-locale "LANG=en_US.UTF-8"
+localectl set-keymap "us"
+localectl set-xx1-keymap "us"
+
+# setting vagrant user credentials
+echo -e 'vagrant\nvagrant' | passwd
+useradd -m -U vagrant
+echo -e 'vagrant\nvagrant' | passwd vagrant
+
+# setting sudo for vagrant user
+cat <<EOF > /etc/sudoers.d/vagrant
+Defaults:vagrant !requiretty
+vagrant ALL=(ALL) NOPASSWD: ALL
+EOF
+chmod 440 /etc/sudoers.d/vagrant
+
+# install vagrant ssh key
+install --directory --owner=vagrant --group=vagrant --mode=0700 /home/vagrant/.ssh
+curl --output /home/vagrant/.ssh/authorized_keys --location https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub
+chown vagrant:vagrant /home/vagrant/.ssh/authorized_keys
+chmod 0600 /home/vagrant/.ssh/authorized_keys
+
+# enabling important services
+systemctl enable sshd
+systemctl enable systemd-networkd
+
+grub-install "$device"
+sed -i -e 's/^GRUB_TIMEOUT=.*$/GRUB_TIMEOUT=1/' /etc/default/grub
+grub-mkconfig -o /boot/grub/grub.cfg
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