Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/vm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorszaimen <szaimen@e.mail.de>2022-08-30 15:34:40 +0300
committerszaimen <szaimen@e.mail.de>2022-08-30 15:37:17 +0300
commit5a76b4e8f66c847d8374b80dd7094adc1cfa9034 (patch)
treef4aa94214afa0ab2e5d4cf09ceedff412b307aac
parent1f2f619d7516dfa291febc6bbcb23ef90ca88461 (diff)
a few veracrypt enhancementsfix/2259/veracrypt-upgrades
Signed-off-by: szaimen <szaimen@e.mail.de>
-rw-r--r--not-supported/borgbackup.sh16
-rw-r--r--not-supported/restore-backup.sh2
-rw-r--r--not-supported/veracrypt-btrfs.sh15
-rw-r--r--not-supported/veracrypt-ntfs.sh16
4 files changed, 33 insertions, 16 deletions
diff --git a/not-supported/borgbackup.sh b/not-supported/borgbackup.sh
index 2330a031..0dcc516c 100644
--- a/not-supported/borgbackup.sh
+++ b/not-supported/borgbackup.sh
@@ -569,6 +569,22 @@ Please don't restart or shutdown your server until then!"
get_expiration_time
inform_user "$IGreen" "Backup finished on $END_DATE_READABLE ($DURATION_READABLE)"
+ # Modify some things to the better
+ if [ -f "$SCRIPTS/veracrypt-automount.sh" ]
+ then
+ sed -i "s|You can disable it after the drive is successfully mounted again!|A reboot should fix the issue if the drive is successfully connected again.|" "$SCRIPTS/veracrypt-automount.sh"
+ if ! grep -q "Reset maintenance mode to disabled upon restart" "$SCRIPTS/veracrypt-automount.sh"
+ then
+ sed -i "s|^# Veracrypt entries$|sed -i \"/'maintenance'/s/true/false/\" \"$NCPATH/config/config.php\"|" "$SCRIPTS/veracrypt-automount.sh"
+ fi
+ if ! grep -q "ExecStart=-/bin/bash $SCRIPTS/veracrypt-automount.sh" /etc/systemd/system/veracrypt-automount.service
+ then
+ sed -i "s|ExecStart=/bin/bash $SCRIPTS/veracrypt-automount.sh|ExecStart=-/bin/bash $SCRIPTS/veracrypt-automount.sh|" /etc/systemd/system/veracrypt-automount.service
+ systemctl disable veracrypt-automount &>/dev/null
+ systemctl enable veracrypt-automount
+ fi
+ fi
+
# Send mail about successful backup
if ! send_mail "Daily backup successful!" "$(cat "$LOG_FILE")"
then
diff --git a/not-supported/restore-backup.sh b/not-supported/restore-backup.sh
index af26f07b..b139ef5b 100644
--- a/not-supported/restore-backup.sh
+++ b/not-supported/restore-backup.sh
@@ -576,7 +576,7 @@ Before=network.target
[Service]
Type=forking
-ExecStart=/bin/bash $SCRIPTS/veracrypt-automount.sh
+ExecStart=-/bin/bash $SCRIPTS/veracrypt-automount.sh
TimeoutStopSec=1
[Install]
diff --git a/not-supported/veracrypt-btrfs.sh b/not-supported/veracrypt-btrfs.sh
index 01ca9c8a..f006a195 100644
--- a/not-supported/veracrypt-btrfs.sh
+++ b/not-supported/veracrypt-btrfs.sh
@@ -209,6 +209,9 @@ then
chown root:root "$SCRIPTS/veracrypt-automount.sh"
chmod 700 "$SCRIPTS/veracrypt-automount.sh"
+# Reset maintenance mode to disabled upon restart
+sed -i "/'maintenance'/s/true/false/" "$NCPATH/config/config.php"
+
# Veracrypt entries
AUTOMOUNT
fi
@@ -259,7 +262,7 @@ else
fi
send_mail "One veracrypt drive is not connected anymore!" "Please connect the drive and reboot your server!
The maintenance mode was activated to prevent any issue with Nextcloud.
-You can disable it after the drive is successfully mounted again!"
+A reboot should fix the issue if the drive is successfully connected again."
CONNECTED
# Secure the file
@@ -297,9 +300,7 @@ crontab -u root -l | { cat; echo "@reboot $SCRIPTS/adjust-startup-permissions.sh
# Delete crontab
crontab -u root -l | grep -v 'veracrypt-automount.sh' | crontab -u root -
# Create service instead
-if ! [ -f /etc/systemd/system/veracrypt-automount.service ]
-then
- cat << SERVICE > /etc/systemd/system/veracrypt-automount.service
+cat << SERVICE > /etc/systemd/system/veracrypt-automount.service
[Unit]
Description=Mount Veracrypt Devices
After=boot.mount
@@ -307,14 +308,14 @@ Before=network.target
[Service]
Type=forking
-ExecStart=/bin/bash $SCRIPTS/veracrypt-automount.sh
+ExecStart=-/bin/bash $SCRIPTS/veracrypt-automount.sh
TimeoutStopSec=1
[Install]
WantedBy=multi-user.target
SERVICE
- systemctl enable veracrypt-automount
-fi
+systemctl disable veracrypt-automount &>/dev/null
+systemctl enable veracrypt-automount
# Adjust permissions
print_text_in_color "$ICyan" "Adjusting permissions..."
diff --git a/not-supported/veracrypt-ntfs.sh b/not-supported/veracrypt-ntfs.sh
index 1cfe031b..fc65ac4d 100644
--- a/not-supported/veracrypt-ntfs.sh
+++ b/not-supported/veracrypt-ntfs.sh
@@ -210,6 +210,9 @@ then
chown root:root "$SCRIPTS/veracrypt-automount.sh"
chmod 700 "$SCRIPTS/veracrypt-automount.sh"
+# Reset maintenance mode to disabled upon restart
+sed -i "/'maintenance'/s/true/false/" "$NCPATH/config/config.php"
+
# Veracrypt entries
AUTOMOUNT
fi
@@ -225,7 +228,7 @@ then
nextcloud_occ_no_check maintenance:mode --on
send_mail "$MOUNT_PATH could not get mounted!" "Please connect the drive and reboot your server! \
The maintenance mode was activated to prevent any issue with Nextcloud. \
-You can disable it after the drive is successfully mounted again!"
+A reboot should fix the issue if the drive is successfully connected again."
fi
AUTOMOUNT
@@ -275,9 +278,7 @@ nohup bash "$SCRIPTS/is-drive-connected.sh" "$PARTUUID" &>/dev/null &
# Delete crontab
crontab -u root -l | grep -v 'veracrypt-automount.sh' | crontab -u root -
# Create service instead
-if ! [ -f /etc/systemd/system/veracrypt-automount.service ]
-then
- cat << SERVICE > /etc/systemd/system/veracrypt-automount.service
+cat << SERVICE > /etc/systemd/system/veracrypt-automount.service
[Unit]
Description=Mount Veracrypt Devices
After=boot.mount
@@ -285,15 +286,14 @@ Before=network.target
[Service]
Type=forking
-ExecStart=/bin/bash $SCRIPTS/veracrypt-automount.sh
+ExecStart=-/bin/bash $SCRIPTS/veracrypt-automount.sh
TimeoutStopSec=1
[Install]
WantedBy=multi-user.target
SERVICE
- systemctl enable veracrypt-automount
-fi
-
+systemctl disable veracrypt-automount &>/dev/null
+systemctl enable veracrypt-automount
# Inform the user
msg_box "Congratulations! The mount was successful.