From 2aaaa008bb9dedb1ed2efb0c4295d44df08321d1 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 22 Aug 2024 17:44:28 +0330 Subject: [PATCH 01/27] Update install.sh --- install.sh | 164 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) diff --git a/install.sh b/install.sh index e245dd1..d47793a 100644 --- a/install.sh +++ b/install.sh @@ -105,6 +105,7 @@ menu() { print "—————————————————————————————————————————————————————————————————————————" print "1) Install" print "2) Manage" + print "3) Restore" print "0) Exit" print "" input "Enter your option number: " option @@ -116,6 +117,9 @@ menu() { 2) manage_backups ;; + 3) + restore_backup + ;; 0) print "Thank you for using @ErfJabs script. Goodbye!" exit 0 @@ -810,6 +814,166 @@ EOL fi } + +#Restore backup +restore_backup() { + +#Check zip file requires a password or not +check_zip_password() { + local zip_file="$1" +crypted=$( 7z l -slt -- $zip_file | grep -i -c "Encrypted = +" ) +if [ "$crypted" -eq "1" ]; then + return 1 +else + return 0 +fi +} + +#Check 7z file requires a password or not +check_7z_password() { + local 7z_file="$1" + crypted=$( 7z l -slt -- $7z_file | grep -i -c "Encrypted = +" ) + if [ "$crypted" -eq "1" ]; then + return 1 + else + return 0 + fi + +} + +# Function to extract and copy files from the archive to the correct system paths +extract_and_copy_archive() { + local archive_file="$1" + local base_name + local temp_dir + local sevenz_password + local zip_password + + # Extract base name without extension + base_name=$(basename "$archive_file" | sed 's/\.[^.]*$//') + temp_dir="/root/Restore/old-$base_name" + + # Ensure temp directory is clean + rm -rf "$temp_dir" + mkdir -p "$temp_dir" + + if [ ! -f "$archive_file" ]; then + echo "File $archive_file does not exist." + exit 1 + fi + + case "$archive_file" in + *.zip) + echo "Handling ZIP file." + if check_zip_password "$archive_file"; then + echo "The ZIP file requires a password." + read -p "Please enter the password for the ZIP file: " zip_password + if ! unzip -P "$zip_password" "$archive_file" -d "$temp_dir" >/dev/null 2>&1; then + echo "Error extracting ZIP file with the provided password." + exit 1 + fi + + else + echo "The ZIP file does not require a password." + unzip "$archive_file" -d "$temp_dir" >/dev/null 2>&1 + + fi + ;; + *.7z) + echo "Handling 7z file." + if check_7z_password "$archive_file"; then + echo "The 7z file requires a password." + read -p "Enter the password for the 7z file:" sevenz_password + if ! 7z x -p"$sevenz_password" "$archive_file" -o"$temp_dir" >/dev/null 2>&1; then + echo "Failed to extract 7z file with the provided password." + exit 1 + fi + else + echo "The 7z file does not require a password." + 7z x "$archive_file" -o"$temp_dir" >/dev/null 2>&1 + + fi + ;; + *) + echo "Unsupported file format. Please provide a ZIP or 7z file." + rm -rf "$temp_dir" + exit 1 + ;; + esac + + if [ $? -ne 0 ]; then + echo "Failed to extract $archive_file. Please check the password and try again." + rm -rf "$temp_dir" + exit 1 + fi + + # Copy files from the temporary extraction directory to system paths + echo "Copying files from temporary directory to system paths..." + cd "$temp_dir" || exit + find . -type f | while read -r file; do + target_path="/${file#./}" + echo "Copying file: $file to $target_path" + mkdir -p "$(dirname "$target_path")" + cp "$file" "$target_path" + done + + find . -type d | while read -r dir; do + target_path="/${dir#./}" + echo "Creating directory: $dir at $target_path" + mkdir -p "$target_path" + done + + # Remove temporary directory + remove_old_archives "$base_name" + echo "Files from $archive_file have been successfully extracted and copied." +} +remove_old_archives() { +read -p "Do you want to remove old archives? (y/n) " answer +local name=$1; +if [ "$answer" == "y" ]; then + echo "removing old archives" + find /root/Restore/ -name "old-$name" -type d -exec rm -rf {} \; +else + echo "skipping removal of old archives" + echo "You can find the extracted files in /root/Restore/old-$name" +fi + + +} +# Main function for the menu and extraction option +menu() { + while true; do + echo "\n\t Select an option:" + echo "—————————————————————————————————————————————————————————————————————————" + echo "1) Marzban Panel" + echo "0) Exit" + echo "" + echo -n "Enter your option number: " + read option + clear + case $option in + 1) + read -p "Enter the path to the archive file (.zip or .7z): " archive_file + extract_and_copy_archive "$archive_file" + ;; + 0) + echo "Thank you for using the Backup Utility. Goodbye!" + exit 0 + ;; + *) + echo "Invalid option, Please select a valid option!" + ;; + esac + done +} + +# Run the menu +menu + + +} + + run() { cd clear From d8cba7e25f01fefbeb7240a0a54566675e6944d1 Mon Sep 17 00:00:00 2001 From: Azavax Date: Thu, 22 Aug 2024 17:45:55 +0330 Subject: [PATCH 02/27] Update install.sh --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index d47793a..1cdb5b3 100644 --- a/install.sh +++ b/install.sh @@ -979,5 +979,5 @@ run() { clear menu } - +#hi run \ No newline at end of file From 7055f4826e69278f900e9d9a8872a55d531ca88e Mon Sep 17 00:00:00 2001 From: Azavax Date: Thu, 22 Aug 2024 18:15:24 +0330 Subject: [PATCH 03/27] Update install.sh --- install.sh | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/install.sh b/install.sh index 1cdb5b3..2b169f6 100644 --- a/install.sh +++ b/install.sh @@ -858,7 +858,7 @@ extract_and_copy_archive() { mkdir -p "$temp_dir" if [ ! -f "$archive_file" ]; then - echo "File $archive_file does not exist." + error "File $archive_file does not exist." exit 1 fi @@ -866,15 +866,15 @@ extract_and_copy_archive() { *.zip) echo "Handling ZIP file." if check_zip_password "$archive_file"; then - echo "The ZIP file requires a password." + log "The ZIP file requires a password." read -p "Please enter the password for the ZIP file: " zip_password if ! unzip -P "$zip_password" "$archive_file" -d "$temp_dir" >/dev/null 2>&1; then - echo "Error extracting ZIP file with the provided password." + error "Error extracting ZIP file with the provided password." exit 1 fi else - echo "The ZIP file does not require a password." + success "The ZIP file does not require a password." unzip "$archive_file" -d "$temp_dir" >/dev/null 2>&1 fi @@ -882,20 +882,20 @@ extract_and_copy_archive() { *.7z) echo "Handling 7z file." if check_7z_password "$archive_file"; then - echo "The 7z file requires a password." + log "The 7z file requires a password." read -p "Enter the password for the 7z file:" sevenz_password if ! 7z x -p"$sevenz_password" "$archive_file" -o"$temp_dir" >/dev/null 2>&1; then - echo "Failed to extract 7z file with the provided password." + error "Failed to extract 7z file with the provided password." exit 1 fi else - echo "The 7z file does not require a password." + success "The 7z file does not require a password." 7z x "$archive_file" -o"$temp_dir" >/dev/null 2>&1 fi ;; *) - echo "Unsupported file format. Please provide a ZIP or 7z file." + error "Unsupported file format. Please provide a ZIP or 7z file." rm -rf "$temp_dir" exit 1 ;; @@ -908,47 +908,47 @@ extract_and_copy_archive() { fi # Copy files from the temporary extraction directory to system paths - echo "Copying files from temporary directory to system paths..." + log "Copying files from temporary directory to system paths..." cd "$temp_dir" || exit find . -type f | while read -r file; do target_path="/${file#./}" - echo "Copying file: $file to $target_path" + log "Copying file: $file to $target_path" mkdir -p "$(dirname "$target_path")" cp "$file" "$target_path" done find . -type d | while read -r dir; do target_path="/${dir#./}" - echo "Creating directory: $dir at $target_path" + log "Creating directory: $dir at $target_path" mkdir -p "$target_path" done # Remove temporary directory remove_old_archives "$base_name" - echo "Files from $archive_file have been successfully extracted and copied." + success "Files from $archive_file have been successfully extracted and copied." } remove_old_archives() { read -p "Do you want to remove old archives? (y/n) " answer local name=$1; if [ "$answer" == "y" ]; then - echo "removing old archives" + log "removing old archives" find /root/Restore/ -name "old-$name" -type d -exec rm -rf {} \; else - echo "skipping removal of old archives" - echo "You can find the extracted files in /root/Restore/old-$name" + log "skipping removal of old archives" + success "You can find the extracted files in /root/Restore/old-$name" fi } # Main function for the menu and extraction option -menu() { +restore_menu() { while true; do - echo "\n\t Select an option:" - echo "—————————————————————————————————————————————————————————————————————————" - echo "1) Marzban Panel" - echo "0) Exit" - echo "" - echo -n "Enter your option number: " + print "\n\t Select an option:" + print "—————————————————————————————————————————————————————————————————————————" + print "1) Marzban Panel" + print "0) Exit" + print "" + print -n "Enter your option number: " read option clear case $option in @@ -957,18 +957,18 @@ menu() { extract_and_copy_archive "$archive_file" ;; 0) - echo "Thank you for using the Backup Utility. Goodbye!" + success "Thank you for using the Backup Utility. Goodbye!" exit 0 ;; *) - echo "Invalid option, Please select a valid option!" + error "Invalid option, Please select a valid option!" ;; esac done } # Run the menu -menu +restore_menu } From 7f4ec26066e032661c1e348286598badb630bf73 Mon Sep 17 00:00:00 2001 From: Azavax Date: Thu, 22 Aug 2024 18:16:48 +0330 Subject: [PATCH 04/27] Update install.sh --- install.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index 2b169f6..f1c6423 100644 --- a/install.sh +++ b/install.sh @@ -867,7 +867,7 @@ extract_and_copy_archive() { echo "Handling ZIP file." if check_zip_password "$archive_file"; then log "The ZIP file requires a password." - read -p "Please enter the password for the ZIP file: " zip_password + input -p "Please enter the password for the ZIP file: " zip_password if ! unzip -P "$zip_password" "$archive_file" -d "$temp_dir" >/dev/null 2>&1; then error "Error extracting ZIP file with the provided password." exit 1 @@ -883,7 +883,7 @@ extract_and_copy_archive() { echo "Handling 7z file." if check_7z_password "$archive_file"; then log "The 7z file requires a password." - read -p "Enter the password for the 7z file:" sevenz_password + input -p "Enter the password for the 7z file:" sevenz_password if ! 7z x -p"$sevenz_password" "$archive_file" -o"$temp_dir" >/dev/null 2>&1; then error "Failed to extract 7z file with the provided password." exit 1 @@ -948,12 +948,11 @@ restore_menu() { print "1) Marzban Panel" print "0) Exit" print "" - print -n "Enter your option number: " - read option + input -n "Enter your option number: " option clear case $option in 1) - read -p "Enter the path to the archive file (.zip or .7z): " archive_file + input -p "Enter the path to the archive file (.zip or .7z): " archive_file extract_and_copy_archive "$archive_file" ;; 0) From e2186616586e31721279314ac7ff2fcc0193812c Mon Sep 17 00:00:00 2001 From: Azavax Date: Thu, 22 Aug 2024 18:22:40 +0330 Subject: [PATCH 05/27] Update install.sh --- install.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index f1c6423..0e74d03 100644 --- a/install.sh +++ b/install.sh @@ -867,7 +867,7 @@ extract_and_copy_archive() { echo "Handling ZIP file." if check_zip_password "$archive_file"; then log "The ZIP file requires a password." - input -p "Please enter the password for the ZIP file: " zip_password + input "Please enter the password for the ZIP file: " zip_password if ! unzip -P "$zip_password" "$archive_file" -d "$temp_dir" >/dev/null 2>&1; then error "Error extracting ZIP file with the provided password." exit 1 @@ -883,7 +883,7 @@ extract_and_copy_archive() { echo "Handling 7z file." if check_7z_password "$archive_file"; then log "The 7z file requires a password." - input -p "Enter the password for the 7z file:" sevenz_password + input "Enter the password for the 7z file:" sevenz_password if ! 7z x -p"$sevenz_password" "$archive_file" -o"$temp_dir" >/dev/null 2>&1; then error "Failed to extract 7z file with the provided password." exit 1 @@ -948,11 +948,11 @@ restore_menu() { print "1) Marzban Panel" print "0) Exit" print "" - input -n "Enter your option number: " option + input "Enter your option number: " option clear case $option in 1) - input -p "Enter the path to the archive file (.zip or .7z): " archive_file + input "Enter the path to the archive file (.zip or .7z): " archive_file extract_and_copy_archive "$archive_file" ;; 0) From df59dc20dfbbaa34d5624a07465764b91dce605d Mon Sep 17 00:00:00 2001 From: Azavax Date: Thu, 22 Aug 2024 18:26:19 +0330 Subject: [PATCH 06/27] Update install.sh --- install.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 0e74d03..b934e25 100644 --- a/install.sh +++ b/install.sh @@ -948,9 +948,8 @@ restore_menu() { print "1) Marzban Panel" print "0) Exit" print "" - input "Enter your option number: " option - clear - case $option in + input "Enter your option number: " options + case $options in 1) input "Enter the path to the archive file (.zip or .7z): " archive_file extract_and_copy_archive "$archive_file" From e16e5b1cc5d427ccf6370fff131bb7c8a3ffcc13 Mon Sep 17 00:00:00 2001 From: Azavax Date: Thu, 22 Aug 2024 18:59:07 +0330 Subject: [PATCH 07/27] Update install.sh --- install.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index b934e25..328c420 100644 --- a/install.sh +++ b/install.sh @@ -824,7 +824,9 @@ check_zip_password() { crypted=$( 7z l -slt -- $zip_file | grep -i -c "Encrypted = +" ) if [ "$crypted" -eq "1" ]; then return 1 + log "The ZIP file requires a password." else + log "The ZIP file requires a password." return 0 fi } @@ -864,12 +866,12 @@ extract_and_copy_archive() { case "$archive_file" in *.zip) - echo "Handling ZIP file." + print "Handling ZIP file." if check_zip_password "$archive_file"; then log "The ZIP file requires a password." input "Please enter the password for the ZIP file: " zip_password if ! unzip -P "$zip_password" "$archive_file" -d "$temp_dir" >/dev/null 2>&1; then - error "Error extracting ZIP file with the provided password." + error "Error extracting ZIP file with the provided password.Maybe password is incorrect." exit 1 fi @@ -880,9 +882,9 @@ extract_and_copy_archive() { fi ;; *.7z) - echo "Handling 7z file." + log "Handling 7z file..." if check_7z_password "$archive_file"; then - log "The 7z file requires a password." + log "The 7z file requires a password :)" input "Enter the password for the 7z file:" sevenz_password if ! 7z x -p"$sevenz_password" "$archive_file" -o"$temp_dir" >/dev/null 2>&1; then error "Failed to extract 7z file with the provided password." From 1c33dbad507ad343660e31c34a51079bbf0178ed Mon Sep 17 00:00:00 2001 From: Azavax Date: Thu, 22 Aug 2024 19:24:13 +0330 Subject: [PATCH 08/27] Update install.sh --- install.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/install.sh b/install.sh index 328c420..3111981 100644 --- a/install.sh +++ b/install.sh @@ -867,19 +867,15 @@ extract_and_copy_archive() { case "$archive_file" in *.zip) print "Handling ZIP file." - if check_zip_password "$archive_file"; then + if unzip "$archive_file" -d "$temp_dir" >/dev/null 2>&1;then + success "The ZIP file does not require a password." + else log "The ZIP file requires a password." input "Please enter the password for the ZIP file: " zip_password - if ! unzip -P "$zip_password" "$archive_file" -d "$temp_dir" >/dev/null 2>&1; then - error "Error extracting ZIP file with the provided password.Maybe password is incorrect." + unzip "$archive_file" -P "$zip_password" -d "$temp_dir" >/dev/null 2>&1 exit 1 fi - - else - success "The ZIP file does not require a password." - unzip "$archive_file" -d "$temp_dir" >/dev/null 2>&1 - fi ;; *.7z) log "Handling 7z file..." From 554171aa0e4f38f13c257b1a2bf79a6e7f524136 Mon Sep 17 00:00:00 2001 From: Azavax Date: Thu, 22 Aug 2024 21:20:58 +0330 Subject: [PATCH 09/27] Update install.sh --- install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 3111981..a1837b1 100644 --- a/install.sh +++ b/install.sh @@ -867,12 +867,12 @@ extract_and_copy_archive() { case "$archive_file" in *.zip) print "Handling ZIP file." - if unzip "$archive_file" -d "$temp_dir" >/dev/null 2>&1;then + if unzip "$archive_file" -d "$temp_dir" ;then success "The ZIP file does not require a password." - else + else log "The ZIP file requires a password." input "Please enter the password for the ZIP file: " zip_password - unzip "$archive_file" -P "$zip_password" -d "$temp_dir" >/dev/null 2>&1 + unzip "$archive_file" -P "$zip_password" -d "$temp_dir" exit 1 fi From ecaa38da49fa43477f277b9682d4abe9b68802a8 Mon Sep 17 00:00:00 2001 From: Azavax Date: Thu, 22 Aug 2024 21:28:38 +0330 Subject: [PATCH 10/27] Update install.sh --- install.sh | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/install.sh b/install.sh index a1837b1..4da308c 100644 --- a/install.sh +++ b/install.sh @@ -867,29 +867,23 @@ extract_and_copy_archive() { case "$archive_file" in *.zip) print "Handling ZIP file." - if unzip "$archive_file" -d "$temp_dir" ;then - success "The ZIP file does not require a password." + if unzip "$archive_file" -d "$temp_dir"; then + success "Unzipping completed successfully." else - log "The ZIP file requires a password." - input "Please enter the password for the ZIP file: " zip_password - unzip "$archive_file" -P "$zip_password" -d "$temp_dir" + error "Failed to unzip the file." >&2 exit 1 - fi + fi + ;; *.7z) log "Handling 7z file..." - if check_7z_password "$archive_file"; then - log "The 7z file requires a password :)" - input "Enter the password for the 7z file:" sevenz_password - if ! 7z x -p"$sevenz_password" "$archive_file" -o"$temp_dir" >/dev/null 2>&1; then - error "Failed to extract 7z file with the provided password." - exit 1 - fi + + if 7z x "$archive_file" -o"$temp_dir"; then + success "Unzipping completed successfully." else - success "The 7z file does not require a password." - 7z x "$archive_file" -o"$temp_dir" >/dev/null 2>&1 - + error "Failed to unzip the file." >&2 + exit 1 fi ;; *) From f147a6985506ec9c64d0b983ea1672bc759898cc Mon Sep 17 00:00:00 2001 From: Azavax Date: Thu, 22 Aug 2024 21:31:22 +0330 Subject: [PATCH 11/27] Update install.sh --- install.sh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/install.sh b/install.sh index 4da308c..86e721a 100644 --- a/install.sh +++ b/install.sh @@ -920,15 +920,18 @@ extract_and_copy_archive() { success "Files from $archive_file have been successfully extracted and copied." } remove_old_archives() { -read -p "Do you want to remove old archives? (y/n) " answer -local name=$1; -if [ "$answer" == "y" ]; then - log "removing old archives" - find /root/Restore/ -name "old-$name" -type d -exec rm -rf {} \; -else - log "skipping removal of old archives" - success "You can find the extracted files in /root/Restore/old-$name" -fi + print "" + print "—————————————————————————————————————————————————————————————————————————" + input -p "Do you want to remove old archives? (y/n) " answer + + local name=$1; + if [ "$answer" == "y" ]; then + log "removing old archives" + find /root/Restore/ -name "old-$name" -type d -exec rm -rf {} \; + else + log "skipping removal of old archives" + success "You can find the extracted files in /root/Restore/old-$name" + fi } From 044d19a4c9fc98ea882d7b9fd57563dd1eb13824 Mon Sep 17 00:00:00 2001 From: Azavax Date: Thu, 22 Aug 2024 21:36:56 +0330 Subject: [PATCH 12/27] Update install.sh --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 86e721a..f50747f 100644 --- a/install.sh +++ b/install.sh @@ -922,8 +922,8 @@ extract_and_copy_archive() { remove_old_archives() { print "" print "—————————————————————————————————————————————————————————————————————————" - input -p "Do you want to remove old archives? (y/n) " answer - + input "Do you want to remove old archives? (y/n) " answer + local name=$1; if [ "$answer" == "y" ]; then log "removing old archives" From 59eb851147edfced1a89b0bc988b2b5d4a435600 Mon Sep 17 00:00:00 2001 From: Azavax Date: Fri, 23 Aug 2024 11:41:54 +0330 Subject: [PATCH 13/27] Update install.sh --- install.sh | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/install.sh b/install.sh index f50747f..3574e7f 100644 --- a/install.sh +++ b/install.sh @@ -818,31 +818,6 @@ EOL #Restore backup restore_backup() { -#Check zip file requires a password or not -check_zip_password() { - local zip_file="$1" -crypted=$( 7z l -slt -- $zip_file | grep -i -c "Encrypted = +" ) -if [ "$crypted" -eq "1" ]; then - return 1 - log "The ZIP file requires a password." -else - log "The ZIP file requires a password." - return 0 -fi -} - -#Check 7z file requires a password or not -check_7z_password() { - local 7z_file="$1" - crypted=$( 7z l -slt -- $7z_file | grep -i -c "Encrypted = +" ) - if [ "$crypted" -eq "1" ]; then - return 1 - else - return 0 - fi - -} - # Function to extract and copy files from the archive to the correct system paths extract_and_copy_archive() { local archive_file="$1" @@ -873,8 +848,6 @@ extract_and_copy_archive() { error "Failed to unzip the file." >&2 exit 1 fi - - ;; *.7z) log "Handling 7z file..." @@ -922,8 +895,8 @@ extract_and_copy_archive() { remove_old_archives() { print "" print "—————————————————————————————————————————————————————————————————————————" - input "Do you want to remove old archives? (y/n) " answer - + print "" + input "Do you want to remove old archives? (y/n)(Default: n) :" answer local name=$1; if [ "$answer" == "y" ]; then log "removing old archives" @@ -948,6 +921,7 @@ restore_menu() { 1) input "Enter the path to the archive file (.zip or .7z): " archive_file extract_and_copy_archive "$archive_file" + marzban restart ;; 0) success "Thank you for using the Backup Utility. Goodbye!" @@ -972,5 +946,5 @@ run() { clear menu } -#hi + run \ No newline at end of file From c0f7ae729f6025d8f15bf3c48a16dd632dbbeb47 Mon Sep 17 00:00:00 2001 From: Azavax Date: Fri, 23 Aug 2024 15:17:03 +0330 Subject: [PATCH 14/27] Update install.sh --- install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install.sh b/install.sh index 3574e7f..cebce68 100644 --- a/install.sh +++ b/install.sh @@ -935,6 +935,7 @@ restore_menu() { } # Run the menu +check_needs restore_menu From dc371c3ed67c634b5042bb8b9daff05ad888beb7 Mon Sep 17 00:00:00 2001 From: Azavax Date: Fri, 23 Aug 2024 18:22:38 +0330 Subject: [PATCH 15/27] Update install.sh --- install.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index cebce68..1c724f0 100644 --- a/install.sh +++ b/install.sh @@ -817,7 +817,7 @@ EOL #Restore backup restore_backup() { - + # Function to extract and copy files from the archive to the correct system paths extract_and_copy_archive() { local archive_file="$1" @@ -849,7 +849,7 @@ extract_and_copy_archive() { exit 1 fi ;; - *.7z) + *.7z.*) log "Handling 7z file..." if 7z x "$archive_file" -o"$temp_dir"; then @@ -889,14 +889,14 @@ extract_and_copy_archive() { done # Remove temporary directory - remove_old_archives "$base_name" + success "Files from $archive_file have been successfully extracted and copied." } remove_old_archives() { print "" print "—————————————————————————————————————————————————————————————————————————" print "" - input "Do you want to remove old archives? (y/n)(Default: n) :" answer + input "Do you want to remove old archives? (yes/no)( Default: no ) : " answer local name=$1; if [ "$answer" == "y" ]; then log "removing old archives" @@ -935,7 +935,7 @@ restore_menu() { } # Run the menu -check_needs + check_needs restore_menu From d185dfb54d7fd5a9ff7aaf208a86f1574c55506b Mon Sep 17 00:00:00 2001 From: Azavax Date: Fri, 23 Aug 2024 19:13:03 +0330 Subject: [PATCH 16/27] Update install.sh --- install.sh | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 1c724f0..8f48df9 100644 --- a/install.sh +++ b/install.sh @@ -844,12 +844,13 @@ extract_and_copy_archive() { print "Handling ZIP file." if unzip "$archive_file" -d "$temp_dir"; then success "Unzipping completed successfully." + zip_file_copy else error "Failed to unzip the file." >&2 exit 1 fi ;; - *.7z.*) + *.7z.001) log "Handling 7z file..." if 7z x "$archive_file" -o"$temp_dir"; then @@ -872,6 +873,8 @@ extract_and_copy_archive() { exit 1 fi +zip_file_copy(){ + # Copy files from the temporary extraction directory to system paths log "Copying files from temporary directory to system paths..." cd "$temp_dir" || exit @@ -892,6 +895,61 @@ extract_and_copy_archive() { success "Files from $archive_file have been successfully extracted and copied." } + + +7zip_file_copy(){ + + local temp_dir="$1" # Temporary directory + local default_dirs=( + [".yml"]="/opt/marzban/" + [".env"]="/opt/marzban/" + [".sqlite3"]="/var/lib/marzban/" + [".json"]="/var/lib/marzban/" + ) + + # Ensure we are in the temporary directory + cd "$temp_dir" || { echo "Failed to access temporary directory."; exit 1; } + + for file in *; do + if [ -f "$file" ]; then + # Get the file extension + extension="${file##*.}" + case ".$extension" in + ".yml" | ".env" | ".sqlite3" | ".json") + default_dir="${default_dirs[.$extension]}" + ;; + *) + default_dir="" + ;; + esac + + # Ask user for target directory + if [ -n "$default_dir" ]; then + log "File '$file' has an extension of '.$extension'." + print "Default directory for this file is: $default_dir" + input -rp "Enter target directory (or press Enter to use default): " target_dir + target_dir="${target_dir:-$default_dir}" + else + input -rp "Enter target directory for file '$file': " target_dir + fi + + # Validate the target directory + if [ -n "$target_dir" ]; then + mkdir -p "$target_dir" # Create the directory if it doesn't exist + cp "$file" "$target_dir" + success "Copied '$file' to '$target_dir'." + else + error "No target directory specified for '$file'." + fi + fi + done + + success "Files have been successfully copied." + } + + + + } remove_old_archives() { print "" print "—————————————————————————————————————————————————————————————————————————" From 8553c498d30417b1a12bf9fca2f42490ee565d6e Mon Sep 17 00:00:00 2001 From: Azavax Date: Fri, 23 Aug 2024 19:23:29 +0330 Subject: [PATCH 17/27] Update install.sh --- install.sh | 140 +++++++++++++++++++++++++++-------------------------- 1 file changed, 72 insertions(+), 68 deletions(-) diff --git a/install.sh b/install.sh index 8f48df9..0a03301 100644 --- a/install.sh +++ b/install.sh @@ -844,7 +844,7 @@ extract_and_copy_archive() { print "Handling ZIP file." if unzip "$archive_file" -d "$temp_dir"; then success "Unzipping completed successfully." - zip_file_copy + zip_file_copy "$temp_dir" else error "Failed to unzip the file." >&2 exit 1 @@ -854,6 +854,7 @@ extract_and_copy_archive() { log "Handling 7z file..." if 7z x "$archive_file" -o"$temp_dir"; then + zip7_file_copy "$temp_dir" success "Unzipping completed successfully." else error "Failed to unzip the file." >&2 @@ -873,83 +874,84 @@ extract_and_copy_archive() { exit 1 fi -zip_file_copy(){ - - # Copy files from the temporary extraction directory to system paths - log "Copying files from temporary directory to system paths..." - cd "$temp_dir" || exit - find . -type f | while read -r file; do - target_path="/${file#./}" - log "Copying file: $file to $target_path" - mkdir -p "$(dirname "$target_path")" - cp "$file" "$target_path" - done - - find . -type d | while read -r dir; do - target_path="/${dir#./}" - log "Creating directory: $dir at $target_path" - mkdir -p "$target_path" - done + zip_file_copy(){ + # Copy files from the temporary extraction directory to system paths + log "Copying files from temporary directory to system paths..." + local temp_dir="$1" + cd "$temp_dir" || exit + find . -type f | while read -r file; do + target_path="/${file#./}" + log "Copying file: $file to $target_path" + mkdir -p "$(dirname "$target_path")" + cp "$file" "$target_path" + done - # Remove temporary directory + find . -type d | while read -r dir; do + target_path="/${dir#./}" + log "Creating directory: $dir at $target_path" + mkdir -p "$target_path" + done - success "Files from $archive_file have been successfully extracted and copied." -} + # Remove temporary directory + success "Files from $archive_file have been successfully extracted and copied." + } -7zip_file_copy(){ - local temp_dir="$1" # Temporary directory - local default_dirs=( - [".yml"]="/opt/marzban/" - [".env"]="/opt/marzban/" - [".sqlite3"]="/var/lib/marzban/" - [".json"]="/var/lib/marzban/" - ) - - # Ensure we are in the temporary directory - cd "$temp_dir" || { echo "Failed to access temporary directory."; exit 1; } - - for file in *; do - if [ -f "$file" ]; then - # Get the file extension - extension="${file##*.}" - case ".$extension" in - ".yml" | ".env" | ".sqlite3" | ".json") - default_dir="${default_dirs[.$extension]}" - ;; - *) - default_dir="" - ;; - esac - - # Ask user for target directory - if [ -n "$default_dir" ]; then - log "File '$file' has an extension of '.$extension'." - print "Default directory for this file is: $default_dir" - input -rp "Enter target directory (or press Enter to use default): " target_dir - target_dir="${target_dir:-$default_dir}" - else - input -rp "Enter target directory for file '$file': " target_dir - fi + zip7_file_copy(){ + local temp_dir="$1" # Temporary directory + local default_dirs=( + [".yml"]="/opt/marzban/" + [".env"]="/opt/marzban/" + [".sqlite3"]="/var/lib/marzban/" + [".json"]="/var/lib/marzban/" + ) + + # Ensure we are in the temporary directory + cd "$temp_dir" || { echo "Failed to access temporary directory."; exit 1; } + + for file in *; do + if [ -f "$file" ]; then + # Get the file extension + extension="${file##*.}" + case ".$extension" in + ".yml" | ".env" | ".sqlite3" | ".json") + default_dir="${default_dirs[.$extension]}" + ;; + *) + default_dir="" + ;; + esac + + # Ask user for target directory + if [ -n "$default_dir" ]; then + log "File '$file' has an extension of '.$extension'." + print "Default directory for this file is: $default_dir" + input -rp "Enter target directory (or press Enter to use default): " target_dir + target_dir="${target_dir:-$default_dir}" + else + input -rp "Enter target directory for file '$file': " target_dir + fi - # Validate the target directory - if [ -n "$target_dir" ]; then - mkdir -p "$target_dir" # Create the directory if it doesn't exist - cp "$file" "$target_dir" - success "Copied '$file' to '$target_dir'." - else - error "No target directory specified for '$file'." - fi - fi - done + # Validate the target directory + if [ -n "$target_dir" ]; then + mkdir -p "$target_dir" # Create the directory if it doesn't exist + cp "$file" "$target_dir" + success "Copied '$file' to '$target_dir'." + else + error "No target directory specified for '$file'." + fi + fi + done - success "Files have been successfully copied." + success "Files have been successfully copied." } - } + } + + remove_old_archives() { print "" print "—————————————————————————————————————————————————————————————————————————" @@ -965,7 +967,9 @@ remove_old_archives() { fi -} + } + + # Main function for the menu and extraction option restore_menu() { while true; do From 97d4843d03b29c8a03d3baa6bcb6bbe4f723110c Mon Sep 17 00:00:00 2001 From: Azavax Date: Fri, 23 Aug 2024 19:30:31 +0330 Subject: [PATCH 18/27] Update install.sh --- install.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 0a03301..ed689c2 100644 --- a/install.sh +++ b/install.sh @@ -844,7 +844,7 @@ extract_and_copy_archive() { print "Handling ZIP file." if unzip "$archive_file" -d "$temp_dir"; then success "Unzipping completed successfully." - zip_file_copy "$temp_dir" + zip_copy "$temp_dir" else error "Failed to unzip the file." >&2 exit 1 @@ -854,7 +854,7 @@ extract_and_copy_archive() { log "Handling 7z file..." if 7z x "$archive_file" -o"$temp_dir"; then - zip7_file_copy "$temp_dir" + seven_zip_copy "$temp_dir" success "Unzipping completed successfully." else error "Failed to unzip the file." >&2 @@ -874,7 +874,7 @@ extract_and_copy_archive() { exit 1 fi - zip_file_copy(){ + zip_copy(){ # Copy files from the temporary extraction directory to system paths log "Copying files from temporary directory to system paths..." local temp_dir="$1" @@ -898,7 +898,7 @@ extract_and_copy_archive() { } - zip7_file_copy(){ + seven_zip_copy(){ local temp_dir="$1" # Temporary directory local default_dirs=( [".yml"]="/opt/marzban/" From f2ad8be2bfd3442d2788b839be312fb85d59cf53 Mon Sep 17 00:00:00 2001 From: Azavax Date: Fri, 23 Aug 2024 19:36:42 +0330 Subject: [PATCH 19/27] Update install.sh --- install.sh | 121 ++++++++++++++++++++++++++--------------------------- 1 file changed, 60 insertions(+), 61 deletions(-) diff --git a/install.sh b/install.sh index ed689c2..64719ef 100644 --- a/install.sh +++ b/install.sh @@ -1,5 +1,4 @@ #!/bin/bash - colors=( "\033[1;31m" "\033[1;35m" "\033[1;92m" "\033[38;5;46m" "\033[1;38;5;208m" "\033[1;36m" "\033[0m" ) red=${colors[0]} pink=${colors[1]} green=${colors[2]} spring=${colors[3]} orange=${colors[4]} cyan=${colors[5]} reset=${colors[6]} print() { echo -e "${cyan}$1${reset}"; } @@ -817,63 +816,6 @@ EOL #Restore backup restore_backup() { - -# Function to extract and copy files from the archive to the correct system paths -extract_and_copy_archive() { - local archive_file="$1" - local base_name - local temp_dir - local sevenz_password - local zip_password - - # Extract base name without extension - base_name=$(basename "$archive_file" | sed 's/\.[^.]*$//') - temp_dir="/root/Restore/old-$base_name" - - # Ensure temp directory is clean - rm -rf "$temp_dir" - mkdir -p "$temp_dir" - - if [ ! -f "$archive_file" ]; then - error "File $archive_file does not exist." - exit 1 - fi - - case "$archive_file" in - *.zip) - print "Handling ZIP file." - if unzip "$archive_file" -d "$temp_dir"; then - success "Unzipping completed successfully." - zip_copy "$temp_dir" - else - error "Failed to unzip the file." >&2 - exit 1 - fi - ;; - *.7z.001) - log "Handling 7z file..." - - if 7z x "$archive_file" -o"$temp_dir"; then - seven_zip_copy "$temp_dir" - success "Unzipping completed successfully." - else - error "Failed to unzip the file." >&2 - exit 1 - fi - ;; - *) - error "Unsupported file format. Please provide a ZIP or 7z file." - rm -rf "$temp_dir" - exit 1 - ;; - esac - - if [ $? -ne 0 ]; then - echo "Failed to extract $archive_file. Please check the password and try again." - rm -rf "$temp_dir" - exit 1 - fi - zip_copy(){ # Copy files from the temporary extraction directory to system paths log "Copying files from temporary directory to system paths..." @@ -946,15 +888,72 @@ extract_and_copy_archive() { success "Files have been successfully copied." } - +# Function to extract and copy files from the archive to the correct system paths +extract_and_copy_archive() { + local archive_file="$1" + local base_name + local temp_dir + local sevenz_password + local zip_password + + # Extract base name without extension + base_name=$(basename "$archive_file" | sed 's/\.[^.]*$//') + temp_dir="/root/Restore/old-$base_name" + + # Ensure temp directory is clean + rm -rf "$temp_dir" + mkdir -p "$temp_dir" + + if [ ! -f "$archive_file" ]; then + error "File $archive_file does not exist." + exit 1 + fi + + case "$archive_file" in + *.zip) + print "Handling ZIP file." + if unzip "$archive_file" -d "$temp_dir"; then + success "Unzipping completed successfully." + zip_copy "$temp_dir" + else + error "Failed to unzip the file." >&2 + exit 1 + fi + ;; + *.7z.001) + log "Handling 7z file..." - } + if 7z x "$archive_file" -o"$temp_dir"; then + seven_zip_copy "$temp_dir" + success "Unzipping completed successfully." + else + error "Failed to unzip the file." >&2 + exit 1 + fi + ;; + *) + error "Unsupported file format. Please provide a ZIP or 7z file." + rm -rf "$temp_dir" + exit 1 + ;; + esac + + if [ $? -ne 0 ]; then + echo "Failed to extract $archive_file. Please check the password and try again." + rm -rf "$temp_dir" + exit 1 + fi + + + + + } remove_old_archives() { print "" - print "—————————————————————————————————————————————————————————————————————————" + print "—————————————————————————————v1————————————————————————————————————————————" print "" input "Do you want to remove old archives? (yes/no)( Default: no ) : " answer local name=$1; From e00e76fd39d32419d91b024feb4931155c3d4acc Mon Sep 17 00:00:00 2001 From: Azavax Date: Fri, 23 Aug 2024 19:37:53 +0330 Subject: [PATCH 20/27] Update install.sh --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 64719ef..560a270 100644 --- a/install.sh +++ b/install.sh @@ -100,7 +100,7 @@ check_needs() { menu() { while true; do print "\n\t Welcome to Backuper!" - print "\t\t version 0.2.0 by @ErfJab" + print "\t\t version x.3.0 by @ErfJab" print "—————————————————————————————————————————————————————————————————————————" print "1) Install" print "2) Manage" @@ -953,7 +953,7 @@ extract_and_copy_archive() { remove_old_archives() { print "" - print "—————————————————————————————v1————————————————————————————————————————————" + print "————————————————————————————————————————————————————————————————————————" print "" input "Do you want to remove old archives? (yes/no)( Default: no ) : " answer local name=$1; From 950789df7bd36161e595e4de19558d83161d7335 Mon Sep 17 00:00:00 2001 From: Azavax Date: Fri, 23 Aug 2024 19:44:50 +0330 Subject: [PATCH 21/27] Update install.sh --- install.sh | 109 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 61 insertions(+), 48 deletions(-) diff --git a/install.sh b/install.sh index 560a270..8c49352 100644 --- a/install.sh +++ b/install.sh @@ -100,7 +100,7 @@ check_needs() { menu() { while true; do print "\n\t Welcome to Backuper!" - print "\t\t version x.3.0 by @ErfJab" + print "\t\t version x.4.0 by @ErfJab" print "—————————————————————————————————————————————————————————————————————————" print "1) Install" print "2) Manage" @@ -816,6 +816,7 @@ EOL #Restore backup restore_backup() { + zip_copy(){ # Copy files from the temporary extraction directory to system paths log "Copying files from temporary directory to system paths..." @@ -840,54 +841,64 @@ restore_backup() { } - seven_zip_copy(){ - local temp_dir="$1" # Temporary directory - local default_dirs=( - [".yml"]="/opt/marzban/" - [".env"]="/opt/marzban/" - [".sqlite3"]="/var/lib/marzban/" - [".json"]="/var/lib/marzban/" - ) - - # Ensure we are in the temporary directory - cd "$temp_dir" || { echo "Failed to access temporary directory."; exit 1; } - - for file in *; do - if [ -f "$file" ]; then - # Get the file extension - extension="${file##*.}" - case ".$extension" in - ".yml" | ".env" | ".sqlite3" | ".json") - default_dir="${default_dirs[.$extension]}" - ;; - *) - default_dir="" - ;; - esac - - # Ask user for target directory - if [ -n "$default_dir" ]; then - log "File '$file' has an extension of '.$extension'." - print "Default directory for this file is: $default_dir" - input -rp "Enter target directory (or press Enter to use default): " target_dir - target_dir="${target_dir:-$default_dir}" - else - input -rp "Enter target directory for file '$file': " target_dir - fi +seven_zip_copy(){ + local temp_dir="$1" # Temporary directory + + # Define default directories based on file extension + local default_yml_dir="/opt/marzban/" + local default_env_dir="/opt/marzban/" + local default_sqlite3_dir="/var/lib/marzban/" + local default_json_dir="/var/lib/marzban/" + + # Ensure we are in the temporary directory + cd "$temp_dir" || { echo "Failed to access temporary directory."; exit 1; } + + for file in *; do + if [ -f "$file" ]; then + # Get the file extension + extension="${file##*.}" + case ".$extension" in + ".yml") + default_dir="$default_yml_dir" + ;; + ".env") + default_dir="$default_env_dir" + ;; + ".sqlite3") + default_dir="$default_sqlite3_dir" + ;; + ".json") + default_dir="$default_json_dir" + ;; + *) + default_dir="" + ;; + esac + + # Ask user for target directory + if [ -n "$default_dir" ]; then + echo "File '$file' has an extension of '.$extension'." + echo "Default directory for this file is: $default_dir" + read -rp "Enter target directory (or press Enter to use default): " target_dir + target_dir="${target_dir:-$default_dir}" + else + read -rp "Enter target directory for file '$file': " target_dir + fi - # Validate the target directory - if [ -n "$target_dir" ]; then - mkdir -p "$target_dir" # Create the directory if it doesn't exist - cp "$file" "$target_dir" - success "Copied '$file' to '$target_dir'." - else - error "No target directory specified for '$file'." - fi - fi - done + # Validate the target directory + if [ -n "$target_dir" ]; then + mkdir -p "$target_dir" # Create the directory if it doesn't exist + cp "$file" "$target_dir" + echo "Copied '$file' to '$target_dir'." + else + echo "No target directory specified for '$file'." + fi + fi + done + + echo "Files have been successfully copied." +} - success "Files have been successfully copied." - } # Function to extract and copy files from the archive to the correct system paths extract_and_copy_archive() { @@ -925,7 +936,9 @@ extract_and_copy_archive() { log "Handling 7z file..." if 7z x "$archive_file" -o"$temp_dir"; then + seven_zip_copy "$temp_dir" + success "Unzipping completed successfully." else error "Failed to unzip the file." >&2 @@ -998,7 +1011,7 @@ restore_menu() { # Run the menu check_needs restore_menu - +remove_old_archives } From d3b96d3cf94a350d9541c475718309ef4e103a9e Mon Sep 17 00:00:00 2001 From: Azavax Date: Fri, 23 Aug 2024 20:01:35 +0330 Subject: [PATCH 22/27] Update install.sh --- install.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/install.sh b/install.sh index 8c49352..68090d2 100644 --- a/install.sh +++ b/install.sh @@ -873,30 +873,31 @@ seven_zip_copy(){ *) default_dir="" ;; - esac + esacs # Ask user for target directory if [ -n "$default_dir" ]; then - echo "File '$file' has an extension of '.$extension'." - echo "Default directory for this file is: $default_dir" - read -rp "Enter target directory (or press Enter to use default): " target_dir + log "_____________________________________________________" + print "File '$file' has an extension of '.$extension'." + log "Default directory for this file is: $default_dir" + input -rp "Enter target directory (or press Enter to use default): " target_dir target_dir="${target_dir:-$default_dir}" else - read -rp "Enter target directory for file '$file': " target_dir + input -rp "Enter target directory for file '$file': " target_dir fi # Validate the target directory if [ -n "$target_dir" ]; then mkdir -p "$target_dir" # Create the directory if it doesn't exist cp "$file" "$target_dir" - echo "Copied '$file' to '$target_dir'." + success "Copied '$file' to '$target_dir'." else - echo "No target directory specified for '$file'." + error "No target directory specified for '$file'." fi fi done - echo "Files have been successfully copied." + success "Files have been successfully copied." } From 8ae8bca7d19f6920a3799c53fb051821c13f3822 Mon Sep 17 00:00:00 2001 From: Azavax Date: Fri, 23 Aug 2024 20:02:08 +0330 Subject: [PATCH 23/27] Update install.sh --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 68090d2..b5300b8 100644 --- a/install.sh +++ b/install.sh @@ -100,7 +100,7 @@ check_needs() { menu() { while true; do print "\n\t Welcome to Backuper!" - print "\t\t version x.4.0 by @ErfJab" + print "\t\t version x.5.0 by @ErfJab" print "—————————————————————————————————————————————————————————————————————————" print "1) Install" print "2) Manage" From e353c2bc9ef7d9f349f32d49764c0123077d93fd Mon Sep 17 00:00:00 2001 From: Azavax Date: Fri, 23 Aug 2024 20:07:02 +0330 Subject: [PATCH 24/27] Update install.sh --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index b5300b8..dd08c93 100644 --- a/install.sh +++ b/install.sh @@ -873,7 +873,7 @@ seven_zip_copy(){ *) default_dir="" ;; - esacs + esac # Ask user for target directory if [ -n "$default_dir" ]; then From c2813a9a0b9525e8ab4685a37d0769f282ed08fc Mon Sep 17 00:00:00 2001 From: Azavax Date: Fri, 23 Aug 2024 20:13:42 +0330 Subject: [PATCH 25/27] Update install.sh --- install.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index dd08c93..1ff90e0 100644 --- a/install.sh +++ b/install.sh @@ -100,7 +100,7 @@ check_needs() { menu() { while true; do print "\n\t Welcome to Backuper!" - print "\t\t version x.5.0 by @ErfJab" + print "\t\t version x.6.0 by @ErfJab" print "—————————————————————————————————————————————————————————————————————————" print "1) Install" print "2) Manage" @@ -880,10 +880,10 @@ seven_zip_copy(){ log "_____________________________________________________" print "File '$file' has an extension of '.$extension'." log "Default directory for this file is: $default_dir" - input -rp "Enter target directory (or press Enter to use default): " target_dir + input "Enter target directory (or press Enter to use default): " target_dir target_dir="${target_dir:-$default_dir}" else - input -rp "Enter target directory for file '$file': " target_dir + input "Enter target directory for file '$file': " target_dir fi # Validate the target directory @@ -896,7 +896,8 @@ seven_zip_copy(){ fi fi done - + print "" + print "" success "Files have been successfully copied." } From d93f79c64c92ee7f3ac1ca0ef0acf9574a503553 Mon Sep 17 00:00:00 2001 From: Azavax Date: Fri, 23 Aug 2024 20:21:45 +0330 Subject: [PATCH 26/27] Update install.sh --- install.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 1ff90e0..0acc3f8 100644 --- a/install.sh +++ b/install.sh @@ -100,7 +100,7 @@ check_needs() { menu() { while true; do print "\n\t Welcome to Backuper!" - print "\t\t version x.6.0 by @ErfJab" + print "\t\t version 0.2.0 by @ErfJab" print "—————————————————————————————————————————————————————————————————————————" print "1) Install" print "2) Manage" @@ -938,10 +938,9 @@ extract_and_copy_archive() { log "Handling 7z file..." if 7z x "$archive_file" -o"$temp_dir"; then - + success "Unzipping completed successfully." seven_zip_copy "$temp_dir" - success "Unzipping completed successfully." else error "Failed to unzip the file." >&2 exit 1 From eb161ee073293591710c5ff7a7498d446e6b3731 Mon Sep 17 00:00:00 2001 From: Azavax Date: Fri, 23 Aug 2024 20:23:07 +0330 Subject: [PATCH 27/27] Update install.sh --- install.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 0acc3f8..3e58342 100644 --- a/install.sh +++ b/install.sh @@ -996,7 +996,6 @@ restore_menu() { 1) input "Enter the path to the archive file (.zip or .7z): " archive_file extract_and_copy_archive "$archive_file" - marzban restart ;; 0) success "Thank you for using the Backup Utility. Goodbye!" @@ -1013,7 +1012,7 @@ restore_menu() { check_needs restore_menu remove_old_archives - +marzban restart }