vm/static/nextcloud_configuration.sh
2020-02-03 18:15:27 +01:00

61 lines
2.3 KiB
Bash

#!/bin/bash
# T&M Hansson IT AB © - 2020, https://www.hanssonit.se/
# shellcheck disable=2034,2059
true
# shellcheck source=lib.sh
. <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh)
# Check for errors + debug code and abort if something isn't right
# 1 = ON
# 0 = OFF
DEBUG=0
debug_mode
# Must be root
root_check
# Configure Nextcloud
choice=$(whiptail --title "Nextcloud Configuration" --checklist "Which settings do you want to configure?\nSelect by pressing the spacebar" "$WT_HEIGHT" "$WT_WIDTH" 4 \
"CookieLifetime" "(Configure forced logout timeout for users using the web GUI)" OFF \
"Share-folder" "(Shares from other users will appear in a folder named 'Shared')" OFF \
"Disable workspaces" "(disable top notes in GUI)" OFF 3>&1 1>&2 2>&3)
case "$choice" in
*"CookieLifetime"*)
run_static_script cookielifetime
;;&
*"Share-folder"*)
clear
msg_box "This option will make all Nextcloud shares from other users appear in a folder named 'Shared' in the Nextcloud GUI.\n\nIf you don't enable this option, all shares will appear directly in the Nextcloud GUI root folder, which is the default behaviour."
if [[ "yes" == $(ask_yes_or_no "Do you want to enable this option?") ]]
then
occ_command config:system:set share_folder --value="/Shared"
msg_box "All new Nextcloud shares from other users will appear in the 'Shared' folder from now on."
fi
;;&
*"Disable workspaces"*)
msg_box "This option will will disable a feature named 'rich workspaces'. It will disable the top notes in GUI."
if [[ "yes" == $(ask_yes_or_no "Do you want to disable rich workspaces?") ]]
then
# Install jq if not already installed
install_if_not jq
# Check if text is enabled
if ! occ_command app:list --output=json | jq -e '.enabled | .text' > /dev/null
then
msg_box "The text app isn't enabled - unable to disable rich workspaces."
sleep 1
else
# Disable workspaces
occ_command config:app:set text workspace_available --value=0
msg_box "Rich workspaces are now disabled."
fi
fi
;;&
*)
;;
esac
exit