From 6096238e93bf00f1eef2009d178581e43295ba90 Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Sat, 2 May 2020 14:02:15 +0200 Subject: [PATCH] Optimized package syncronisation --- configuration/packages/client.txt | 28 ++++++++++++++++++++++++++++ configuration/packages/general.txt | 4 ++++ scripts/base.sh | 13 +++++++++++-- scripts/client/setup.sh | 17 ++++------------- 4 files changed, 47 insertions(+), 15 deletions(-) create mode 100644 configuration/packages/client.txt create mode 100644 configuration/packages/general.txt diff --git a/configuration/packages/client.txt b/configuration/packages/client.txt new file mode 100644 index 0000000..1049d81 --- /dev/null +++ b/configuration/packages/client.txt @@ -0,0 +1,28 @@ +# programing language interpreters +jdk11-openjdk +python +php + +# description language interpreters +texlive-most + +# compression tools" +p7zip + +# administration tools +git +base-devel +yay +make +gcc +cmake + +# network analyze tools +traceroute +wireshark-qt +wireshark-cli + +# security tools +ecryptfs-utils +encfs +keepassxc diff --git a/configuration/packages/general.txt b/configuration/packages/general.txt new file mode 100644 index 0000000..39b92ac --- /dev/null +++ b/configuration/packages/general.txt @@ -0,0 +1,4 @@ +# This packages will be used in all setup scripts +nano +tree +htop diff --git a/scripts/base.sh b/scripts/base.sh index 734a4b4..27c9ac9 100644 --- a/scripts/base.sh +++ b/scripts/base.sh @@ -5,10 +5,11 @@ # # shellcheck disable=SC2034 #Deactivate checking of unused variables -REPOSITORY_PATH=$(readlink -f "$(dirname "$(readlink -f "${0}")")/../") +REPOSITORY_PATH=$(readlink -f "$(dirname "$(readlink -f "${0}")")/../../") # Propably this can be optimized +PACKAGE_PATH="$REPOSITORY_PATH/configuration/packages/" ENCRYPTED_PATH="$REPOSITORY_PATH/.encrypted"; DECRYPTED_PATH="$REPOSITORY_PATH/decrypted"; -SCRIPT_PATH="$REPOSITORY_PATH/scripts"; +SCRIPT_PATH="$REPOSITORY_PATH/scripts/"; DATA_PATH="$DECRYPTED_PATH/data"; BACKUP_PATH="$DECRYPTED_PATH/backup"; TEMPLATE_PATH="$REPOSITORY_PATH/templates"; @@ -69,6 +70,14 @@ error(){ exit 1; } +# @todo May this should be moved to another place +get_packages(){ + for package_collection in "$@" + do + sed -e "/^#/d" -e "s/#.*//" "$PACKAGE_PATH""$package_collection.txt" || error "Loading package wasn't possible." + done +} + HEADER(){ echo echo "${COLOR_YELLOW}The" diff --git a/scripts/client/setup.sh b/scripts/client/setup.sh index 0b89255..0f88405 100644 --- a/scripts/client/setup.sh +++ b/scripts/client/setup.sh @@ -10,8 +10,11 @@ SYSTEM_MEMORY_KB="$(grep MemTotal /proc/meminfo | awk '{print $2}')" info "Start setup of customized core software..." info "Copying templates to home folder..." cp -rfv "$TEMPLATE_PATH/." "$HOME" || error "Copy templates failed." -info "Synchronising packages..." +info "Update packages..." sudo pacman -Syyu || error "Package syncronisation failed." +info "Synchronizing packages..." +get_packages "general" "client" | sudo pacman -S --needed - || error "Syncronisation failed." +exit 1 FSTAB_SWAP_ENTRY="/swapfile none swap defaults 0 0" SWAP_FILE="/swapfile" FSTAB_FILE="/etc/fstab" @@ -25,18 +28,6 @@ else sudo swapon "$SWAP_FILE" sudo sh -c "echo \"$FSTAB_SWAP_ENTRY\">>\"$FSTAB_FILE\"" fi -info "Synchronizing programing language interpreters..." -sudo pacman --needed -S jdk11-openjdk python php -info "Synchronizing other interpreters..." -sudo pacman --needed -S texlive-most -info "Synchronizing compression tools..." -sudo pacman --needed -S p7zip -info "Synchronizing administration tools..." -sudo pacman --needed -S htop tree git base-devel yay make gcc cmake -info "Synchronizing network analyze tools..." -sudo pacman --needed -S traceroute wireshark-qt wireshark-cli -info "Synchronizing security tools..." -sudo pacman --needed -S ecryptfs-utils encfs keepassxc info "Setup SSH key..." ssh_key_path="$HOME/.ssh/id_rsa" if [ ! -f "$ssh_key_path" ]; then