From f114eb48592672ba6648479393f9a17e88eb99fe Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sat, 19 Aug 2023 17:09:54 -0400 Subject: [PATCH] First tests with audible prompt worked, so changed the subscripts to use the same method. It should now use audible prompt when available and not give an error if it is not available. --- .includes/chuser.sh | 4 ++-- .includes/functions.sh | 6 +++--- .includes/gaming.sh | 18 +++++++++--------- .includes/screenreader.sh | 8 ++++---- .includes/timezone.sh | 14 +++++++------- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.includes/chuser.sh b/.includes/chuser.sh index cf486b2..83496da 100755 --- a/.includes/chuser.sh +++ b/.includes/chuser.sh @@ -48,7 +48,7 @@ fi # Heredocument left-aligned -cat << EOF | sudo tee /etc/cron.d/0chuser &> /dev/null +cat << EOF | sudo "${sudoFlags[@]}" tee /etc/cron.d/0chuser &> /dev/null SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin @reboot root usermod -a -G $groups -m -d /home/$newUser -l $newUser $oldUser && sed -i -e "s#NODM_USER=.*#NODM_USER='$newUser'#" -e "s#NODM_XSESSION=.*#NODM_XSESSION='/home/$newUser/.xinitrc'#" /etc/nodm.conf; rm -f /etc/cron.d/0chuser;reboot @@ -57,5 +57,5 @@ EOF # Heredocument end. # Files in cron.d must be 644 to work. - sudo chmod 644 /etc/cron.d/0chuser + sudo "${sudoFlags[@]}" chmod 644 /etc/cron.d/0chuser diff --git a/.includes/functions.sh b/.includes/functions.sh index 500e583..d71f247 100755 --- a/.includes/functions.sh +++ b/.includes/functions.sh @@ -1,13 +1,13 @@ install_package() { # If for some reason we have to change AUR helpers, this function should make it easy to update everything all at once. # make sure system is up to date - yay --sudoflags "-A" --sudoloop --noconfirm -Syu - yay --sudoflags "-A" --sudoloop --needed --noconfirm -Sy "$@" + yay --sudoflags "${sudoFlags[@]}" --sudoloop --noconfirm -Syu + yay --sudoflags "${sudoFlags[@]}" --sudoloop --needed --noconfirm -Sy "$@" } restart() { if dialog --clear --backtitle "Stormux" --yesno "Would you like to reboot now to apply changes?" 10 80 ; then - sudo reboot + sudo "${sudoFlags[@]}" reboot fi } diff --git a/.includes/gaming.sh b/.includes/gaming.sh index 849f795..b3bfa99 100755 --- a/.includes/gaming.sh +++ b/.includes/gaming.sh @@ -11,19 +11,19 @@ install_package cabextract box86 dos2unix p7zip unzip xdotool wineFile="$(mktemp)" curl --output "$wineFile" "$wineURL" # Create wine directory -sudo mkdir -p /opt/wine +sudo "${sudoFlags[@]}" mkdir -p /opt/wine pushd /opt/wine -sudo tar vxf "$wineFile" +sudo "${sudoFlags[@]}" tar vxf "$wineFile" popd # Create files and links in /usr/local/bin -sudo mkdir -p /usr/local/bin -echo -e '#!/bin/bash\nsetarch linux32 -L /opt/wine/bin/wine "$@"' | sudo tee /usr/local/bin/wine > /dev/null -sudo chmod 755 /usr/local/bin/wine +sudo "${sudoFlags[@]}" mkdir -p /usr/local/bin +echo -e '#!/bin/bash\nsetarch linux32 -L /opt/wine/bin/wine "$@"' | sudo "${sudoFlags[@]}" tee /usr/local/bin/wine > /dev/null +sudo "${sudoFlags[@]}" chmod 755 /usr/local/bin/wine find /opt/wine/bin/ -maxdepth 1 -type f -perm -u+x -exec bash -c ' for i ; do - sudo ln -s "$i" /usr/local/bin/ - sudo chmod 755 /usr/local/bin/"${i##*/}" + sudo "${sudoFlags[@]}" ln -s "$i" /usr/local/bin/ + sudo "${sudoFlags[@]}" chmod 755 /usr/local/bin/"${i##*/}" done' _ {} \; # Install audiogame-manager @@ -32,12 +32,12 @@ if [[ -d ~/audiogame-manager ]]; then else git clone https://git.stormux.org/storm/audiogame-manager ~/audiogame-manager fi -cat << EOF | sudo tee /usr/local/bin/audiogame-manager &> /dev/null +cat << EOF | sudo "${sudoFlags[@]}" tee /usr/local/bin/audiogame-manager &> /dev/null #!/usr/bin/env bash pushd ~/audiogame-manager ./audiogame-manager.sh $@ exit 0 EOF -sudo chmod 755 /usr/local/bin/audiogame-manager +sudo "${sudoFlags[@]}" chmod 755 /usr/local/bin/audiogame-manager restart diff --git a/.includes/screenreader.sh b/.includes/screenreader.sh index 814e1db..1539d7b 100644 --- a/.includes/screenreader.sh +++ b/.includes/screenreader.sh @@ -10,11 +10,11 @@ continue="$(yesno "Do you want to switch the active console screen reader to ${s if [[ "$continue" == "Yes" ]]; then if [[ "$screenreader" == "speakup" ]]; then install_package espeakup - sudo systemctl disable --now fenrirscreenreader.service - sudo systemctl enable --now espeakup.service + sudo "${sudoFlags[@]}" systemctl disable --now fenrirscreenreader.service + sudo "${sudoFlags[@]}" systemctl enable --now espeakup.service fi if [[ "$screenreader" == "fenrir" ]]; then - sudo systemctl disable --now espeakup.service - sudo systemctl enable --now fenrirscreenreader.service + sudo "${sudoFlags[@]}" systemctl disable --now espeakup.service + sudo "${sudoFlags[@]}" systemctl enable --now fenrirscreenreader.service fi fi diff --git a/.includes/timezone.sh b/.includes/timezone.sh index 0a3310b..02da4f9 100755 --- a/.includes/timezone.sh +++ b/.includes/timezone.sh @@ -21,15 +21,15 @@ mapfile -t cities < <(timedatectl --no-pager list-timezones | grep "$region" | c $(for i in ${cities[@]} ; do echo "$i";echo "$i";done) --stdout) # Set the timezone -sudo timedatectl set-timezone ${region}/${city} +sudo "${sudoFlags[@]}" timedatectl set-timezone ${region}/${city} if [[ -f /etc/localtime ]]; then - sudo rm /etc/localtime + sudo "${sudoFlags[@]}" rm /etc/localtime fi -sudo ln -s /usr/share/zoneinfo/${region}/${city} /etc/localtime +sudo "${sudoFlags[@]}" ln -s /usr/share/zoneinfo/${region}/${city} /etc/localtime # Make sure we are syncing with the internet echo "Setting up ntpd" -sudo timedatectl set-ntp false -sudo systemctl stop ntpd -sudo ntpd -Ggq &> /dev/null -sudo systemctl enable ntpd --now +sudo "${sudoFlags[@]}" timedatectl set-ntp false +sudo "${sudoFlags[@]}" systemctl stop ntpd +sudo "${sudoFlags[@]}" ntpd -Ggq &> /dev/null +sudo "${sudoFlags[@]}" systemctl enable ntpd --now