mirror of
https://github.com/kevinveenbirkenbach/linux-image-manager.git
synced 2024-11-25 16:31:03 +01:00
Optimized path variables and code
This commit is contained in:
parent
54a11fa8d4
commit
89902cd8eb
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,2 @@
|
|||||||
data/
|
decrypted/
|
||||||
.encrypted/
|
.encrypted/
|
||||||
|
@ -2,6 +2,11 @@
|
|||||||
#
|
#
|
||||||
# This script contains the global program variables and functions
|
# This script contains the global program variables and functions
|
||||||
# @author Kevin Veen-Birkenbach [aka. Frantz]
|
# @author Kevin Veen-Birkenbach [aka. Frantz]
|
||||||
REPOSITORY_PATH="$(dirname "$(readlink -f "${0}")")"
|
#
|
||||||
ENCRYPTED=$(readlink -f "$REPOSITORY_PATH/../.encrypted");
|
# shellcheck disable=SC2034 #Deactivate checking of unused variables
|
||||||
DECRYPTED=$(readlink -f "$REPOSITORY_PATH/../data");
|
REPOSITORY_PATH=$(readlink -f "$(dirname "$(readlink -f "${0}")")/../")
|
||||||
|
ENCRYPTED_PATH="$REPOSITORY_PATH/.encrypted";
|
||||||
|
DECRYPTED_PATH="$REPOSITORY_PATH/decrypted";
|
||||||
|
SCRIPT_PATH="$REPOSITORY_PATH/scripts";
|
||||||
|
DATA_PATH="$DECRYPTED_PATH/data";
|
||||||
|
BACKUP_PATH="$DECRYPTED_PATH/backup";
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Executes the import script in reverse mode
|
# Executes the import script in reverse mode
|
||||||
# @author Kevin Veen-Birkenbach [aka. Frantz]
|
# @author Kevin Veen-Birkenbach [aka. Frantz]
|
||||||
bash "$(dirname "$(readlink -f "${0}")")/import-data-from-system.sh" reverse
|
# shellcheck source=/dev/null # Deactivate SC1090
|
||||||
|
source "$(dirname "$(readlink -f "${0}")")/base.sh"
|
||||||
|
bash "$SCRIPT_PATH/import-data-from-system.sh" reverse
|
||||||
|
@ -4,19 +4,18 @@
|
|||||||
# @author Kevin Veen-Birkenbach [aka. Frantz]
|
# @author Kevin Veen-Birkenbach [aka. Frantz]
|
||||||
# @param $1 If the first parameter is "reverse" the data will be exported to the system
|
# @param $1 If the first parameter is "reverse" the data will be exported to the system
|
||||||
#
|
#
|
||||||
# Deactivate SC1090
|
# shellcheck source=/dev/null # Deactivate SC1090
|
||||||
# shellcheck source=/dev/null
|
# shellcheck disable=SC2143 # Comparing with -z allowed
|
||||||
source "$(dirname "$(readlink -f "${0}")")/base.sh"
|
source "$(dirname "$(readlink -f "${0}")")/base.sh"
|
||||||
DATA_FOLDER=$ENCRYPTED
|
if [ -z "$(mount | grep "$DECRYPTED_PATH")" ]
|
||||||
if [ -z "$(mount | grep $DATA_FOLDER)" ]
|
|
||||||
then
|
then
|
||||||
echo "The data folder $DATA_FOLDER is locked. You need to unlock it!"
|
echo "The decrypted folder $DECRYPTED_PATH is locked. You need to unlock it!"
|
||||||
bash "$(dirname "$(readlink -f "${0}")")/unlock.sh" || exit 1;
|
bash "$SCRIPT_PATH/unlock.sh" || exit 1;
|
||||||
fi
|
fi
|
||||||
declare -a BACKUP_LIST=("$HOME/.ssh/" "$HOME/.gitconfig" "$HOME/.mozilla/firefox/" "$HOME/.atom/config.cson");
|
declare -a BACKUP_LIST=("$HOME/.ssh/" "$HOME/.gitconfig" "$HOME/.mozilla/firefox/" "$HOME/.atom/config.cson");
|
||||||
for system_item_path in "${BACKUP_LIST[@]}";
|
for system_item_path in "${BACKUP_LIST[@]}";
|
||||||
do
|
do
|
||||||
data_item_path="$DATA_FOLDER$system_item_path"
|
data_item_path="$DATA_PATH$system_item_path"
|
||||||
if [ "$1" = "reverse" ]
|
if [ "$1" = "reverse" ]
|
||||||
then
|
then
|
||||||
destination="$system_item_path"
|
destination="$system_item_path"
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
# Locks the data
|
# Locks the data
|
||||||
# @author Kevin Veen-Birkenbach [aka. Frantz]
|
# @author Kevin Veen-Birkenbach [aka. Frantz]
|
||||||
#
|
#
|
||||||
# Deactivate SC1090
|
# shellcheck source=/dev/null # Deactivate SC1090
|
||||||
# shellcheck source=/dev/null
|
|
||||||
source "$(dirname "$(readlink -f "${0}")")/base.sh"
|
source "$(dirname "$(readlink -f "${0}")")/base.sh"
|
||||||
echo "Locking directory $DECRYPTED..."
|
echo "Locking directory $DECRYPTED_PATH..."
|
||||||
fusermount -u "$DECRYPTED" && echo "Data is now encrypted." && echo "Removing directory $DECRYPTED..." && rmdir "$DECRYPTED"
|
fusermount -u "$DECRYPTED_PATH" && echo "Data is now encrypted." && echo "Removing directory $DECRYPTED_PATH..." && rmdir "$DECRYPTED_PATH"
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
#
|
#
|
||||||
# Installs the core system
|
# Installs the core system
|
||||||
# @author Kevin Veen-Birkenbach [aka. Frantz]
|
# @author Kevin Veen-Birkenbach [aka. Frantz]
|
||||||
|
#
|
||||||
|
# shellcheck source=/dev/null # Deactivate SC1090
|
||||||
|
source "$(dirname "$(readlink -f "${0}")")/base.sh"
|
||||||
echo "Start setup of customized core software..."
|
echo "Start setup of customized core software..."
|
||||||
echo "Synchronising packages..."
|
echo "Synchronising packages..."
|
||||||
echo "Synchronizing programing languages..."
|
echo "Synchronizing programing languages..."
|
||||||
|
@ -3,11 +3,10 @@
|
|||||||
# Unlocks the data
|
# Unlocks the data
|
||||||
# @author Kevin Veen-Birkenbach [aka. Frantz]
|
# @author Kevin Veen-Birkenbach [aka. Frantz]
|
||||||
#
|
#
|
||||||
# Deactivate SC1090
|
# shellcheck source=/dev/null # Deactivate SC1090
|
||||||
# shellcheck source=/dev/null
|
|
||||||
source "$(dirname "$(readlink -f "${0}")")/base.sh"
|
source "$(dirname "$(readlink -f "${0}")")/base.sh"
|
||||||
echo "Unlocking directory $DECRYPTED..."
|
echo "Unlocking directory $DECRYPTED_PATH..."
|
||||||
echo "Creating directory $DECRYPTED..."
|
echo "Creating directory $DECRYPTED_PATH..."
|
||||||
mkdir "$DECRYPTED"
|
mkdir "$DECRYPTED_PATH"
|
||||||
echo "Encrypting directory $DECRYPTED to $DECRYPTED..."
|
echo "Encrypting directory $DECRYPTED_PATH to $DECRYPTED_PATH..."
|
||||||
encfs "$ENCRYPTED" "$DECRYPTED" && echo "ATTENTION: DATA IS NOW DECRYPTED!"
|
encfs "$ENCRYPTED_PATH" "$DECRYPTED_PATH" && echo "ATTENTION: DATA IS NOW DECRYPTED!"
|
||||||
|
Loading…
Reference in New Issue
Block a user