-
Notifications
You must be signed in to change notification settings - Fork 1
/
backup-freetube.sh
58 lines (52 loc) · 1.9 KB
/
backup-freetube.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# GitHub: https://github.com/hafiz-muhammad
# Set directory for scripts.
SCRIPTS_DIR="$(dirname "$0")/scripts"
# Displays menu options.
menu() {
echo ""
echo "---------------------------------------------------"
echo "| FreeTube Data Backup Menu |"
echo "---------------------------------------------------"
echo "| |"
echo "| 1. Backup FreeTube Data (Linux) |"
echo "| 2. Backup FreeTube Data (Flatpak) |"
echo "| 0. Exit |"
echo "| |"
echo "---------------------------------------------------"
echo -e "\nIf you installed FreeTube using the .deb and .rpm packages, AppImage, AUR, or .zip/.7z archive files on Linux, choose '1'.\n"
echo -e "If you installed FreeTube using the Flatpak package, choose '2'.\n"
echo ""
}
# Displays menu.
menu
# Prompts the user to enter a choice between 0-2 and reads the input.
read -p "Enter your choice (0-2): " CHOICES
# Handles user's choice.
case $CHOICES in
1)
echo -e "\nOption 1: Backup FreeTube Data (Linux) chosen. Executing the 'ft-linux-backup.sh' script...\n"
# Makes ft-linux-backup.sh executable.
chmod +x "$SCRIPTS_DIR/ft-linux-backup.sh"
# Executes ft-linux-backup.sh
"$SCRIPTS_DIR/ft-linux-backup.sh"
# Restarts the current script.
exec "$0"
;;
2)
echo -e "\nOption 2: Backup FreeTube Data (Flatpak) chosen. Executing the 'ft-flatpak-backup.sh' script...\n"
# Makes ft-flatpak-backup.sh executable.
chmod +x "$SCRIPTS_DIR/ft-flatpak-backup.sh"
# Executes ft-flatpak-backup.sh
"$SCRIPTS_DIR/ft-flatpak-backup.sh"
# Restarts the current script.
exec "$0"
;;
0)
echo -e "\nExited"
exit
;;
*)
echo "Invalid choice. Enter a number from 0 to 2."
;;
esac