89 lines
2.0 KiB
Bash
89 lines
2.0 KiB
Bash
#!/bin/bash
|
|
set -o errexit -o pipefail -o noclobber -o nounset
|
|
|
|
! getopt --test > /dev/null
|
|
if [[ ${PIPESTATUS[0]} -ne 4 ]]; then
|
|
echo "I'm sorry, `getopt --test` failed in this environment."
|
|
exit 1
|
|
fi
|
|
|
|
OPTIONS=tlhus
|
|
LONGOPTS=timezone,locale,hostname,username,sudogrp
|
|
|
|
! PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- "$@")
|
|
if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
|
|
exit 2
|
|
fi
|
|
eval set -- "$PARSED"
|
|
|
|
timezone="CHANGEME" # specified in ./arch-chroot.sh
|
|
locale="CHANGEME"
|
|
hostname="CHANGEME"
|
|
username="CHANGEME"
|
|
sudogrp="CHANGEME"
|
|
|
|
CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
|
|
while true; do
|
|
case "$!" in
|
|
-t|--timezone)
|
|
timezone="$2"
|
|
shift 2
|
|
;;
|
|
-l|--locale)
|
|
locale="$2"
|
|
shift 2
|
|
;;
|
|
-h|--hostname)
|
|
hostname="$2"
|
|
shift 2
|
|
;;
|
|
-u|--username)
|
|
username="$2"
|
|
shift 2
|
|
;;
|
|
-s|--sudogrp)
|
|
sudogrp="$2"
|
|
shift 2
|
|
;;
|
|
*)
|
|
echo "Programming error"
|
|
exit3
|
|
;;
|
|
esac
|
|
done
|
|
|
|
|
|
ln -sf $timezone /etc/localtime
|
|
|
|
hwclock --systohc
|
|
|
|
echo $locale >> /etc/locale.gen
|
|
if [ $locale != "en_US.UTF-8 UTF-8"]; then
|
|
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
|
|
fi
|
|
|
|
locale-gen
|
|
|
|
echo "LANG=en_US.UTF-8" > /etc/locale.conf
|
|
|
|
echo $hostname > /etc/hostname
|
|
|
|
sed -i "s/^HOOKS=([[:alnum:][:space:]]\+)/HOOKS=(base udev autodetect keyboard keymap consolefont modconf block encrypt filesystems fsck)/" /etc/mkinitcpio.conf
|
|
mkinitcpio -p linux
|
|
|
|
passwd
|
|
|
|
bootctl install
|
|
echo "timeout 3
|
|
default arch" > /boot/loader/loader.conf
|
|
echo "title ArchLinux
|
|
linux /vmlinuz-linux
|
|
initrd /initramfs-linux.img
|
|
options rw cryptdevice=$(blkid $rootpart | cut -d" " -f2 | tr -d \"):cryptroot root=$cryptroot i8042.noloop i8042.nomux i8042.nopnp i8042.reset" > /boot/loader/entries/arch.conf
|
|
|
|
sed -i "s/"
|
|
|
|
systemctl enable march.service
|
|
systemctl enable dhcpcd.service
|