diff --git a/installer.sh b/installer.sh index d318897..f0d0c75 100644 --- a/installer.sh +++ b/installer.sh @@ -8,6 +8,10 @@ apk_install(){ echo "installing $1"; apk add "$1" >/dev/null 2>&1 } +bwroot_apk_install(){ + echo "installing $1 on chroot"; su - "$user" -c "zsh -lc \"bwroot apk add $1 >/dev/null 2>&1\"" +} + git_install(){ echo "cloning from $1"; su - "$user" -c "cd ~/.local/src && git clone \"$1\"" >/dev/null 2>&1 } @@ -18,10 +22,11 @@ deploy_dotfiles(){ } read_software(){ - tail -n +2 "$software" | sed -E ':a; s/("[^"]*),([^"]*")/\1\2/; ta' | while IFS=',' read -r NAME DESCRIPTION GIT GIT_URL; do + tail -n +2 "$1" | sed -E ':a; s/("[^"]*),([^"]*")/\1\2/; ta' | while IFS=',' read -r NAME DESCRIPTION GIT GIT_URL; do case "$GIT" in "N") apk_install $NAME ;; "Y") git_install "$GIT_URL" ;; + "D") bwroot_apk_install $NAME ;; *) echo "ERROR: failed to determine $NAME."; exit 1 ;; esac done @@ -49,6 +54,7 @@ EOF setup_shell(){ sed -i "/^$user:/s#:[^:]*\$#:/bin/zsh#" /etc/passwd + mkdir -p "/home/$user/.cache/zsh" echo "changed "$user"'s shell to zsh" } @@ -63,7 +69,7 @@ setup_home(){ } setup_chroot(){ - printf "Setting up chroot" + printf "Setting up chroot\n" apk_install curl cd "/home/$user/Documents/Miscellaneous" mkdir alpchroot @@ -74,7 +80,7 @@ setup_chroot(){ mount -t proc none alpchroot/proc mount -o bind /sys alpchroot/sys cp -L /etc/resolv.conf alpchroot/etc/ - chown -R "$user":"$user" alpchroot/ + chown -R "$user":"$user" alpchroot/ >/dev/null 2>&1 mkdir -p alpchroot/etc/apk echo "https://dl-cdn.alpinelinux.org/alpine/latest-stable/main" > alpchroot/etc/apk/repositories apk del curl @@ -95,10 +101,11 @@ check_root echo "Welcome to the installer" apk_install git get_user -read_software +read_software "$software" setup_home deploy_dotfiles setup_greetd setup_shell setup_bluetooth setup_chroot +read_software "$devsoftware" \ No newline at end of file