Added base.sh and refactored

This commit is contained in:
Kevin Veen-Birkenbach 2019-10-01 08:50:17 +02:00
parent 89bb5b619d
commit 24e05b6c08
5 changed files with 12 additions and 5 deletions

5
scripts/base.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
# This script contains the global program variables and functions
# @author Kevin Veen-Birkenbach [aka. Frantz]
ENCRYPTED=$(readlink -f "$(dirname "$(readlink -f "${0}")")/../.encrypted");
DECRYPTED=$(readlink -f "$(dirname "$(readlink -f "${0}")")/../data");

View File

@ -2,7 +2,8 @@
# Imports data from the system
# @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");
source "$(dirname "$(readlink -f "${0}")")/base.sh"
DATA_FOLDER=$ENCRYPTED
if [ -z "$(mount | grep $DATA_FOLDER)" ]
then
echo "The data folder $DATA_FOLDER is locked. You need to unlock it!"

View File

@ -1,6 +1,6 @@
#!/bin/bash
# Locks the data
# @author Kevin Veen-Birkenbach [aka. Frantz]
DECRYPTED=$(readlink -f "$(dirname "$(readlink -f "${0}")")/../data");
source "$(dirname "$(readlink -f "${0}")")/base.sh"
echo "Locking directory $DECRYPTED..."
fusermount -u "$DECRYPTED" && echo "Data is now encrypted." && echo "Removing directory $DECRYPTED..." && rmdir "$DECRYPTED"

View File

@ -1,4 +1,6 @@
#!/bin/bash
# Installs the core system
# @author Kevin Veen-Birkenbach [aka. Frantz]
echo "Start setup of customized core software..."
echo "Synchronising packages..."
echo "Synchronizing programing languages..."
@ -57,7 +59,7 @@ apm install -c \
highlight-selected\
autocomplete-paths\
todo-show\
docblockr\
docblockr
npm i -g bash-language-server #Needed by atom-package ide-bash
echo "Synchronizing containerization tools..."
echo "Installing docker..."

View File

@ -1,8 +1,7 @@
#!/bin/bash
# Unlocks the data
# @author Kevin Veen-Birkenbach [aka. Frantz]
ENCRYPTED=$(readlink -f "$(dirname "$(readlink -f "${0}")")/../.encrypted");
DECRYPTED=$(readlink -f "$(dirname "$(readlink -f "${0}")")/../data");
source "$(dirname "$(readlink -f "${0}")")/base.sh"
echo "Unlocking directory $DECRYPTED..."
echo "Creating directory $DECRYPTED..."
mkdir "$DECRYPTED"