forked from FotoCoder/Backuppy
Implemented option "--gui" for graphical installer
This commit is contained in:
parent
d4327b64db
commit
4bc87b9642
1 changed files with 95 additions and 88 deletions
147
install.sh
147
install.sh
|
@ -2,99 +2,106 @@
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
mydir=$PWD
|
mydir=$PWD
|
||||||
langDE="languages/german.py"
|
langDE="./languages/german.py"
|
||||||
langEN="languages/english.py"
|
langEN="./languages/english.py"
|
||||||
|
|
||||||
# Intro
|
# Check if graphical installer should be executed
|
||||||
# language
|
if [ "$1" == "--gui" ]; then
|
||||||
echo -e "Hello, first of all, which language do you prefer: German [DE] or English [EN]?"
|
python3 -B install.py
|
||||||
read language
|
exit 0
|
||||||
if [ $language = "DE" ]; then
|
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"
|
echo -e "Perfekt, nun ist das deutsche Sprachpaket aktiviert. Willkommen! \n"
|
||||||
. $langDE
|
. $langDE
|
||||||
sleep 1
|
sleep 1
|
||||||
fi
|
fi
|
||||||
if [ $language = "EN" ]; then
|
if [ $language = "EN" ]; then
|
||||||
echo -e "Perfect, the English language package is now activated. Welcome!. \n"
|
echo -e "Perfect, the English language package is now activated. Welcome!. \n"
|
||||||
. $langEN
|
. $langEN
|
||||||
sleep 1
|
sleep 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\n$intromsg1 \n"
|
echo -e "\n$intromsg1 \n"
|
||||||
sleep 1
|
sleep 1
|
||||||
echo -e " \n$intromsg2\n"
|
echo -e " \n$intromsg2\n"
|
||||||
sleep 1
|
sleep 1
|
||||||
# Installer
|
# Installer
|
||||||
|
|
||||||
# creates the file 'Backuppy.sh'
|
# creates the file 'Backuppy.sh'
|
||||||
touch Backuppy.sh
|
touch Backuppy.sh
|
||||||
echo "#!/bin/bash" >> Backuppy.sh
|
echo "#!/bin/bash" >> Backuppy.sh
|
||||||
chmod +x Backuppy.sh
|
chmod +x Backuppy.sh
|
||||||
# which Rsync options are available and which one you want to use
|
# which Rsync options are available and which one you want to use
|
||||||
echo -e "$rsyncopt \n"
|
echo -e "$rsyncopt \n"
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# asks if you want to exclude files/directories from backup and creates an exclude file in case of Yes
|
# asks if you want to exclude files/directories from backup and creates an exclude file in case of Yes
|
||||||
echo -e "$excludefile1"
|
echo -e "$excludefile1"
|
||||||
read exclude
|
read exclude
|
||||||
if [ $exclude = "J" ]; then
|
if [ $exclude = "J" ]; then
|
||||||
echo -e "$excludefile2 \n"
|
echo -e "$excludefile2 \n"
|
||||||
touch exclude.txt
|
touch exclude.txt
|
||||||
sleep 1
|
sleep 1
|
||||||
elif [ $exclude = "Y" ]; then
|
elif [ $exclude = "Y" ]; then
|
||||||
echo -e "$excludefile2 \n"
|
echo -e "$excludefile2 \n"
|
||||||
touch exclude.txt
|
touch exclude.txt
|
||||||
sleep 1
|
sleep 1
|
||||||
fi
|
fi
|
||||||
if [ $exclude = "N" ]; then
|
if [ $exclude = "N" ]; then
|
||||||
echo -e "$excludefile3 \n"
|
echo -e "$excludefile3 \n"
|
||||||
sleep 1
|
sleep 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Asks for the source directory which should be saved
|
# Asks for the source directory which should be saved
|
||||||
echo -e "$srcdir1"
|
echo -e "$srcdir1"
|
||||||
sleep 1
|
sleep 1
|
||||||
echo -e "$srcdir2"
|
echo -e "$srcdir2"
|
||||||
read sourcedir
|
read sourcedir
|
||||||
echo -e "$srcdir3_1 $sourcedir $srcdir3_2"
|
echo -e "$srcdir3_1 $sourcedir $srcdir3_2"
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# asks for the destination directory in which the backup should be saved
|
# asks for the destination directory in which the backup should be saved
|
||||||
echo -e "$targetdir1"
|
echo -e "$targetdir1"
|
||||||
read targetdir
|
read targetdir
|
||||||
echo -e "$targetdir2_1 $targetdir $targetdir2_2"
|
echo -e "$targetdir2_1 $targetdir $targetdir2_2"
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# alias entry in .bashrc or .zshrc
|
# alias entry in .bashrc or .zshrc
|
||||||
# .zshrc case 1
|
# .zshrc case 1
|
||||||
echo $SHELL
|
echo $SHELL
|
||||||
if [ $SHELL = "/usr/bin/zsh" ]; then
|
if [ $SHELL = "/usr/bin/zsh" ]; then
|
||||||
echo "alias backuppy='sudo $mydir/Backuppy.sh'" >> ~/.zshrc
|
echo "alias backuppy='sudo $mydir/Backuppy.sh'" >> ~/.zshrc
|
||||||
fi
|
fi
|
||||||
# zshrc case 2
|
# zshrc case 2
|
||||||
echo $SHELL
|
echo $SHELL
|
||||||
if [ $SHELL = "/bin/zsh" ]; then
|
if [ $SHELL = "/bin/zsh" ]; then
|
||||||
echo "alias backuppy='sudo $mydir/Backuppy.sh'" >> ~/.zshrc
|
echo "alias backuppy='sudo $mydir/Backuppy.sh'" >> ~/.zshrc
|
||||||
fi
|
fi
|
||||||
#bashrc case 1
|
#bashrc case 1
|
||||||
if [ $SHELL = "/usr/bin/bash" ]; then
|
if [ $SHELL = "/usr/bin/bash" ]; then
|
||||||
echo "alias backuppy='sudo $mydir/Backuppy.sh'" >> ~/.bashrc
|
echo "alias backuppy='sudo $mydir/Backuppy.sh'" >> ~/.bashrc
|
||||||
fi
|
fi
|
||||||
# bashrc case 2
|
# bashrc case 2
|
||||||
if [ $SHELL = "/bin/bash" ]; then
|
if [ $SHELL = "/bin/bash" ]; then
|
||||||
echo "alias backuppy='sudo $mydir/Backuppy.sh'" >> ~/.bashrc
|
echo "alias backuppy='sudo $mydir/Backuppy.sh'" >> ~/.bashrc
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# enter the rsync command in Backuppy.sh
|
||||||
|
echo "rsync -aqp --exclude-from=$mydir/exclude.txt $sourcedir $targetdir" >> Backuppy.sh
|
||||||
|
|
||||||
|
# Outro
|
||||||
|
echo -e "$outro1"
|
||||||
|
sleep 2
|
||||||
|
echo "$outro2"
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
# enter the rsync command in Backuppy.sh
|
|
||||||
echo "rsync -aqp --exclude-from=$mydir/exclude.txt $sourcedir $targetdir" >> Backuppy.sh
|
|
||||||
|
|
||||||
# Outro
|
|
||||||
echo -e "$outro1"
|
|
||||||
sleep 2
|
|
||||||
echo "$outro2"
|
|
||||||
|
|
Loading…
Reference in a new issue