From 98c8ac0ddfdf99f04fec500a49ab8b704493c63e Mon Sep 17 00:00:00 2001 From: amolinae06 Date: Sun, 18 May 2025 13:15:20 -0600 Subject: [PATCH 1/6] Upload files to "/" --- installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index 1627642..d318897 100644 --- a/installer.sh +++ b/installer.sh @@ -69,7 +69,7 @@ setup_chroot(){ mkdir alpchroot curl -LO https://dl-cdn.alpinelinux.org/alpine/v3.20/main/x86_64/apk-tools-static-2.14.4-r1.apk tar -xzf apk-tools-static-*.apk - ./sbin/apk.static -X https://dl-cdn.alpinelinux.org/alpine/v3.20/main -U --allow-untrusted -p ${chroot_dir} --initdb add alpine-base + ./sbin/apk.static -X https://dl-cdn.alpinelinux.org/alpine/v3.20/main -U --allow-untrusted -p alpchroot/ --initdb add alpine-base mount -o bind /dev alpchroot/dev mount -t proc none alpchroot/proc mount -o bind /sys alpchroot/sys From 51038c8d415c122a052e41a4b038ce62ec9726c1 Mon Sep 17 00:00:00 2001 From: amolinae06 Date: Sun, 18 May 2025 14:33:56 -0600 Subject: [PATCH 2/6] add chroot software installation --- installer.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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 From 3ece92a15128550e7f78feafa570c4ce9fb188b5 Mon Sep 17 00:00:00 2001 From: amolinae06 Date: Sun, 18 May 2025 15:34:37 -0600 Subject: [PATCH 3/6] test --- installer.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index f0d0c75..b41607a 100644 --- a/installer.sh +++ b/installer.sh @@ -9,7 +9,11 @@ apk_install(){ } bwroot_apk_install(){ - echo "installing $1 on chroot"; su - "$user" -c "zsh -lc \"bwroot apk add $1 >/dev/null 2>&1\"" + echo "installing $1 on chroot" + + su - "$user" -c sh </dev/null 2>&1" +EOF } git_install(){ From 67bfd97863512dc1540e2bb06a266af33be13a4a Mon Sep 17 00:00:00 2001 From: amolinae06 Date: Sun, 18 May 2025 15:43:15 -0600 Subject: [PATCH 4/6] Update installer.sh --- installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index b41607a..f5f354c 100644 --- a/installer.sh +++ b/installer.sh @@ -86,7 +86,7 @@ setup_chroot(){ cp -L /etc/resolv.conf alpchroot/etc/ 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 + cp /etc/apk/repositories alpchroot/etc/apk/repositories apk del curl } From bba8e876c5d41bbd4e0e96b9040d9c93e5d515ff Mon Sep 17 00:00:00 2001 From: amolinae06 Date: Sun, 18 May 2025 16:01:25 -0600 Subject: [PATCH 5/6] attempt to fix chroot software installations --- installer.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/installer.sh b/installer.sh index f5f354c..4ebb9d9 100644 --- a/installer.sh +++ b/installer.sh @@ -10,10 +10,7 @@ apk_install(){ bwroot_apk_install(){ echo "installing $1 on chroot" - - su - "$user" -c sh </dev/null 2>&1" -EOF + su - "$user" -c "zsh -lc 'bwroot /sbin/apk add \"$1\" >/dev/null 2>&1'" } git_install(){ From 404bb418808d8cad8caeab5b7eb0aadb8c07bb1c Mon Sep 17 00:00:00 2001 From: amolinae06 Date: Sun, 18 May 2025 16:55:54 -0600 Subject: [PATCH 6/6] 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" }