2021-03-23 11:18:57 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-04-08 06:35:44 +00:00
|
|
|
# Variables
|
2021-04-02 12:08:27 +00:00
|
|
|
mydir=$PWD
|
2021-05-05 15:22:57 +00:00
|
|
|
langDE="./languages/german.py"
|
|
|
|
langEN="./languages/english.py"
|
2021-03-23 11:18:57 +00:00
|
|
|
|
2021-05-05 15:22:57 +00:00
|
|
|
# Check if graphical installer should be executed
|
|
|
|
if [ "$1" == "--gui" ]; then
|
|
|
|
python3 -B install.py
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
# Intro
|
|
|
|
# language
|
|
|
|
echo -e "Hello, first of all, which language do you prefer: German [DE] or English [EN]?"
|
|
|
|
read language
|
|
|
|
if [ $language = "DE" ]; then
|
|
|
|
echo -e "Perfekt, nun ist das deutsche Sprachpaket aktiviert. Willkommen! \n"
|
|
|
|
. $langDE
|
|
|
|
sleep 1
|
|
|
|
fi
|
|
|
|
if [ $language = "EN" ]; then
|
|
|
|
echo -e "Perfect, the English language package is now activated. Welcome!. \n"
|
|
|
|
. $langEN
|
|
|
|
sleep 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo -e "\n$intromsg1 \n"
|
2021-04-10 08:36:31 +00:00
|
|
|
sleep 1
|
2021-05-05 15:22:57 +00:00
|
|
|
echo -e " \n$intromsg2\n"
|
2021-04-10 08:36:31 +00:00
|
|
|
sleep 1
|
2021-05-05 15:22:57 +00:00
|
|
|
# Installer
|
2021-04-10 08:36:31 +00:00
|
|
|
|
2021-05-05 15:22:57 +00:00
|
|
|
# creates the file 'Backuppy.sh'
|
|
|
|
touch Backuppy.sh
|
|
|
|
echo "#!/bin/bash" >> Backuppy.sh
|
|
|
|
chmod +x Backuppy.sh
|
|
|
|
# which Rsync options are available and which one you want to use
|
|
|
|
echo -e "$rsyncopt \n"
|
|
|
|
sleep 1
|
2021-03-23 11:18:57 +00:00
|
|
|
|
2021-05-05 15:22:57 +00:00
|
|
|
# asks if you want to exclude files/directories from backup and creates an exclude file in case of Yes
|
|
|
|
echo -e "$excludefile1"
|
|
|
|
read exclude
|
|
|
|
if [ $exclude = "J" ]; then
|
|
|
|
echo -e "$excludefile2 \n"
|
|
|
|
touch exclude.txt
|
|
|
|
sleep 1
|
|
|
|
elif [ $exclude = "Y" ]; then
|
|
|
|
echo -e "$excludefile2 \n"
|
|
|
|
touch exclude.txt
|
|
|
|
sleep 1
|
|
|
|
fi
|
|
|
|
if [ $exclude = "N" ]; then
|
|
|
|
echo -e "$excludefile3 \n"
|
|
|
|
sleep 1
|
|
|
|
fi
|
2021-03-23 11:18:57 +00:00
|
|
|
|
2021-05-05 15:22:57 +00:00
|
|
|
# Asks for the source directory which should be saved
|
|
|
|
echo -e "$srcdir1"
|
2021-04-10 08:36:31 +00:00
|
|
|
sleep 1
|
2021-05-05 15:22:57 +00:00
|
|
|
echo -e "$srcdir2"
|
|
|
|
read sourcedir
|
|
|
|
echo -e "$srcdir3_1 $sourcedir $srcdir3_2"
|
2021-04-10 08:36:31 +00:00
|
|
|
sleep 1
|
2021-03-23 11:18:57 +00:00
|
|
|
|
2021-05-05 15:22:57 +00:00
|
|
|
# asks for the destination directory in which the backup should be saved
|
|
|
|
echo -e "$targetdir1"
|
|
|
|
read targetdir
|
|
|
|
echo -e "$targetdir2_1 $targetdir $targetdir2_2"
|
|
|
|
sleep 1
|
2021-04-02 12:08:27 +00:00
|
|
|
|
2021-05-05 15:22:57 +00:00
|
|
|
# alias entry in .bashrc or .zshrc
|
|
|
|
# .zshrc case 1
|
|
|
|
echo $SHELL
|
|
|
|
if [ $SHELL = "/usr/bin/zsh" ]; then
|
|
|
|
echo "alias backuppy='sudo $mydir/Backuppy.sh'" >> ~/.zshrc
|
|
|
|
fi
|
|
|
|
# zshrc case 2
|
|
|
|
echo $SHELL
|
|
|
|
if [ $SHELL = "/bin/zsh" ]; then
|
|
|
|
echo "alias backuppy='sudo $mydir/Backuppy.sh'" >> ~/.zshrc
|
|
|
|
fi
|
|
|
|
#bashrc case 1
|
|
|
|
if [ $SHELL = "/usr/bin/bash" ]; then
|
|
|
|
echo "alias backuppy='sudo $mydir/Backuppy.sh'" >> ~/.bashrc
|
|
|
|
fi
|
|
|
|
# bashrc case 2
|
|
|
|
if [ $SHELL = "/bin/bash" ]; then
|
|
|
|
echo "alias backuppy='sudo $mydir/Backuppy.sh'" >> ~/.bashrc
|
|
|
|
fi
|
2021-03-23 11:18:57 +00:00
|
|
|
|
2021-05-05 15:22:57 +00:00
|
|
|
# collects all the information needed to execute the rsync command and creates it.
|
|
|
|
echo -e "$collect \n"
|
|
|
|
sleep 1
|
|
|
|
echo -e "rsync -aqp --exclude-from=$mydir/exclude.txt $sourcedir $targetdir \n"
|
|
|
|
sleep 1
|
2021-03-23 11:18:57 +00:00
|
|
|
|
2021-05-05 15:22:57 +00:00
|
|
|
# enter the rsync command in Backuppy.sh
|
|
|
|
echo "rsync -aqp --exclude-from=$mydir/exclude.txt $sourcedir $targetdir" >> Backuppy.sh
|
2021-03-23 11:18:57 +00:00
|
|
|
|
2021-05-05 15:22:57 +00:00
|
|
|
# Outro
|
|
|
|
echo -e "$outro1"
|
|
|
|
sleep 2
|
|
|
|
echo "$outro2"
|
|
|
|
exit 0
|
|
|
|
fi
|