From 5f5a98ec79e48f25a464bbfa8a6e8637643b5661 Mon Sep 17 00:00:00 2001 From: Aminda Suomalainen Date: Thu, 18 May 2023 12:25:47 +0300 Subject: [PATCH] add & run shfmt --- .pre-commit-config.yaml | 5 ++++ bash/T2L-apps.bash | 2 +- bash/acmesh-ssl.bash | 2 +- bash/addusers | 6 ++--- bash/comms.bash | 27 +++++++++---------- bash/deb-update.bash | 3 +-- bash/deprecated/certbot-ssl.sh | 2 +- bash/deprecated/ydns-simple | 5 ++-- bash/deprecated/ydns6 | 3 +-- bash/download-forgejo.bash | 6 ++--- bash/fixgrub.bash | 3 +-- ...enerator-wellBeingRegionElections2022.bash | 2 +- bash/swaymirror.bash | 2 +- bash/transmission-export-magnets.bash | 5 ++-- bash/usr-local-bin/brave | 2 +- bash/usr-local-bin/firefox | 9 +++---- bash/usr-local-bin/fluffychat | 6 ++--- bash/usr-local-bin/go | 3 +-- bash/usr-local-bin/microsoft-edge | 2 +- bash/usr-local-bin/thunderbird | 9 +++---- bash/usr-local-bin/vivaldi | 2 +- bash/wifiqr.bash | 1 - 22 files changed, 46 insertions(+), 61 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 13450de..3c4e43c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -40,6 +40,11 @@ repos: hooks: - id: black #- id: black-jupyter + - repo: https://github.com/scop/pre-commit-shfmt + rev: v3.6.0-2 + hooks: + - id: shfmt + #- id: shfmt-docker - repo: https://github.com/editorconfig-checker/editorconfig-checker.python rev: "2.7.1" hooks: diff --git a/bash/T2L-apps.bash b/bash/T2L-apps.bash index 8da87c7..3393cdf 100755 --- a/bash/T2L-apps.bash +++ b/bash/T2L-apps.bash @@ -1,4 +1,4 @@ #!/usr/bin/env bash mkdir -p ~/.config/T2L-telegram -telegram-desktop -many -workdir ~/.config/T2L-telegram -startintray& +telegram-desktop -many -workdir ~/.config/T2L-telegram -startintray & #flatpak run im.riot.Riot --profile T2L --hidden --proxy --proxy-server=127.0.0.1:9119& diff --git a/bash/acmesh-ssl.bash b/bash/acmesh-ssl.bash index 09345f2..6ebb02f 100755 --- a/bash/acmesh-ssl.bash +++ b/bash/acmesh-ssl.bash @@ -64,7 +64,7 @@ chown -R oragono:oragono $ORAGONODIR # WeeChat relay, remember to /relay sslcertkey $ACMESH -d $DOMAINNAME --fullchain-file $WEECHATDIR/fullchain.pem --key-file $WEECHATDIR/privkey.pem -cat $WEECHATDIR/{fullchain,privkey}.pem > $WEECHATDIR/relay.pem +cat $WEECHATDIR/{fullchain,privkey}.pem >$WEECHATDIR/relay.pem chmod -R 700 $WEECHATDIR chown -R mikaela:mikaela $WEECHATDIR diff --git a/bash/addusers b/bash/addusers index 874b297..f7ced53 100755 --- a/bash/addusers +++ b/bash/addusers @@ -4,8 +4,7 @@ # installations. I am too lazy to always do this by hand! # Loop with the users -for user in mikaela matti tommi tiina nenne anneli -do +for user in mikaela matti tommi tiina nenne anneli; do # To see that it works echo "Current user: $user" # Create the user & homedir if it doesn't exist @@ -21,8 +20,7 @@ do done # And next sudoers -for sudoer in mikaela matti tommi tiina -do +for sudoer in mikaela matti tommi tiina; do # Add the user to sudo group (as they are administrator) echo "Current sudoer: $sudoer" usermod -a -G wheel $sudoer diff --git a/bash/comms.bash b/bash/comms.bash index 029be55..9479b7d 100755 --- a/bash/comms.bash +++ b/bash/comms.bash @@ -8,47 +8,46 @@ set -x # XMPP if hash dino 2>/dev/null; then - (dino&) + (dino &) fi if hash gajim 2>/dev/null; then - (gajim&) + (gajim &) else - (flatpak run org.gajim.Gajim --quiet&) + (flatpak run org.gajim.Gajim --quiet &) fi # Jami, mostly P2P app if hash jami-gnome 2>/dev/null; then - (jami-gnome -r&) + (jami-gnome -r &) fi # Telegram.org -if [ -f ~/.local/Telegram/Updater ] -then - (~/.local/Telegram/Updater -many -startintray&) +if [ -f ~/.local/Telegram/Updater ]; then + (~/.local/Telegram/Updater -many -startintray &) else -if hash telegram-desktop 2>/dev/null; then - (telegram-desktop -many -startintray&) + if hash telegram-desktop 2>/dev/null; then + (telegram-desktop -many -startintray &) fi fi # Keybase if hash run_keybase 2>/dev/null; then - (run_keybase&) + (run_keybase &) fi # Steam if hash steam 2>/dev/null; then - (STEAM_FRAME_FORCE_CLOSE=1 steam -silent&) + (STEAM_FRAME_FORCE_CLOSE=1 steam -silent &) fi # Signal -(flatpak run org.signal.Signal --start-in-tray&) +(flatpak run org.signal.Signal --start-in-tray &) # Microsoft Teams -(flatpak run com.microsoft.Teams&) +(flatpak run com.microsoft.Teams &) # IRC/HexChat -(flatpak run io.github.Hexchat&) +(flatpak run io.github.Hexchat &) # Matrix # Elements (previously Riot) perform poorly with this script, use container diff --git a/bash/deb-update.bash b/bash/deb-update.bash index 3125508..848e9ee 100755 --- a/bash/deb-update.bash +++ b/bash/deb-update.bash @@ -105,8 +105,7 @@ if hash needrestart 2>/dev/null; then fi # Sedric workaround, located in this repo. I trust /root/ -if [ -f /root/fixgrub.bash ] -then +if [ -f /root/fixgrub.bash ]; then /root/fixgrub.bash fi diff --git a/bash/deprecated/certbot-ssl.sh b/bash/deprecated/certbot-ssl.sh index bb12cab..3c43d4e 100755 --- a/bash/deprecated/certbot-ssl.sh +++ b/bash/deprecated/certbot-ssl.sh @@ -16,4 +16,4 @@ chown -R mumble-server:mumble-server /var/lib/mumble-server/ssl/ pkill $(cat /var/run/mumble-server/mumble-server.pid) -USR1 # ZNC via https://wiki.znc.in/Signed_SSL_certificate#Certbot -cat /etc/letsencrypt/live/relpda.mikaela.info/{privkey,fullchain}.pem > /home/znc/.znc/znc.pem +cat /etc/letsencrypt/live/relpda.mikaela.info/{privkey,fullchain}.pem >/home/znc/.znc/znc.pem diff --git a/bash/deprecated/ydns-simple b/bash/deprecated/ydns-simple index 1ffe41a..1363fd8 100755 --- a/bash/deprecated/ydns-simple +++ b/bash/deprecated/ydns-simple @@ -11,7 +11,6 @@ ## Copy-paste the following to your crontab without the # # */5 * * * * /usr/local/bin/ydns-simple >/dev/null 2>&1 - # yDNS details USEREMAIL="" PASSWORD="" @@ -47,7 +46,7 @@ fi if [ "$WAN_IP4" = "$OLD_WAN_IP4" ]; then echo "IP4 Unchanged" else - echo $WAN_IP4 > $HOME/.wan_ip4-ydns.txt + echo $WAN_IP4 >$HOME/.wan_ip4-ydns.txt echo "Updating DNS to $WAN_IP4" curl -4 --basic -u "$USEREMAIL:$PASSWORD" --silent \ https://ydns.eu/api/v1/update/?host=$HOSTNAME @@ -57,7 +56,7 @@ fi if [ "$WAN_IP6" = "$OLD_WAN_IP6" ]; then echo "IP6 Unchanged" else - echo $WAN_IP6 > $HOME/.wan_ip6-ydns.txt + echo $WAN_IP6 >$HOME/.wan_ip6-ydns.txt echo "Updating DNS to $WAN_IP6" curl -6 --basic -u "$USEREMAIL:$PASSWORD" --silent \ https://ydns.eu/api/v1/update/?host=$HOSTNAME diff --git a/bash/deprecated/ydns6 b/bash/deprecated/ydns6 index e4fa739..32876b8 100755 --- a/bash/deprecated/ydns6 +++ b/bash/deprecated/ydns6 @@ -16,7 +16,6 @@ ## Copy-paste the following to your crontab without the # # */5 * * * * PATH_TO_HOME_DIRECTORY_HERE/.local/bin/ydns6 >/dev/null 2>&1 - # yDNS details USEREMAIL="" PASSWORD="" @@ -39,7 +38,7 @@ fi if [ "$WAN_IP6" = "$OLD_WAN_IP6" ]; then echo "IP6 Unchanged" else - echo $WAN_IP6 > $HOME/.ydns6.txt + echo $WAN_IP6 >$HOME/.ydns6.txt echo "Updating DNS to $WAN_IP6" curl -6 --basic -u "$USEREMAIL:$PASSWORD" --silent \ https://ydns.io/api/v1/update/?host=$HOSTNAME\&ip=$WAN_IP6 diff --git a/bash/download-forgejo.bash b/bash/download-forgejo.bash index b863e46..2c2cd72 100755 --- a/bash/download-forgejo.bash +++ b/bash/download-forgejo.bash @@ -3,8 +3,7 @@ VERSION=1.19.1-0 PLATFORM=linux-amd64 # If the signature is already downloaded, don't redownload it -if [ -f "forgejo-$VERSION-$PLATFORM.asc" ] -then +if [ -f "forgejo-$VERSION-$PLATFORM.asc" ]; then printf "Forĝejo signature already downloaded.\n" else printf "Downloading Forĝejo $VERSION-$PLATFORM signature…\n" @@ -12,8 +11,7 @@ else fi # If the binary is already downloaded, don't redownload it -if [ -f "forgejo-$VERSION-$PLATFORM" ] -then +if [ -f "forgejo-$VERSION-$PLATFORM" ]; then printf "Forĝejo already downloaded.\n" else printf "Downloading Forĝejo $VERSION on $PLATFORM…\n" diff --git a/bash/fixgrub.bash b/bash/fixgrub.bash index 322f219..ec76476 100755 --- a/bash/fixgrub.bash +++ b/bash/fixgrub.bash @@ -9,8 +9,7 @@ set -x # This script is Fedora specific for now. # There is no reason to run if dnf hasn't moved the proper config aside. -if [ -f /boot/efi/EFI/fedora/grub.cfg.rpmsave ] -then +if [ -f /boot/efi/EFI/fedora/grub.cfg.rpmsave ]; then rm -f /boot/efi/EFI/fedora/grub.cfg.rpmsave grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg fi diff --git a/bash/piratepartyfinland/qr-generator-wellBeingRegionElections2022.bash b/bash/piratepartyfinland/qr-generator-wellBeingRegionElections2022.bash index 1cffd3c..27669b6 100755 --- a/bash/piratepartyfinland/qr-generator-wellBeingRegionElections2022.bash +++ b/bash/piratepartyfinland/qr-generator-wellBeingRegionElections2022.bash @@ -11,7 +11,7 @@ cd $TARGETDIR echo "Creating to $TARGETDIR" # Function to generate QRs based on our URL scheme -function generateQr () { +function generateQr() { # $2 is first for the output as there are more regions than associations, # avoids overwriting # -H = 30 % damage allowing highest error correction diff --git a/bash/swaymirror.bash b/bash/swaymirror.bash index bf0abd9..794e3f6 100755 --- a/bash/swaymirror.bash +++ b/bash/swaymirror.bash @@ -7,7 +7,7 @@ set -x # -r mirrors cursor, eDP-1 is the internal display name on lumina to be mirrored -wayvnc ::1 -r -o eDP-1& +wayvnc ::1 -r -o eDP-1 & # So I won't forget it and think something broke notify-send "Remember to Mod-Shift-NUM to exit black screen" diff --git a/bash/transmission-export-magnets.bash b/bash/transmission-export-magnets.bash index 8707d3b..0965381 100755 --- a/bash/transmission-export-magnets.bash +++ b/bash/transmission-export-magnets.bash @@ -2,12 +2,11 @@ # Get the number of torrents, begins from 2 (1 is header line), the last # line is SUM. -TORRENTS=$(transmission-remote -l|wc -l) +TORRENTS=$(transmission-remote -l | wc -l) CURRENT=1 # until $CURRENT equals $TORRENTS ? -until [ $CURRENT -gt $TORRENTS ] - do +until [ $CURRENT -gt $TORRENTS ]; do # get the information for $CURRENT? Grep the magnet line and cut out the # frist field ("Magnet: ") using awk? transmission-remote -l -t $CURRENT -i | grep -i magnet | awk -F': ' '{print $2}' diff --git a/bash/usr-local-bin/brave b/bash/usr-local-bin/brave index b297e20..a5ebf6b 100755 --- a/bash/usr-local-bin/brave +++ b/bash/usr-local-bin/brave @@ -6,6 +6,6 @@ # OpenVPN: --proxy-server=socks5://10.8.0.1 set -x -/usr/bin/brave-browser-stable --enable-features=UseOzonePlatform,WaylandWindowDecorations,WebRTCPipeWireCapturerBraveVerticalTabs,EncryptedClientHello,UseDnsHttpsSvcbAlpn --ozone-platform-hint=auto $@ +/usr/bin/brave-browser-stable --enable-features=UseOzonePlatform,WaylandWindowDecorations,WebRTCPipeWireCapturerBraveVerticalTabs,EncryptedClientHello,UseDnsHttpsSvcbAlpn --ozone-platform-hint=auto $@ # --enable-features=,VaapiVideoDecoder,VaapiIgnoreDriverChecks,WebContentsForceDark --ignore-gpu-blocklist --enable-gpu-rasterization --enable-zero-copy --disable-gpu-driver-bug-workarounds --enable-native-gpu-memory-buffers set +x diff --git a/bash/usr-local-bin/firefox b/bash/usr-local-bin/firefox index 6042d4d..80df122 100755 --- a/bash/usr-local-bin/firefox +++ b/bash/usr-local-bin/firefox @@ -11,16 +11,13 @@ FlagsForFirefox="--ProfileManager $@" # Firefox (stable, beta) and signatures: https://releases.mozilla.org/pub/firefox/releases/ # Developer edition (and signatures): https://releases.mozilla.org/pub/devedition/releases/ -if [ -f ~/.local/firefox/firefox ] -then +if [ -f ~/.local/firefox/firefox ]; then ~/.local/firefox/firefox $FlagsForFirefox # Fallback to global wayland installation -elif [ -f /usr/bin/firefox-wayland ] -then +elif [ -f /usr/bin/firefox-wayland ]; then /usr/bin/firefox-wayland $FlagsForFirefox # Fallback to global installation -elif [ -f /usr/bin/firefox ] -then +elif [ -f /usr/bin/firefox ]; then /usr/bin/firefox $FlagsForFirefox # Fallback to flatpak, don't care if it doesn't exist else diff --git a/bash/usr-local-bin/fluffychat b/bash/usr-local-bin/fluffychat index 7ff9854..48998a7 100755 --- a/bash/usr-local-bin/fluffychat +++ b/bash/usr-local-bin/fluffychat @@ -5,11 +5,9 @@ # bad. set -x -if [ -f /snap/bin/fluffychat ] -then +if [ -f /snap/bin/fluffychat ]; then snap run fluffychat $@ -elif [ -f /var/lib/flatpak/exports/bin/im.fluffychat.Fluffychat ] -then +elif [ -f /var/lib/flatpak/exports/bin/im.fluffychat.Fluffychat ]; then flatpak run im.fluffychat.Fluffychat $@ else /usr/bin/fluffychat diff --git a/bash/usr-local-bin/go b/bash/usr-local-bin/go index 82574e0..8459ad1 100755 --- a/bash/usr-local-bin/go +++ b/bash/usr-local-bin/go @@ -5,8 +5,7 @@ set -x # Check if go is installed through snap -if [ -f /snap/bin/go ] -then +if [ -f /snap/bin/go ]; then snap run go $@ # Fallback to system installation diff --git a/bash/usr-local-bin/microsoft-edge b/bash/usr-local-bin/microsoft-edge index a8943f9..12af40b 100755 --- a/bash/usr-local-bin/microsoft-edge +++ b/bash/usr-local-bin/microsoft-edge @@ -6,6 +6,6 @@ # OpenVPN: --proxy-server=socks5://10.8.0.1 set -x -/usr/bin/microsoft-edge --enable-features=UseOzonePlatform,WaylandWindowDecorations,WebRTCPipeWireCapturers,EncryptedClientHello,UseDnsHttpsSvcbAlpn --ozone-platform-hint=auto $@ +/usr/bin/microsoft-edge --enable-features=UseOzonePlatform,WaylandWindowDecorations,WebRTCPipeWireCapturers,EncryptedClientHello,UseDnsHttpsSvcbAlpn --ozone-platform-hint=auto $@ # --enable-features=VaapiVideoDecoder,VaapiIgnoreDriverCheck -ignore-gpu-blocklist --enable-gpu-rasterization --enable-zero-copy --disable-gpu-driver-bug-workarounds --enable-native-gpu-memory-buffers set +x diff --git a/bash/usr-local-bin/thunderbird b/bash/usr-local-bin/thunderbird index de9202a..5f438be 100755 --- a/bash/usr-local-bin/thunderbird +++ b/bash/usr-local-bin/thunderbird @@ -10,16 +10,13 @@ export MOZ_ENABLE_WAYLAND=1 FlagsForThunderbird="--ProfileManager $@" # Thunderbird (stable, beta) and signatures: https://releases.mozilla.org/pub/thunderbird/releases/ -if [ -f ~/.local/thunderbird/thunderbird ] -then +if [ -f ~/.local/thunderbird/thunderbird ]; then ~/.local/thunderbird/thunderbird $FlagsForThunderbird # Fallback to global installation -elif [ -f /usr/bin/thunderbird-wayland ] -then +elif [ -f /usr/bin/thunderbird-wayland ]; then /usr/bin/thunderbird-wayland $FlagsForThunderbird # Fallback to global installation -elif [ -f /usr/bin/thunderbird ] -then +elif [ -f /usr/bin/thunderbird ]; then /usr/bin/thunderbird $FlagsForThunderbird # Fallback to flatpak, don't care if it doesn't exist else diff --git a/bash/usr-local-bin/vivaldi b/bash/usr-local-bin/vivaldi index 539a060..ee5d74f 100755 --- a/bash/usr-local-bin/vivaldi +++ b/bash/usr-local-bin/vivaldi @@ -1,4 +1,4 @@ #!/usr/bin/env bash set -x -/usr/bin/vivaldi --enable-features=UseOzonePlatform,WaylandWindowDecorations,WebRTCPipeWireCapturers,EncryptedClientHello,UseDnsHttpsSvcbAlpn --ozone-platform-hint=auto $@ +/usr/bin/vivaldi --enable-features=UseOzonePlatform,WaylandWindowDecorations,WebRTCPipeWireCapturers,EncryptedClientHello,UseDnsHttpsSvcbAlpn --ozone-platform-hint=auto $@ set +x diff --git a/bash/wifiqr.bash b/bash/wifiqr.bash index 1d884b6..f116137 100755 --- a/bash/wifiqr.bash +++ b/bash/wifiqr.bash @@ -13,7 +13,6 @@ qrencode -l H -s $PIXELSIZE -o $1.png "WIFI:T:WPA;S:$1;P:$2;;" # Might as well jpg this too convert "$1".png "$1".jpg - # Prints details echo "SSID: $1" echo "Passphrase: $2"