From 404bb418808d8cad8caeab5b7eb0aadb8c07bb1c Mon Sep 17 00:00:00 2001 From: amolinae06 Date: Sun, 18 May 2025 16:55:54 -0600 Subject: [PATCH] another attempt to fix chroot installations --- installer.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/installer.sh b/installer.sh index 4ebb9d9..b7f6388 100644 --- a/installer.sh +++ b/installer.sh @@ -1,8 +1,8 @@ #!/bin/sh dotfiles="https://git.amolinae.com/amolinae06/dotfiles.git" -software="software.csv" -devsoftware="devware.csv" +software="https://git.amolinae.com/amolinae06/installer/raw/branch/main/software.csv" +devsoftware="https://git.amolinae.com/amolinae06/installer/raw/branch/main/devware.csv" apk_install(){ echo "installing $1"; apk add "$1" >/dev/null 2>&1 @@ -10,7 +10,8 @@ apk_install(){ bwroot_apk_install(){ echo "installing $1 on chroot" - su - "$user" -c "zsh -lc 'bwroot /sbin/apk add \"$1\" >/dev/null 2>&1'" + ./sbin/apk.static -X https://dl-cdn.alpinelinux.org/alpine/v3.20/main \ + -U -p alpchroot/ add "$1" >/dev/null 2>&1 } git_install(){ @@ -23,7 +24,9 @@ deploy_dotfiles(){ } read_software(){ - tail -n +2 "$1" | sed -E ':a; s/("[^"]*),([^"]*")/\1\2/; ta' | while IFS=',' read -r NAME DESCRIPTION GIT GIT_URL; do + ([ -f "$1" ] && cp "$1" /tmp/temp.csv) || wget -qO- "$1" > /tmp/temp.csv + + tail -n +2 "/tmp/temp.csv" | 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" ;; @@ -31,6 +34,8 @@ read_software(){ *) echo "ERROR: failed to determine $NAME."; exit 1 ;; esac done + + rm "/tmp/progs.csv" printf "Successfully installed all software!\n" } @@ -56,6 +61,8 @@ EOF setup_shell(){ sed -i "/^$user:/s#:[^:]*\$#:/bin/zsh#" /etc/passwd mkdir -p "/home/$user/.cache/zsh" + touch "/home/$user/.cache/zsh/history" + chown -R "$user":"$user" "/home/$user/.cache/" echo "changed "$user"'s shell to zsh" }