From 2467aa753070ad5aeeca613aff5d95f5ce3e139a Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 15 Feb 2022 09:26:55 +0100 Subject: [PATCH] shellcheck verification --- -installBrave.sh | 2 ++ installClipboardHistory.sh | 2 ++ installEmojiPicker.sh | 8 +++++--- installFish.sh | 10 ++++++---- installFlameshot.sh | 6 ++++-- installGitLFS.sh | 2 ++ installGlobalScript.sh | 4 +++- installJava.sh | 6 ++++-- installKolourPaint.sh | 2 ++ installLatex.sh | 4 +++- installMultiMC.sh | 4 +++- installOBS.sh | 2 ++ installObsidian.sh | 2 ++ installParsec.sh | 2 ++ installRust.sh | 6 ++++-- installSignal.sh | 2 ++ installSpotify.sh | 6 ++++-- installSyncthing.sh | 6 ++++-- installTLDR.sh | 6 ++++-- installgl4D.sh | 40 ++++++++++++++++++++------------------ removeBannerSpotify.sh | 4 +++- ubuntuConfiguration.sh | 8 +++++--- update.sh | 2 ++ 23 files changed, 91 insertions(+), 45 deletions(-) diff --git a/-installBrave.sh b/-installBrave.sh index 1adfe20..12b538e 100644 --- a/-installBrave.sh +++ b/-installBrave.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + sudo apt install apt-transport-https curl -y sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main" | sudo tee /etc/apt/sources.list.d/brave-browser-release.list diff --git a/installClipboardHistory.sh b/installClipboardHistory.sh index e593765..90c945d 100644 --- a/installClipboardHistory.sh +++ b/installClipboardHistory.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + sudo apt update sudo apt install gnome-shell-extension-gpaste gnome-shell-extension-prefs -y diff --git a/installEmojiPicker.sh b/installEmojiPicker.sh index 4346a03..ceef32e 100644 --- a/installEmojiPicker.sh +++ b/installEmojiPicker.sh @@ -1,8 +1,10 @@ +#!/usr/bin/env bash + # Fetch installation script wget -q https://raw.githubusercontent.com/GaZaTu/x11-emoji-picker/master/install.sh -O /tmp/install_EP.sh # Remove the great emoji after the installation -sed -i 's/echo "$PROJECT_NAME installed! 🎉"/echo "$PROJECT_NAME installed!"/' /tmp/install_EP.sh +sed -i "s/echo \"$PROJECT_NAME installed! 🎉\"/echo \"$PROJECT_NAME installed!\"/" /tmp/install_EP.sh # Installation yes | bash /tmp/install_EP.sh @@ -15,7 +17,7 @@ then fi # Use custom configuration -rm $HOME/.config/gazatu.xyz/emoji-picker.ini 2>/dev/null -wget -q --show-progress https://git.kennel.ml/Anri/myLinuxConfiguration/raw/branch/main/.config/gazatu.xyz/emoji-picker.ini -P $HOME/.config/gazatu.xyz/ +rm "$HOME"/.config/gazatu.xyz/emoji-picker.ini 2>/dev/null +wget -q --show-progress https://git.kennel.ml/Anri/myLinuxConfiguration/raw/branch/main/.config/gazatu.xyz/emoji-picker.ini -P "$HOME"/.config/gazatu.xyz/ echo -e "\nEmoji Picker configured! 🎉" diff --git a/installFish.sh b/installFish.sh index 5d02515..b6cd2ac 100644 --- a/installFish.sh +++ b/installFish.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # Adds the official Fish repository sudo apt-add-repository ppa:fish-shell/release-3 -y @@ -9,7 +11,7 @@ sudo apt install fish fzf bat procps curl exa -y echo -e "\nFish installed!" # Fish default shell -sudo chsh -s /usr/bin/fish $USER +sudo chsh -s /usr/bin/fish "$USER" # Removing motd fish -c 'set -U fish_greeting' @@ -19,13 +21,13 @@ curl -sL https://git.io/fisher | fish -c 'source && fisher install jorgebucaran/ fish -c 'fisher install jethrokuan/fzf' # Install SSH -rm $HOME/.config/fish/functions/fish_ssh_agent.fish 2>/dev/null; wget https://gitlab.com/kyb/fish_ssh_agent/raw/master/functions/fish_ssh_agent.fish -P $HOME/.config/fish/functions/ +rm "$HOME"/.config/fish/functions/fish_ssh_agent.fish 2>/dev/null; wget https://gitlab.com/kyb/fish_ssh_agent/raw/master/functions/fish_ssh_agent.fish -P "$HOME"/.config/fish/functions/ # Update the fish config with mine (edit that once installed for you) -rm $HOME/.config/fish/config.fish 2>/dev/null; wget https://git.kennel.ml/Anri/myLinuxConfiguration/raw/branch/main/.config/fish/config.fish -P $HOME/.config/fish/ +rm "$HOME"/.config/fish/config.fish 2>/dev/null; wget https://git.kennel.ml/Anri/myLinuxConfiguration/raw/branch/main/.config/fish/config.fish -P "$HOME"/.config/fish/ # Update the prompt with mine -rm $HOME/.config/fish/functions/fish_prompt.fish 2>/dev/null; wget https://git.kennel.ml/Anri/myLinuxConfiguration/raw/branch/main/.config/fish/functions/fish_prompt.fish -P $HOME/.config/fish/functions/ +rm "$HOME"/.config/fish/functions/fish_prompt.fish 2>/dev/null; wget https://git.kennel.ml/Anri/myLinuxConfiguration/raw/branch/main/.config/fish/functions/fish_prompt.fish -P "$HOME"/.config/fish/functions/ # Updating color scheme (based on Base16 Eighties) fish -c 'set -U fish_color_normal normal' diff --git a/installFlameshot.sh b/installFlameshot.sh index c83c11f..71ba93c 100644 --- a/installFlameshot.sh +++ b/installFlameshot.sh @@ -1,11 +1,13 @@ +#!/usr/bin/env bash + # Install flameshot sudo apt update sudo apt install flameshot -y echo -e "\nFlameshot installed!" # Apply custom configuration -rm $HOME/.config/flameshot/flameshot.ini 2>/dev/null -wget -q --show-progress https://git.kennel.ml/Anri/myLinuxConfiguration/raw/branch/main/.config/flameshot/flameshot.ini -P $HOME/.config/flameshot/ +rm "$HOME"/.config/flameshot/flameshot.ini 2>/dev/null +wget -q --show-progress https://git.kennel.ml/Anri/myLinuxConfiguration/raw/branch/main/.config/flameshot/flameshot.ini -P "$HOME"/.config/flameshot/ # Remove old shortcut assign with the Print key gsettings set org.gnome.settings-daemon.plugins.media-keys screenshot "[]" diff --git a/installGitLFS.sh b/installGitLFS.sh index 00f35dc..58b6c4b 100644 --- a/installGitLFS.sh +++ b/installGitLFS.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # Latest version # No available version for latest Ubuntu version # curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash diff --git a/installGlobalScript.sh b/installGlobalScript.sh index 29d0eba..52b99c9 100644 --- a/installGlobalScript.sh +++ b/installGlobalScript.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + if grep "Ubuntu" /proc/version > /dev/null || grep "WSL" /proc/version > /dev/null; then # Update of APT @@ -7,7 +9,7 @@ then which curl &> /dev/null || sudo apt install apt-transport-https curl -y # install curl (along with apt-transport-https) if not already installed git clone -c http.sslverify=false https://git.kennel.ml/Anri/myLinuxConfiguration.git - cd myLinuxConfiguration + cd myLinuxConfiguration || exit # Upgrade and clean already installed packages sudo apt upgrade -y diff --git a/installJava.sh b/installJava.sh index 8ec4ad9..e86ec02 100644 --- a/installJava.sh +++ b/installJava.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # Install SDKMAN # Install dependencies sudo apt update @@ -6,8 +8,8 @@ curl -s "https://get.sdkman.io" | bash source "$HOME/.sdkman/bin/sdkman-init.sh" # Adding Fish support if fish is installed -if [ -x $HOME/.config/fish ] ; then - if [ ! -f $HOME/.config/fish/functions/fisher.fish ] ; then # install fisher if not already installed +if [ -x "$HOME"/.config/fish ] ; then + if [ ! -f "$HOME"/.config/fish/functions/fisher.fish ] ; then # install fisher if not already installed curl -sL https://git.io/fisher | fish -c 'source && fisher install jorgebucaran/fisher' fi fish -c 'fisher install reitzig/sdkman-for-fish' diff --git a/installKolourPaint.sh b/installKolourPaint.sh index bbed013..52dd317 100644 --- a/installKolourPaint.sh +++ b/installKolourPaint.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # Install sudo snap install kolourpaint diff --git a/installLatex.sh b/installLatex.sh index 764936c..c12c7bc 100644 --- a/installLatex.sh +++ b/installLatex.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # Install Latex sudo apt update sudo apt install texlive-full python3-pygments -y @@ -11,7 +13,7 @@ then apps=("display-im6.q16" "prerex" "vprerex" "texdoctk" "info") # We remove the Ubuntu desktop shortcut only if it already exists - for app in ${apps[@]} + for app in "${apps[@]}" do if [ -f $pathicons/$app.desktop ] then diff --git a/installMultiMC.sh b/installMultiMC.sh index 77f1f54..95d9dff 100644 --- a/installMultiMC.sh +++ b/installMultiMC.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # Fetching a link to get the latest version of MultiMC echo "Retrieve the last package..." latest=$(wget -qO- https://multimc.org/ | grep "Debian/Ubuntu") # retrieving for the official website @@ -5,7 +7,7 @@ pat='href="(.*)" ' # regex [[ $latest =~ $pat ]] # Use of REGEX # Download the latest package -wget -q --show-progress -i ${BASH_REMATCH[1]} -O MultiMC.deb +wget -q --show-progress -i "${BASH_REMATCH[1]}" -O MultiMC.deb sudo apt install ./MultiMC.deb -y rm MultiMC.deb diff --git a/installOBS.sh b/installOBS.sh index 4f73bd6..912c4bc 100644 --- a/installOBS.sh +++ b/installOBS.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # Add repo sudo add-apt-repository ppa:obsproject/obs-studio -y diff --git a/installObsidian.sh b/installObsidian.sh index aa63235..0063c51 100644 --- a/installObsidian.sh +++ b/installObsidian.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # Fetching last Obsidian version wget -q https://api.github.com/repos/obsidianmd/obsidian-releases/releases/latest echo "Retrieve the last package..." diff --git a/installParsec.sh b/installParsec.sh index 5c157ad..c53397c 100644 --- a/installParsec.sh +++ b/installParsec.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # Downloading package wget -q --show-progress https://builds.parsec.app/package/parsec-linux.deb -O parsec.deb diff --git a/installRust.sh b/installRust.sh index 72555eb..9caabce 100644 --- a/installRust.sh +++ b/installRust.sh @@ -1,13 +1,15 @@ +#!/usr/bin/env bash + which curl &> /dev/null || ( sudo apt update; sudo apt install curl -y ) # Install curl if not already installed # Install rust curl https://sh.rustup.rs -sSf | sh -s -- -y # Configure current session -source $HOME/.cargo/env +source "$HOME"/.cargo/env # If fish is used, adding cargo to path -if [ -x $HOME/.config/fish ] ; then +if [ -x "$HOME"/.config/fish ] ; then fish -c 'set -Up fish_user_paths ~/.cargo/bin' fi diff --git a/installSignal.sh b/installSignal.sh index 5630d95..99f18cf 100644 --- a/installSignal.sh +++ b/installSignal.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # Add the public software signing key wget -O- -q --show-progress https://updates.signal.org/desktop/apt/keys.asc | gpg --dearmor > signal-desktop-keyring.gpg cat signal-desktop-keyring.gpg | sudo tee -a /usr/share/keyrings/signal-desktop-keyring.gpg > /dev/null diff --git a/installSpotify.sh b/installSpotify.sh index 28cece5..e18382e 100644 --- a/installSpotify.sh +++ b/installSpotify.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # We make sure that Snap and flatpak versions are uninstalled sudo snap remove spotify 2> /dev/null sudo flatpak uninstall com.spotify.Client 2> /dev/null @@ -11,11 +13,11 @@ echo -e "\nSpotify installed!" # We install the prerequisites to build and install the patch (Git and Rust will be installed and not removed) sudo apt install git make build-essential -y -which rustc &> /dev/null || wget -q --show-progress https://git.kennel.ml/Anri/myLinuxConfiguration/raw/branch/main/installRust.sh -O - | ( bash; source $HOME/.cargo/env ) # install rust if not already installed +which rustc &> /dev/null || wget -q --show-progress https://git.kennel.ml/Anri/myLinuxConfiguration/raw/branch/main/installRust.sh -O - | ( bash; source "$HOME"/.cargo/env ) # install rust if not already installed # Download and build the patch git clone https://github.com/abba23/spotify-adblock.git -cd spotify-adblock +cd spotify-adblock || exit make # Install the patch diff --git a/installSyncthing.sh b/installSyncthing.sh index 7e91338..493b033 100644 --- a/installSyncthing.sh +++ b/installSyncthing.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # We add the official deposit of Syncthing which curl &> /dev/null || sudo apt update && sudo apt install curl -y # install curl if not already installed sudo curl -s -o /usr/share/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg @@ -9,8 +11,8 @@ sudo apt install syncthing -y echo -e "\nSyncthing installed!" # Launch it at startup -sudo systemctl enable syncthing@$USER.service -sudo systemctl start syncthing@$USER.service +sudo systemctl enable syncthing@"$USER".service +sudo systemctl start syncthing@"$USER".service # We remove the Ubuntu desktop shortcut only if it already exists if [ -f /usr/share/applications/syncthing-start.desktop ] diff --git a/installTLDR.sh b/installTLDR.sh index 4856ebb..81728a0 100644 --- a/installTLDR.sh +++ b/installTLDR.sh @@ -1,5 +1,7 @@ +#!/usr/bin/env bash + # Install Rust if not already installed -which rustc &> /dev/null || wget -q --show-progress https://git.kennel.ml/Anri/myLinuxConfiguration/raw/branch/main/installRust.sh -O - | ( bash; source $HOME/.cargo/env ) +which rustc &> /dev/null || wget -q --show-progress https://git.kennel.ml/Anri/myLinuxConfiguration/raw/branch/main/installRust.sh -O - | ( bash; source "$HOME"/.cargo/env ) # Install tldr cargo install tealdeer @@ -11,7 +13,7 @@ tldr --update # Download the file from the latest release... latest=$(wget -qO- https://api.github.com/repos/dbrgn/tealdeer/releases/latest) url=$(grep 'browser_download_url": ".*/completions_fish"' <<< "$latest" | awk '{ print substr ($0, 32 ) }' | awk '{ print substr( $0, 1, length($0)-1 ) }') -wget -q --show-progress $url -O completions_fish +wget -q --show-progress "$url" -O completions_fish # Move it to his correct location mv completions_fish ~/.config/fish/completions/tldr.fish diff --git a/installgl4D.sh b/installgl4D.sh index 7778ec4..de1aefa 100644 --- a/installgl4D.sh +++ b/installgl4D.sh @@ -1,10 +1,12 @@ +#!/usr/bin/env bash + # Installing depedencies sudo apt update sudo apt install libsdl2-dev libsdl2-image-dev git pkg-config automake make autoconf libtool -y # Downloading and building GL4D git clone https://github.com/noalien/GL4Dummies.git -cd GL4Dummies +cd GL4Dummies || exit make -f Makefile.autotools ./configure make @@ -23,30 +25,30 @@ sudo ldconfig # To correct locations to all the shell installed # To .bashrc if exists -if [ -f $HOME/.bashrc ] ; then - echo "" >> $HOME/.bashrc - echo "# GL4Dummies" >> $HOME/.bashrc - echo "export PATH=\$PATH:\$HOME/local/bin" >> $HOME/.bashrc - echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$HOME/local/lib" >> $HOME/.bashrc - echo "" >> $HOME/.bashrc +if [ -f "$HOME"/.bashrc ] ; then + echo "" >> "$HOME"/.bashrc + echo "# GL4Dummies" >> "$HOME"/.bashrc + echo "export PATH=\$PATH:\$HOME/local/bin" >> "$HOME"/.bashrc + echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$HOME/local/lib" >> "$HOME"/.bashrc + echo "" >> "$HOME"/.bashrc fi # To .zshrc if exists -if [ -f $HOME/.zshrc ] ; then - echo "" >> $HOME/.zshrc - echo "# GL4Dummies" >> $HOME/.zshrc - echo "export PATH=\$PATH:\$HOME/local/bin" >> $HOME/.zshrc - echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$HOME/local/lib" >> $HOME/.zshrc - echo "" >> $HOME/.zshrc +if [ -f "$HOME"/.zshrc ] ; then + echo "" >> "$HOME"/.zshrc + echo "# GL4Dummies" >> "$HOME"/.zshrc + echo "export PATH=\$PATH:\$HOME/local/bin" >> "$HOME"/.zshrc + echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$HOME/local/lib" >> "$HOME"/.zshrc + echo "" >> "$HOME"/.zshrc fi # If config.fish exists -if [ -f $HOME/.config/fish/config.fish ] ; then - echo "" >> $HOME/.config/fish/config.fish - echo "# GL4Dummies" >> $HOME/.config/fish/config.fish - echo "set -gx PATH \$HOME/local/bin \$PATH" >> $HOME/.config/fish/config.fish - echo "set -gx LD_LIBRARY_PATH \$HOME/local/lib $LD_LIBRARY_PATH" >> $HOME/.config/fish/config.fish - echo "" >> $HOME/.config/fish/config.fish +if [ -f "$HOME"/.config/fish/config.fish ] ; then + echo "" >> "$HOME"/.config/fish/config.fish + echo "# GL4Dummies" >> "$HOME"/.config/fish/config.fish + echo "set -gx PATH \$HOME/local/bin \$PATH" >> "$HOME"/.config/fish/config.fish + echo "set -gx LD_LIBRARY_PATH \$HOME/local/lib $LD_LIBRARY_PATH" >> "$HOME"/.config/fish/config.fish + echo "" >> "$HOME"/.config/fish/config.fish fi echo -e "\nGL4D library installed! 🎉" diff --git a/removeBannerSpotify.sh b/removeBannerSpotify.sh index 467c18a..fded407 100644 --- a/removeBannerSpotify.sh +++ b/removeBannerSpotify.sh @@ -1,4 +1,6 @@ -cd $(dirname $(realpath -L $(which spotify)))/Apps/ # absolute path to Spotify +#!/usr/bin/env bash + +cd "$(dirname "$(realpath -L "$(which spotify)")")"/Apps/ || exit # absolute path to Spotify sudo cp xpui.spa xpui.spa_bak # create a backup, in case of trouble sudo bash -c "unzip -p xpui.spa xpui.js | sed 's/{adsEnabled:\!0}/{adsEnabled:false}/' > xpui.js" diff --git a/ubuntuConfiguration.sh b/ubuntuConfiguration.sh index 283c357..528e601 100644 --- a/ubuntuConfiguration.sh +++ b/ubuntuConfiguration.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # Nautilus # Fetching customs keyboard shortcuts CUSTOM_KEYBINDINGS_LIST=$(gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings) @@ -48,11 +50,11 @@ pathicons='/usr/share/applications' apps=("debian-xterm" "debian-uxterm" "software-properties-drivers" "software-properties-livepatch") # We remove the Ubuntu desktop shortcut only if it already exists -for app in ${apps[@]} +for app in "${apps[@]}" do - if [ -f $pathicons/$app.desktop ] + if [ -f $pathicons/"$app".desktop ] then - sudo mv $pathicons/$app.desktop $pathicons/$app.desktop.bak + sudo mv $pathicons/"$app".desktop $pathicons/"$app".desktop.bak echo "$app's icon removed!" fi done diff --git a/update.sh b/update.sh index ba8b35a..32a5434 100644 --- a/update.sh +++ b/update.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + if grep "Ubuntu" /proc/version > /dev/null || grep "WSL" /proc/version > /dev/null; then # Update Java