mirror of
https://github.com/nextcloud/vm.git
synced 2025-10-26 11:27:32 +00:00
add reboot if set when updating the update script
This commit is contained in:
parent
3391b71cb1
commit
d2e320cab7
@ -47,6 +47,8 @@ case "$choice" in
|
||||
"Update Nextcloud major")
|
||||
if [ -f "$SCRIPTS"/update.sh ]
|
||||
then
|
||||
# Check if automated updates are set
|
||||
REBOOT_SET=$(grep -rc "shutdown -r" "$SCRIPTS"/update.sh)
|
||||
# Check if it's older than 60 days (60 seconds * 60 minutes * 24 hours * 60 days)
|
||||
if [ "$(stat --format=%Y "$SCRIPTS"/update.sh)" -le "$(( $(date +%s) - ((60*60*24*60)) ))" ]
|
||||
then
|
||||
@ -54,8 +56,14 @@ case "$choice" in
|
||||
then
|
||||
print_text_in_color "$ICyan" "Downloading the latest update script..."
|
||||
download_script STATIC update
|
||||
if [ -n "$REBOOT_SET" ]
|
||||
then
|
||||
sed -i "s|exit|/sbin/shutdown -r +1|g" "$SCRIPTS"/update.sh
|
||||
fi
|
||||
chmod +x "$SCRIPTS"/update.sh
|
||||
bash "$SCRIPTS"/update.sh
|
||||
else
|
||||
bash "$SCRIPTS"/update.sh
|
||||
fi
|
||||
else
|
||||
bash "$SCRIPTS"/update.sh
|
||||
@ -70,6 +78,8 @@ case "$choice" in
|
||||
"Update Nextcloud minor")
|
||||
if [ -f "$SCRIPTS"/update.sh ]
|
||||
then
|
||||
# Check if automated updates are set
|
||||
REBOOT_SET=$(grep -rc "shutdown -r" "$SCRIPTS"/update.sh)
|
||||
# Check if it's older than 60 days (60 seconds * 60 minutes * 24 hours * 60 days)
|
||||
if [ "$(stat --format=%Y "$SCRIPTS"/update.sh)" -le "$(( $(date +%s) - ((60*60*24*60)) ))" ]
|
||||
then
|
||||
@ -77,8 +87,14 @@ case "$choice" in
|
||||
then
|
||||
print_text_in_color "$ICyan" "Downloading the latest update script..."
|
||||
download_script STATIC update
|
||||
if [ -n "$REBOOT_SET" ]
|
||||
then
|
||||
sed -i "s|exit|/sbin/shutdown -r +1|g" "$SCRIPTS"/update.sh
|
||||
fi
|
||||
chmod +x "$SCRIPTS"/update.sh
|
||||
bash "$SCRIPTS"/update.sh minor
|
||||
else
|
||||
bash "$SCRIPTS"/update.sh minor
|
||||
fi
|
||||
else
|
||||
bash "$SCRIPTS"/update.sh minor
|
||||
|
||||
Loading…
Reference in New Issue
Block a user