another attempt to fix chroot installations
This commit is contained in:
parent
bba8e876c5
commit
404bb41880
1 changed files with 11 additions and 4 deletions
15
installer.sh
15
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"
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue