posix formatting with shfmt

This commit is contained in:
Dejan Kutle 2022-07-05 20:02:28 +02:00
parent 846d2fb7ad
commit e2eb921348
No known key found for this signature in database
GPG key ID: 909D771047A9F6D8

View file

@ -57,14 +57,17 @@ usercheck() {
preinstallmsg() {
whiptail --title "Let's get this party started!" --yes-button "Let's go!" \
--no-button "No, nevermind!" \
--yesno "The rest of the installation will now be totally automated, so you can sit back and relax.\\n\\nIt will take some time, but when done, you can relax even more with your complete system.\\n\\nNow just press <Let's go!> and the system will begin installation!" 13 60 || { clear; exit 1; }
--yesno "The rest of the installation will now be totally automated, so you can sit back and relax.\\n\\nIt will take some time, but when done, you can relax even more with your complete system.\\n\\nNow just press <Let's go!> and the system will begin installation!" 13 60 || {
clear
exit 1
}
}
adduserandpass() {
# Adds user `$name` with password $pass1.
whiptail --infobox "Adding user \"$name\"..." 7 50
useradd -m -g wheel -s /bin/zsh "$name" >/dev/null 2>&1 \
|| usermod -a -G wheel "$name" && mkdir -p /home/"$name" && chown "$name":wheel /home/"$name"
useradd -m -g wheel -s /bin/zsh "$name" >/dev/null 2>&1 ||
usermod -a -G wheel "$name" && mkdir -p /home/"$name" && chown "$name":wheel /home/"$name"
export repodir="/home/$name/.local/src"
mkdir -p "$repodir"
chown -R "$name":wheel "$(dirname "$repodir")"
@ -110,7 +113,10 @@ manualinstall() {
sudo -u "$name" mkdir -p "$repodir/$1"
sudo -u "$name" git -C "$repodir" clone --depth 1 --single-branch \
--no-tags -q "https://aur.archlinux.org/$1.git" "$repodir/$1" ||
{ cd "$repodir/$1" || return 1 ; sudo -u "$name" git pull --force origin master ;}
{
cd "$repodir/$1" || return 1
sudo -u "$name" git pull --force origin master
}
cd "$repodir/$1" || exit 1
sudo -u "$name" -D "$repodir/$1" \
makepkg --noconfirm -si >/dev/null 2>&1 || return 1
@ -130,7 +136,10 @@ gitmakeinstall() {
--infobox "Installing \`$progname\` ($n of $total) via \`git\` and \`make\`. $(basename "$1") $2" 8 70
sudo -u "$name" git -C "$repodir" clone --depth 1 --single-branch \
--no-tags -q "$1" "$dir" ||
{ cd "$dir" || return 1 ; sudo -u "$name" git pull --force origin master ;}
{
cd "$dir" || return 1
sudo -u "$name" git pull --force origin master
}
cd "$dir" || exit 1
make >/dev/null 2>&1
make install >/dev/null 2>&1
@ -152,14 +161,14 @@ pipinstall() {
}
installationloop() {
([ -f "$progsfile" ] && cp "$progsfile" /tmp/progs.csv) \
|| curl -Ls "$progsfile" | sed '/^#/d' > /tmp/progs.csv
([ -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")"
echo "$comment" | grep -q "^\".*\"$" &&
comment="$(echo "$comment" | sed -E "s/(^\"|\"$)//g")"
case "$tag" in
"A") aurinstall "$program" "$comment" ;;
"G") gitmakeinstall "$program" "$comment" ;;