From 90c371e0795fd1c14da9d4bbbc5dfdbb928da23c Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 28 Dec 2021 17:05:59 +0100 Subject: [PATCH] Code cleanup --- installBrave.sh | 1 + installClipboardHistory.sh | 2 ++ installFish.sh | 14 +++++++++++--- installFlameshot.sh | 4 ++-- installGlobalScript.sh | 9 +++++---- installJava.sh | 4 ++-- installMultiMC.sh | 8 ++++---- installObsidian.sh | 3 +++ installOnlyoffice.sh | 2 ++ installParsec.sh | 2 ++ installSignal.sh | 2 +- installSpotify.sh | 11 ++++++++--- installSyncthing.sh | 3 ++- installgl4D.sh | 14 +++++++++----- ubuntuConfiguration.sh | 14 ++++++++------ 15 files changed, 62 insertions(+), 31 deletions(-) diff --git a/installBrave.sh b/installBrave.sh index 8c23710..57cc0b5 100644 --- a/installBrave.sh +++ b/installBrave.sh @@ -3,4 +3,5 @@ sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://b 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 sudo apt update sudo apt install brave-browser -y + echo -e "\nBrave installed! 🎉" diff --git a/installClipboardHistory.sh b/installClipboardHistory.sh index d989be1..e593765 100644 --- a/installClipboardHistory.sh +++ b/installClipboardHistory.sh @@ -1,5 +1,7 @@ sudo apt update sudo apt install gnome-shell-extension-gpaste gnome-shell-extension-prefs -y + +# Enable the extension gnome-extensions enable GPaste@gnome-shell-extensions.gnome.org echo -e "\nClipboard history is now available! 🎉" diff --git a/installFish.sh b/installFish.sh index 6e0b1a9..0402965 100644 --- a/installFish.sh +++ b/installFish.sh @@ -1,23 +1,32 @@ # Adds the official Fish repository sudo apt-add-repository ppa:fish-shell/release-3 -y + # Updates the list sudo apt update + # Install Fish, fzf (for the reverse search), bat (for the colored manuals), procps (for the SSH), curl (for downloading scripts) sudo apt install fish fzf bat procps curl -y echo -e "\nFish installed!" + # Fish default shell sudo chsh -s /usr/bin/fish $USER + # Removing motd fish -c 'set -U fish_greeting' + # Install ^R (reversed research) curl -sL https://git.io/fisher | fish -c 'source && fisher install jorgebucaran/fisher' 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/ + # 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/ + # 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/ + # Updating color scheme (based on Base16 Eighties) fish -c 'set -U fish_color_normal normal' fish -c 'set -U fish_color_command 99cc99' @@ -54,7 +63,7 @@ fish -c "abbr activate 'source bin/activate.fish'" fish -c "abbr vs 'code .'" fish -c "abbr untgz 'tar -xvzf'" fish -c "abbr - 'cd -'" -if grep "WSL" /proc/version > /dev/null; # Only for WSL +if grep "WSL" /proc/version > /dev/null; # only for WSL then fish -c "abbr bigupdate 'sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y && sudo do-release-upgrade'" fish -c "abbr d 'explorer.exe .'" @@ -64,8 +73,7 @@ else # if regular distro (i.e. Ubuntu) fish -c "abbr spotify 'LD_PRELOAD=/usr/local/lib/spotify-adblock.so spotify &> /dev/null & disown'" fi -# Removal of Ubuntu icon -if grep "Ubuntu" /proc/version > /dev/null; +if grep "Ubuntu" /proc/version > /dev/null; # only for Ubuntu then # We remove the Ubuntu desktop shortcut only if it already exists if [ -f /usr/share/applications/fish.desktop ] diff --git a/installFlameshot.sh b/installFlameshot.sh index 80cb023..c83c11f 100644 --- a/installFlameshot.sh +++ b/installFlameshot.sh @@ -14,10 +14,10 @@ echo "Old ImprEcran shortcut removed!" # Fetching customs keyboard shortcuts CUSTOM_KEYBINDINGS_LIST=$(gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings) -if [[ $CUSTOM_KEYBINDINGS_LIST == "@as []" ]] # Creating new list if not exists +if [[ $CUSTOM_KEYBINDINGS_LIST == "@as []" ]] # creating new list if not exists then CUSTOM_KEYBINDINGS_LIST="['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/flameshot-shortcut/']" -else # If already existing, adding our new element +else # if already existing, adding our new element CUSTOM_KEYBINDINGS_LIST="${CUSTOM_KEYBINDINGS_LIST::-1}, '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/flameshot-shortcut/']" fi diff --git a/installGlobalScript.sh b/installGlobalScript.sh index 6cb0787..0fe9db7 100644 --- a/installGlobalScript.sh +++ b/installGlobalScript.sh @@ -3,7 +3,7 @@ then # Update of APT sudo apt update - which git &> /dev/null || sudo apt install git -y # Install git if not already installed + which git &> /dev/null || sudo apt install git -y # install git if not already installed git clone -c http.sslverify=false https://git.kennel.ml/Anri/myLinuxConfiguration.git cd myLinuxConfiguration @@ -11,6 +11,7 @@ then # Upgrade and clean already installed packages sudo apt upgrade -y echo -e "\nUpgrading packages done! 🎉" + sudo apt autoremove -y echo -e "\nCleaning unnecessary packages done! 🎉" @@ -89,7 +90,7 @@ then # Install Signal bash installSignal.sh - # info + # Infos echo -e "\n\nTake care, you may need to install manually some others stuff, check the README (and the logs) of" echo "the project => https://git.kennel.ml/Anri/myLinuxConfiguration/src/branch/main/README.md" else # WSL @@ -110,14 +111,14 @@ then sudo apt autoremove --purge snapd -y echo -e "\nSnap daemon removed! 🎉" - # info + # Infos echo -e "\n\nTake care, by default the fish configuration is set for Ubuntu, you may need to uncomment" echo "some of the lines in $HOME/.config/fish/config.fish to enable custom network disks from Windows." echo -e "\nYou may need to update your distro to the latest version" echo "Check this tutorial : https://git.kennel.ml/Anri/cat/wiki/Tuto-installation-WSL#%C3%A9tape-3-mise-%C3%A0-jour-de-ubuntu" fi - # Supprime le repo + # Delete this repo cd .. rm -rf myLinuxConfiguration else diff --git a/installJava.sh b/installJava.sh index 3338629..8ec4ad9 100644 --- a/installJava.sh +++ b/installJava.sh @@ -7,7 +7,7 @@ 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 installed + 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' @@ -17,6 +17,6 @@ echo -e "\nSDKMAN (Java install manager) installed!" # Install Temurin build according with https://whichjdk.com/#adoptium-eclipse-temurin sdk install java 17.0.1-tem -# upgrade to latest java version in case the version above isn't +# Upgrade to latest java version in case the version above isn't sdk upgrade echo -e "\nJava (Temurin) installed! 🎉" diff --git a/installMultiMC.sh b/installMultiMC.sh index 6e7bfd7..77f1f54 100644 --- a/installMultiMC.sh +++ b/installMultiMC.sh @@ -1,10 +1,10 @@ -# On récupère le lien vers la dernière version de MultiMC +# Fetching a link to get the latest version of MultiMC echo "Retrieve the last package..." -latest=$(wget -qO- https://multimc.org/ | grep "Debian/Ubuntu") # récupération depuis le site +latest=$(wget -qO- https://multimc.org/ | grep "Debian/Ubuntu") # retrieving for the official website pat='href="(.*)" ' # regex -[[ $latest =~ $pat ]] # utilisation du regex +[[ $latest =~ $pat ]] # Use of REGEX -# On télécharge le paquet +# Download the latest package wget -q --show-progress -i ${BASH_REMATCH[1]} -O MultiMC.deb sudo apt install ./MultiMC.deb -y diff --git a/installObsidian.sh b/installObsidian.sh index fb60db9..eaa0137 100644 --- a/installObsidian.sh +++ b/installObsidian.sh @@ -3,11 +3,14 @@ wget -q https://api.github.com/repos/obsidianmd/obsidian-releases/releases/lates echo "Retrieve the last package..." grep 'browser_download_url": ".*.snap"' latest | awk '{ print substr ($0, 32 ) }' | awk '{ print substr( $0, 1, length($0)-1 ) }' > url rm latest + # Downloading package wget -q --show-progress -i url -O obsidian.snap rm url + # Installing sudo snap install --dangerous obsidian.snap + # Removing package rm obsidian.snap diff --git a/installOnlyoffice.sh b/installOnlyoffice.sh index 7fbfb30..8be4094 100644 --- a/installOnlyoffice.sh +++ b/installOnlyoffice.sh @@ -1,7 +1,9 @@ # Download package wget -q --show-progress https://download.onlyoffice.com/install/desktop/editors/linux/onlyoffice-desktopeditors_amd64.deb -O onlyoffice.deb + # Installing OnlyOffice sudo apt install ./onlyoffice.deb -y + # Removing package rm onlyoffice.deb diff --git a/installParsec.sh b/installParsec.sh index a126cde..41241f4 100644 --- a/installParsec.sh +++ b/installParsec.sh @@ -1,7 +1,9 @@ # Downloading package wget -q --show-progress https://builds.parsec.app/package/parsec-linux.deb -O parsec.deb + # Installing Parsec sudo apt install ./parsec.deb -y + # Removing package rm parsec.deb diff --git a/installSignal.sh b/installSignal.sh index 1fdb86b..0e9dcaf 100644 --- a/installSignal.sh +++ b/installSignal.sh @@ -2,7 +2,7 @@ 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 -# Remove the gpg key +# Remove the GPG key rm signal-desktop-keyring.gpg # Add the repository to the list diff --git a/installSpotify.sh b/installSpotify.sh index 426b8c1..d34379f 100644 --- a/installSpotify.sh +++ b/installSpotify.sh @@ -1,8 +1,9 @@ # 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 + # We install the version from the official website -which curl &> /dev/null || sudo apt update && sudo apt install curl -y # Install curl if not already installed +which curl &> /dev/null || sudo apt update && sudo apt install curl -y # install curl if not already installed echo "deb [trusted=yes] http://repository.spotify.com stable non-free" | sudo tee /etc/apt/sources.list.d/spotify.list sudo apt update sudo apt install spotify-client -y @@ -10,17 +11,21 @@ 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 || curl https://sh.rustup.rs -sSf | ( sh -s -- -y; source $HOME/.cargo/env ) # Install rust if not already installed +which rustc &> /dev/null || curl https://sh.rustup.rs -sSf | ( sh -s -- -y; 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 make + # Install the patch sudo make install + # Removing sourcecode folder cd .. rm -rf spotify-adblock -# We replace the Ubuntu desktop shortcut + +# We replace the Ubuntu desktop shortcut if needed if [ -f /usr/share/applications/spotify.desktop ] ; then sudo sed -i "7s#.*#Exec=env LD_PRELOAD=/usr/local/lib/spotify-adblock.so spotify %U#" /usr/share/applications/spotify.desktop fi diff --git a/installSyncthing.sh b/installSyncthing.sh index 4c4af28..7e91338 100644 --- a/installSyncthing.sh +++ b/installSyncthing.sh @@ -1,7 +1,8 @@ # 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 +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 echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list + # Install Syncthing sudo apt update sudo apt install syncthing -y diff --git a/installgl4D.sh b/installgl4D.sh index 332f2bc..d77d9e0 100644 --- a/installgl4D.sh +++ b/installgl4D.sh @@ -1,24 +1,28 @@ # Installing depedencies sudo apt update sudo apt install libsdl2-dev git pkg-config automake make autoconf libtool -y + # Downloading and building GL4D git clone https://github.com/noalien/GL4Dummies.git cd GL4Dummies make -f Makefile.autotools ./configure make + # Installing GL4D sudo make install + # Removing sourcecode cd .. rm -rf GL4Dummies + # Fix for shared libraries (https://stackoverflow.com/a/9395355) sudo ldconfig -# changing env variables path and ld_library_path -# to correct locations to all the shell installed +# Changing env variables path and ld_library_path +# To correct locations to all the shell installed -# to .bashrc if exists +# To .bashrc if exists if [ -f $HOME/.bashrc ] ; then echo "" >> $HOME/.bashrc echo "# GL4Dummies" >> $HOME/.bashrc @@ -27,7 +31,7 @@ if [ -f $HOME/.bashrc ] ; then echo "" >> $HOME/.bashrc fi -# to .zshrc if exists +# To .zshrc if exists if [ -f $HOME/.zshrc ] ; then echo "" >> $HOME/.zshrc echo "# GL4Dummies" >> $HOME/.zshrc @@ -36,7 +40,7 @@ if [ -f $HOME/.zshrc ] ; then echo "" >> $HOME/.zshrc fi -# if config.fish exists +# 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 diff --git a/ubuntuConfiguration.sh b/ubuntuConfiguration.sh index 7be8b7e..f2e6ec9 100644 --- a/ubuntuConfiguration.sh +++ b/ubuntuConfiguration.sh @@ -1,17 +1,19 @@ # Nautilus # Fetching customs keyboard shortcuts CUSTOM_KEYBINDINGS_LIST=$(gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings) -if [[ $CUSTOM_KEYBINDINGS_LIST == "@as []" ]] # Creating new list if not exists +if [[ $CUSTOM_KEYBINDINGS_LIST == "@as []" ]] # creating new list if not exists then CUSTOM_KEYBINDINGS_LIST="['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/nautilus-shortcut/']" -else # If already existing, adding our new element +else # if already existing, adding our new element CUSTOM_KEYBINDINGS_LIST="${CUSTOM_KEYBINDINGS_LIST::-1}, '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/nautilus-shortcut/']" fi -gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "$CUSTOM_KEYBINDINGS_LIST" # Updating the list +gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "$CUSTOM_KEYBINDINGS_LIST" # updating the list + # Naming it -gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/nautilus-shortcut/ name 'Nautilus' # Set name -gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/nautilus-shortcut/ command 'nautilus -w' # Set command -gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/nautilus-shortcut/ binding 'E' # Set shortcut +gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/nautilus-shortcut/ name 'Nautilus' # set name +gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/nautilus-shortcut/ command 'nautilus -w' # set command +gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/nautilus-shortcut/ binding 'E' # set shortcut + echo -e "\nNautilus shortcut added (Super+E)!" # Desktop modifications