You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hardware-setup/post-debootstrap-installer.sh

67 lines
1.7 KiB
Bash

#!/bin/bash
set -e
7 years ago
7 years ago
# locales
echo 'console-setup console-setup/charmap47 select UTF-8' | debconf-set-selections
echo 'keyboard-configuration keyboard-configuration/variant select English (US)' | debconf-set-selections
echo 'keyboard-configuration kekeyboard-configuration keyboard-configuration/layout select English (US)' | debconf-set-selections
7 years ago
echo 'locales locales/default_environment_locale select en_US.UTF-8' | debconf-set-selections
echo 'locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8' | debconf-set-selections
7 years ago
apt-get -y install locales
7 years ago
7 years ago
### boot
7 years ago
apt-get -y install mdadm cryptsetup systemd systemd-sysv dropbear
7 years ago
# generate minimal mdadm.conf
mdadm --examine --scan | perl -pe 's/.*\/dev\/md\/?([0-9]+) .*UUID\=(.+?) .*/ARRAY \/dev\/md$1 UUID=$2/' > /etc/mdadm/mdadm.conf
7 years ago
# concat user keys for cryptsetup unlocking at boot
cat /authorized_keys/* > /etc/dropbear-initramfs/authorized_keys
7 years ago
# after cryptsetup, mdadm, ... because of update-initramfs
apt-get -y install linux-image-amd64
7 years ago
DEBIAN_FRONTEND=noninteractive apt-get -y install grub-pc
7 years ago
/grub.sh
7 years ago
update-grub
7 years ago
### users
apt-get -y install sudo
for key in /authorized_keys/*; do
user=$(basename "$key")
adduser --gecos '' --disabled-password "$user"
mkdir -p /home/"$user"/.ssh
cp "$key" /home/"$user"/.ssh/authorized_keys
chown "$user": /home/"$user"/.ssh/authorized_keys
adduser "$user" sudo
done
7 years ago
7 years ago
### Docker
7 years ago
7 years ago
# add docker key
apt-get -y install gnupg2
7 years ago
apt-key add docker.key
7 years ago
apt-get -y --purge autoremove gnupg2
echo 'deb https://download.docker.com/linux/debian stretch stable' > /etc/apt/sources.list.d/docker.list
apt-get update
7 years ago
apt-get -y install docker-ce
7 years ago
7 years ago
### tbd
7 years ago
7 years ago
apt-get -y install \
7 years ago
man-db \
vim