Skip to content

Commit

Permalink
a few veracrypt enhancements (nextcloud#2389)
Browse files Browse the repository at this point in the history
* a few veracrypt enhancements

Signed-off-by: szaimen <[email protected]>

* Don't update existing installs as it is to risky

Signed-off-by: szaimen <[email protected]>

Signed-off-by: szaimen <[email protected]>
Co-authored-by: Daniel Hansson <[email protected]>
  • Loading branch information
szaimen and enoch85 authored Nov 2, 2022
1 parent fd3810b commit 2d48225
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion not-supported/restore-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ Before=network.target
[Service]
Type=forking
ExecStart=/bin/bash $SCRIPTS/veracrypt-automount.sh
ExecStart=-/bin/bash $SCRIPTS/veracrypt-automount.sh
TimeoutStopSec=1
[Install]
Expand Down
15 changes: 8 additions & 7 deletions not-supported/veracrypt-btrfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -297,24 +300,22 @@ 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
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..."
Expand Down
16 changes: 8 additions & 8 deletions not-supported/veracrypt-ntfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -275,25 +278,22 @@ 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
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.
Expand Down

0 comments on commit 2d48225

Please sign in to comment.