From 28628b5acee8b6611953795e80200f7bd1f883f7 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Tue, 1 Oct 2019 07:55:33 +0200 Subject: [PATCH] Optimized code quality --- README.md | 2 +- scripts/import-data-from-system.sh | 6 +++--- scripts/lock.sh | 2 +- scripts/system-setup.sh | 6 ++++-- scripts/unlock.sh | 4 ++-- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index fd83a82..b4b19fe 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Core System -[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](./LICENSE.txt) +[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](./LICENSE.txt) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/6e66409513d7451b949afbf0373ba71f)](https://www.codacy.com/manual/KevinFrantz/core-system?utm_source=github.com&utm_medium=referral&utm_content=KevinFrantz/core-system&utm_campaign=Badge_Grade) This repository contains scripts to set up an working client system, maintain it and to save the data on an USB stick. It's adapted to the needs of Kevin Veen-Birkenbach aka. Frantz. diff --git a/scripts/import-data-from-system.sh b/scripts/import-data-from-system.sh index bba8e2f..4b4e808 100644 --- a/scripts/import-data-from-system.sh +++ b/scripts/import-data-from-system.sh @@ -3,7 +3,7 @@ # @author Kevin Veen-Birkenbach [aka. Frantz] # @param $1 If the first parameter is "reverse" the data will be exported to the system DATA_FOLDER=$(readlink -f "$(dirname "$(readlink -f "${0}")")/../data"); -if [ -z $(mount | grep $DATA_FOLDER) ] +if [ -z "$(mount | grep $DATA_FOLDER)" ] then echo "The data folder $DATA_FOLDER is locked. You need to unlock it!" bash "$(dirname "$(readlink -f "${0}")")/unlock.sh" || exit 1; @@ -26,9 +26,9 @@ do then echo "The destination file allready exists!"; echo "Difference:" - diff $destination $source + diff "$destination" "$source" fi - destination_dir=$(dirname $destination) + destination_dir=$(dirname "$destination") mkdir -p "$destination_dir" if [ -f "$source" ] then diff --git a/scripts/lock.sh b/scripts/lock.sh index 270035b..a3f2001 100644 --- a/scripts/lock.sh +++ b/scripts/lock.sh @@ -3,4 +3,4 @@ # @author Kevin Veen-Birkenbach [aka. Frantz] DECRYPTED=$(readlink -f "$(dirname "$(readlink -f "${0}")")/../data"); echo "Locking directory $DECRYPTED..." -fusermount -u $DECRYPTED && echo "Data is now encrypted." && echo "Removing directory $DECRYPTED..." && rmdir $DECRYPTED +fusermount -u "$DECRYPTED" && echo "Data is now encrypted." && echo "Removing directory $DECRYPTED..." && rmdir "$DECRYPTED" diff --git a/scripts/system-setup.sh b/scripts/system-setup.sh index eefb68c..31f328b 100644 --- a/scripts/system-setup.sh +++ b/scripts/system-setup.sh @@ -22,7 +22,7 @@ fi echo "Synchronizing gui tools..." sudo pacman --needed -S gnome-shell-extensions echo "Install NASA picture of the day GNOME extension..." -git clone https://github.com/Elinvention/gnome-shell-extension-nasa-apod.git $HOME/.local/share/gnome-shell/extensions/nasa_apod@elinvention.ovh +git clone https://github.com/Elinvention/gnome-shell-extension-nasa-apod.git "$HOME/.local/share/gnome-shell/extensions/nasa_apod@elinvention.ovh" gnome-shell-extension-tool -e nasa_apod@elinvention.ovh echo "Synchronizing web tools..." sudo pacman --needed -S chromium firefox firefox-ublock-origin firefox-extension-https-everywhere firefox-dark-reader firefox-noscript @@ -31,6 +31,8 @@ sudo pacman --needed -S gimp echo "Synchronizing communication tools..." yay pacman --needed -S slack-desktop skypeforlinux-stable-bin echo "Synchronizing development tools..." +echo "Synchronizing code quality tools..." +sudo pacman --needed -S shellcheck echo "Synchronizing visualization tools..." sudo pacman --needed -S dia echo "Synchronizing IDE's..." @@ -62,7 +64,7 @@ sudo pacman --needed -S docker echo "Synchronizing orchestration tools..." sudo pacman --needed -S ansible echo "Add current user($USER) to user group docker..." -sudo usermod -a -G docker $USER +sudo usermod -a -G docker "$USER" echo "Enable docker service..." sudo systemctl enable docker --now echo "Synchronizing games..." diff --git a/scripts/unlock.sh b/scripts/unlock.sh index 7f7d186..028468d 100644 --- a/scripts/unlock.sh +++ b/scripts/unlock.sh @@ -5,6 +5,6 @@ ENCRYPTED=$(readlink -f "$(dirname "$(readlink -f "${0}")")/../.encrypted"); DECRYPTED=$(readlink -f "$(dirname "$(readlink -f "${0}")")/../data"); echo "Unlocking directory $DECRYPTED..." echo "Creating directory $DECRYPTED..." -mkdir $DECRYPTED +mkdir "$DECRYPTED" echo "Encrypting directory $DECRYPTED to $DECRYPTED..." -encfs $ENCRYPTED $DECRYPTED && echo "ATTENTION: DATA IS NOW DECRYPTED!" +encfs "$ENCRYPTED" "$DECRYPTED" && echo "ATTENTION: DATA IS NOW DECRYPTED!"