From b5f7d7748843163ee24cda4b3249854377b00adf Mon Sep 17 00:00:00 2001 From: Augusto Gunsch Date: Tue, 10 Aug 2021 14:45:40 -0300 Subject: [PATCH] Add post install script chaining --- install.sh | 27 +++++++++++++++++++++------ post-install.sh | 3 ++- test.sh | 4 ++++ 3 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 test.sh diff --git a/install.sh b/install.sh index 6abd531..3598b43 100755 --- a/install.sh +++ b/install.sh @@ -33,6 +33,7 @@ ultra_quiet() { ### URLs ### FZF_DOWNLOAD="$(curl -s https://api.github.com/repos/junegunn/fzf/releases/latest | grep linux_amd64 | sed -nE 's/^\s*"browser_download_url":\s*"(.*)"\s*$/\1/p')" PARTED_DOWNLOAD="https://archlinux.org/packages/extra/x86_64/parted/download" +POST_INSTALL_SCRIPT="https://raw.githubusercontent.com/augustogunsch/install-arch/master/post-install.sh" ### COLORS ### RED='\033[0;31m' @@ -251,10 +252,14 @@ setup_network() { ask_password() { echo -n "Type password for $1: " + stty -echo read USER_PASSWORD + stty echo echo -n "Confirm password: " + stty -echo local PASSWORD_CONFIRM read PASSWORD_CONFIRM + stty echo if [ "$USER_PASSWORD" != "$PASSWORD_CONFIRM" ]; then echo "Wrong passwords. Please try again." ask_password $1 @@ -272,7 +277,7 @@ prompt_all() { qpopd echo "Choose locale:" - local LOCALE=$(cat /etc/locale.gen | sed '/^#\s/D' | sed '/^#$/D' | sed 's/^#//' | fzf --layout=reverse --height=20) + LOCALE=$(cat /etc/locale.gen | sed '/^#\s/D' | sed '/^#$/D' | sed 's/^#//' | fzf --layout=reverse --height=20) ask_password root ROOT_PASSWORD="$USER_PASSWORD" @@ -286,6 +291,15 @@ prompt_all() { read MACHINE_HOSTNAME } +post_install() { + curl -sL "$POST_INSTALL_SCRIPT" -o post-install.sh + mv post-install /mnt/root + chmod +x /mnt/root + echo -n "Ready for post-install script. Press any key to continue..." + read dummy + right_chroot /root/post-install.sh +} + configure() { print_phase "System configuration" @@ -294,11 +308,6 @@ configure() { setup_grub setup_users setup_network - - umount -R /mnt - echo -n "Ready to reboot. Press any key to continue..." - read dummy - reboot } main() { @@ -306,6 +315,12 @@ main() { partition install_base configure + post_install + + umount -R /mnt + echo -n "Ready to reboot. Press any key to continue..." + read dummy + reboot } main diff --git a/post-install.sh b/post-install.sh index 1c24e62..f2574af 100755 --- a/post-install.sh +++ b/post-install.sh @@ -432,7 +432,8 @@ install_packages() { main() { #install_packages - configure_doas + #configure_doas + echo "POST INSTALL TEST" } main diff --git a/test.sh b/test.sh new file mode 100644 index 0000000..eef443e --- /dev/null +++ b/test.sh @@ -0,0 +1,4 @@ +#!/bin/sh +opts=$(stty -g) +stty -echo +