From 7a8cf88830f3c296c9e94580b3304c862b02af48 Mon Sep 17 00:00:00 2001 From: FotoCoder Date: Sat, 10 Apr 2021 10:36:31 +0200 Subject: [PATCH] Added English language In this version I have managed it: now English is supported as well as German! --- .languages/english.txt | 29 ++++++++++++++++ .languages/german.txt | 29 ++++++++++++++++ install.sh | 75 ++++++++++++++++++++++++++---------------- 3 files changed, 105 insertions(+), 28 deletions(-) create mode 100644 .languages/english.txt create mode 100644 .languages/german.txt diff --git a/.languages/english.txt b/.languages/english.txt new file mode 100644 index 0000000..29c8869 --- /dev/null +++ b/.languages/english.txt @@ -0,0 +1,29 @@ +intromsg1="Thanks for using Backuppy to make your backups!" + +intromsg2="The installer will now ask you a few things to adapt your backup script to your requirements." + +rsyncopt="rsync offers various options, but to simplify the installation process, I have activated the options -a, -q and -p. \n If you want to set more options, you can do thjat in the file 'Backuppy.sh'." + +excludefile1="Now I need to know if you want to exclude one or more files/directories from your backups. Then you can adjust this in the 'exclude.txt'. \There you can exclude directories and files in the format '/directory' '/file.txt'.\n Do you want to exclude files/directories or not? [Y/N]" + +excludefile2="Perfect, then you can enter your files/directories to be excluded in the file 'exclude.txt' after completing the installation of Backuppy." + +excludefile3="Good, then I won't even create the file 'exclude.txt', because you don't need it." + +srcdir1="Now we come to one of the most important parts of installing Backuppy:" + +srcdir2="Which directory do you want to save (e.g. the home directory)? Please enter an absolute path (e.g. '/home/username/')." + +srcdir3_1="you have typed in the following source path: " +srcdir3_2="if this path is not correct, adjust it in the file 'Backuppy.sh'." + +targetdir1="Now I need to know where Backuppy should save your backups, i.e. the target directory. \n Please enter this carefully and in the same way as for the source directory." + +targetdir2_1="you have typed in the following destination path:" +targetdir2_2="if this path is not correct, adjust it in the file 'backuppy.sh'." + +collect="Now we have almost reached the end of the installer. I will now create the rsync command for you and show it to you.\n If you notice a mistake, just cancel the installer and start again from the beginning. \n Note: I recommend that you download Backuppy completely again in this case." + +outro1="Now we have reached the end. Now you can start Backuppy in the terminal with the command 'backuppy'. You may then have to type in your password so that Backuppy can work properly." + +outro2="Backuppy is now installed, have fun with it! If you have any questions, just write to me: fotocoder@joschu.ch" diff --git a/.languages/german.txt b/.languages/german.txt new file mode 100644 index 0000000..d185c03 --- /dev/null +++ b/.languages/german.txt @@ -0,0 +1,29 @@ +intromsg1="Danke, dass du Backuppy nutzt, um deine Backups zu erstellen!" + +intromsg2="Der Installer wird dich nun einige Dinge abfragen, um dein Backup-Skript an deine Anforderungen anzupassen." + +rsyncopt="rsync bietet verschiedene Optionen an, um das Ganze jedoch zu vereinfachen, habe ich die Optionen -a, -q und -p aktiviert. \n Wenn du mehr einstellen willst, kannst du das in der Datei 'Backuppy.sh' machen." + +excludefile1="Nun muss ich noch wissen, ob du ein oder mehrere Dateien/Verzeichnisse vom Backup ausschliessen möchtest. Dann kannst du das in der 'exclude.txt' anpassen. \n Dort kannst du dann im Format '/Verzeichnis' '/Datei.txt' Verzeichnisse und Dateien ausschliessen.\n Möchtest du Dateien/Verzeichnisse ausschliessen oder nicht? [J/N]" + +excludefile2="Perfekt, dann kannst du nach der Fertigstellung der Installation von Backuppy deine auszuschliessenden Dateien/Verzeichnisse in der Datei 'exclude.txt eintragen." + +excludefile3="Gut, dann erstelle ich die Datei 'exclude.txt' gar nicht erst, da du sie ja nicht brauchst." + +srcdir1="Nun kommen wir zu einem der wichtigesten Teile der Installation von Backuppy:" + +srcdir2="Welches Verzeichnis möchtest du sichern (z.B. das Homeverzeichnis)? Bitte gib einen absoluten Pfad (z.B. '/home/username/') an." + +srcdir3_1="du hast folgenden Quellpfad eingetippt: " +srcdir3_2="wenn dieser Pfad nicht stimmen sollte, dann passe ihn in der Datei 'Backuppy.sh' an." + +targetdir1="Nun muss ich noch wissen, wo Backuppy dein Backup ablegen soll, das Zielverzeichnis also. \n Bitte tippe dieses gewissenhaft und auf die Weise wie beim Quellverzeichnis ein." + +targetdir2_1="du hast folgenden Zielpfad eingetippt:" +targetdir2_2="wenn dieser Pfad nicht stimmen sollte, dann passe ihn in der Datei 'backuppy.sh' an." + +collect="Nun sind wir fast am Ende des Installers angelangt. Ich erstelle nun den rsync-Befehl für dich und zeige ihn dir nachher nochmal. \n Wenn dir da etwas auffallen sollte, brich den Installer einfach ab und fange nochmal von Vorne an. \n Achtung: ich empfehle dir, Backuppy in diesem Fall nochmal komplett neu zu installieren." + +outro1="Perfekt, jetzt sind wir fertig. Nun kannst du Backuppy im Terminal mit dem Befehl 'backuppy' starten. Möglicherweise musst du dann noch dein Passwort eintippen, damit Backuppy ordnungsgemäss arbeiten kann." + +outro2="Backuppy ist nun installiert, viel Spass damit! Bei Fragen schreib mir einfach: fotocoder@joschu.ch" diff --git a/install.sh b/install.sh index 0c7f46c..db467a2 100755 --- a/install.sh +++ b/install.sh @@ -2,12 +2,28 @@ # Variables mydir=$PWD +langDE=".languages/german.txt" +langEN=".languages/english.txt" # Intro -echo -e "\n Danke, dass du Backuppy nutzt, um deine Backups zu erstellen! \n" -sleep 2 -echo -e "Der Installer wird dich nun einige Dinge abfragen, um dein Backup-Skript an deine Anforderungen anzupassen. \n" -sleep 2 +# 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" +sleep 1 +echo -e " \n$intromsg2\n" +sleep 1 # Installer # creates the file 'Backuppy.sh' @@ -15,58 +31,61 @@ 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 "rsync bietet verschiedene Optionen an, um das Ganze jedoch zu vereinfachen, habe ich die Optionen -a, -q und -p aktiviert. \n Wenn du mehr einstellen willst, kannst du das in der Datei 'Backuppy.sh' machen. \n" -sleep 2 +echo -e "$rsyncopt \n" +sleep 1 # asks if you want to exclude files/directories from backup and creates an exclude file in case of Yes -echo -e "Nun muss ich noch wissen, ob du ein oder mehrere Dateien/Verzeichnisse vom Backup ausschliessen möchtest. Dann kannst du das in der 'exclude.txt' anpassen. \n Dort kannst du dann im Format '/Verzeichnis' '/Datei.txt' Verzeichnisse und Dateien ausschliessen.\n Möchtest du Dateien/Verzeichnisse ausschliessen oder nicht? [J/N]" +echo -e "$excludefile1" read exclude if [ $exclude = "J" ]; then - echo -e "Perfekt, dann kannst du nach der Fertigstellung der Installation von Backuppy deine auszuschliessenden Dateien/Verzeichnisse in der Datei 'exclude.txt eintragen. \n" + echo -e "$excludefile2 \n" touch exclude.txt - sleep 2 + sleep 1 +elif [ $exclude = "Y" ]; then + echo -e "$excludefile2 \n" + touch exclude.txt + sleep 1 fi if [ $exclude = "N" ]; then - echo -e "Gut, dann erstelle ich die Datei 'exclude.txt' gar nicht erst, da du sie ja nicht brauchst. \n" - rm exclude.txt - sleep 2 + echo -e "$excludefile3 \n" + sleep 1 fi # Asks for the source directory which should be saved -echo -e "Nun kommen wir zu einem der wichtigesten Teile der Installation von Backuppy:" +echo -e "$srcdir1" sleep 1 -echo -e "Welches Verzeichnis möchtest du sichern (z.B. das Homeverzeichnis)? Bitte gib einen absoluten Pfad (z.B. '/home/username/') an." +echo -e "$srcdir2" read sourcedir -echo -e "du hast folgenden Quellpfad eingetippt: $sourcedir wenn dieser Pfad nicht stimmen sollte, dann passe ihn in der Datei 'backuppy.sh' an" -sleep 2 +echo -e "$srcdir3_1 $sourcedir $srcdir3_2" +sleep 1 -# fasks for the destination directory in which the backup should be saved -echo -e "Nun muss ich noch wissen, wo Backuppy dein Backup ablegen soll, das Zielverzeichnis also. \n Bitte tippe dieses gewissenhaft und auf die Weise wie beim Quellverzeichnis ein." +# asks for the destination directory in which the backup should be saved +echo -e "$targetdir1" read targetdir -echo -e "du hast folgenden Zielpfad eingetippt: $targetdir wenn dieser Pfad nicht stimmen sollte, dann passe ihn in der Datei 'backuppy.sh' an" -sleep 2 +echo -e "$targetdir2_1 $targetdir $targetdir2_2" +sleep 1 # alias entry in .bashrc or .zshrc #zshrc -echo "$SHELL" +echo $SHELL if [ $SHELL = "/usr/bin/zsh" ]; then - echo "alias backuppy='sudo $mydir/Backuppy.sh'" >> ~/.zshrc + echo "alias backuppy='sudo $mydir/Backuppy.sh'" >> test1.txt fi #bashrc if [ $SHELL = "/usr/bin/bash" ]; then - echo "alias backuppy='sudo $mydir/Backuppy.sh'" >> ~/.bashrc + echo "alias backuppy='sudo $mydir/Backuppy.sh'" >> test2.txt fi # collects all the information needed to execute the rsync command and creates it. -echo -e "Nun sind wir fast am Ende des Installers angelangt. Ich erstelle nun den rsync-Befehl für dich und zeige ihn dir nachher nochmal. \n Wenn dir da etwas auffallen sollte, brich den Installer einfach ab und fange nochmal von Vorne an. \n Achtung: ich empfehle dir, Backuppy in diesem Fall nochmal komplett neu zu installieren. \n" -sleep 2 +echo -e "$collect \n" +sleep 1 echo -e "rsync -aqp --exclude-from=$mydir/exclude.txt $sourcedir $targetdir \n" -sleep 2 +sleep 1 # enter the rsync command in Backuppy.sh echo "rsync -aqp --exclude-from=$mydir/exclude.txt $sourcedir $targetdir" >> Backuppy.sh # Outro -echo -e "Perfekt, jetzt sind wir fertig. Nun kannst du Backuppy im Terminal mit dem Befehl 'backuppy' starten. Möglicherweise musst du dann noch dein Passwort eintippen, damit Backuppy ordnungsgemäss arbeiten kann." +echo -e "$outro1" sleep 2 -echo "Backuppy ist nun installiert, viel Spass damit! Bei Fragen schreib mir einfach: fotocoder@joschu.ch" +echo "$outro2"