Replace install loops with singular commands
This commit is contained in:
parent
7a6febe2ef
commit
c219859dbb
1 changed files with 9 additions and 29 deletions
38
bs.sh
38
bs.sh
|
@ -191,33 +191,15 @@ manualinstall() {
|
|||
makepkg --noconfirm -si >/dev/null 2>&1 || return 1
|
||||
}
|
||||
|
||||
maininstall() {
|
||||
# Installs all needed programs from main repo.
|
||||
whiptail --title "LARBS Installation" --infobox "Installing \`$1\` ($n of $total). $1 $2" 9 70
|
||||
installpkg "$1"
|
||||
}
|
||||
|
||||
aurinstall() {
|
||||
whiptail --title "LARBS Installation" \
|
||||
--infobox "Installing \`$1\` ($n of $total) from the AUR. $1 $2" 9 70
|
||||
echo "$aurinstalled" | grep -q "^$1$" && return 1
|
||||
sudo -u "$name" $aurhelper -S --noconfirm "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
installationloop() {
|
||||
maininstallations() {
|
||||
([ -f "$progsfile" ] && cp "$progsfile" /tmp/progs.csv) ||
|
||||
curl -Ls "$progsfile" | sed '/^#/d' >/tmp/progs.csv
|
||||
total=$(wc -l </tmp/progs.csv)
|
||||
aurinstalled=$(pacman -Qqm)
|
||||
while IFS=, read -r tag program comment; do
|
||||
n=$((n + 1))
|
||||
echo "$comment" | grep -q "^\".*\"$" &&
|
||||
comment="$(echo "$comment" | sed -E "s/(^\"|\"$)//g")"
|
||||
case "$tag" in
|
||||
"A") aurinstall "$program" "$comment" ;;
|
||||
*) maininstall "$program" "$comment" ;;
|
||||
esac
|
||||
done </tmp/progs.csv
|
||||
# Field 1: install-type, Field 2: program, Field 3: comment
|
||||
# Install pacman packages:
|
||||
awk '$1 ~ /^$/ { print $2 }' | xargs pacman --noconfirm --needed -S </tmp/progs.csv
|
||||
awk '$1 ~ /^A$/ { print $2 }' | xargs "$aurhelper" --noconfirm --needed -S </tmp/progs.csv
|
||||
}
|
||||
|
||||
finalize() {
|
||||
|
@ -251,11 +233,9 @@ preinstallmsg || error "User exited."
|
|||
refreshkeys ||
|
||||
error "Error automatically refreshing Arch keyring. Consider doing so manually."
|
||||
|
||||
for x in curl ca-certificates base-devel git ntp zsh dash; do
|
||||
whiptail --title "LARBS Installation" \
|
||||
--infobox "Installing \`$x\` which is required to install and configure other programs." 8 70
|
||||
installpkg "$x"
|
||||
done
|
||||
whiptail --title "LARBS Installation" \
|
||||
--infobox "Installing software required to install and configure other programs." 8 70
|
||||
pacman --noconfirm --needed -S curl ca-certificates base-devel git ntp zsh dash
|
||||
|
||||
whiptail --title "LARBS Installation" \
|
||||
--infobox "Synchronizing system time to ensure successful and secure installation of software..." 8 70
|
||||
|
@ -287,7 +267,7 @@ $aurhelper -Y --save --devel
|
|||
# installs each needed program the way required. Be sure to run this only after
|
||||
# the user has been created and has priviledges to run sudo without a password
|
||||
# and all build dependencies are installed.
|
||||
installationloop
|
||||
maininstallations
|
||||
|
||||
# Most important command! Get rid of the beep!
|
||||
rmmod pcspkr
|
||||
|
|
Loading…
Add table
Reference in a new issue