diff --git a/install.sh b/install.sh index 2d7fdb7..f8a307c 100755 --- a/install.sh +++ b/install.sh @@ -1,5 +1,22 @@ #!/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=dtlhus +LONGOPTS=device,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" + device="CHANGEME" # Device that shoud be partitioned e.g. "/dev/sda" timezone="CHANGEME" # Your timezone according to /usr/share/zoneinfo/ e.g. "/usr/share/zoneinfo/EUROPE/Berlin" locale="CHANGEME" # Your locale according to /etc/locale.gen e.g. "en_US.UTF-8 UTF-8" @@ -9,6 +26,39 @@ sudogrp="CHANGEME" # Name of the sudogrp CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +while true; do + case "$!" in + -d|--device) + device="$2" + shift 2 + ;; + -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 + # partition 1: 1MiB -> 500MiB FAT32 # partition 2: 500MiB -> 3GiB swap # partition 3: 3GiB -> .. ext4 diff --git a/root/march-chroot.sh b/root/march-chroot.sh index 4513273..e493d72 100644 --- a/root/march-chroot.sh +++ b/root/march-chroot.sh @@ -1,4 +1,20 @@ #!/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" @@ -6,7 +22,37 @@ hostname="CHANGEME" username="CHANGEME" sudogrp="CHANGEME" -arch-chroot /mnt root/march-chroot.sh -t timezone -l locale -h hostname -u username -s sudogrp +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 diff --git a/root/march-reboot.sh b/root/march-reboot.sh index b3fba45..904e8c5 100644 --- a/root/march-reboot.sh +++ b/root/march-reboot.sh @@ -1,7 +1,54 @@ #!/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=us +LONGOPTS=username,sudogrp + +! PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- "$@") +if [[ ${PIPESTATUS[0]} -ne 0 ]]; then + exit 2 +fi +eval set -- "$PARSED" -sudogrp="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 pacman -S --noconfirm git zsh gvim wget arch-audit lightdm lightdm-webkit2-greeter xorg-server xf86-video-intel i3-gaps xorg-xbacklight xorg-xrandr i3lock-color alsa-utils pulseaudio pulseaudio-alsa pulseaudio-bluetooth playerctl pavucontrol exfat-utils udiskie blueman acpi acpid tlp compton conky rxvt-unicode networkmanager network-manager-applet networkmanager-openconnect networkmanager-openvpn stow maim openssh xdotool xclip thunderbird firefox veracrypt keepassxc texlive-most evince pandoc pdfgrep adobe-source-han-sans-otc-fonts python3 python3-pip ranger atool elinks ffmpegthumbnailer highlight libcaca lynx mediainfo odt2txt perl-image-exiftool poppler python-chardet transmission-cli w3m