|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# T&M Hansson IT AB © - 2020, https://www.hanssonit.se/ |
| 4 | + |
| 5 | +# shellcheck disable=2034,2059 |
| 6 | +true |
| 7 | +# shellcheck source=lib.sh |
| 8 | +. <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh) |
| 9 | + |
| 10 | +# Check for errors + debug code and abort if something isn't right |
| 11 | +# 1 = ON |
| 12 | +# 0 = OFF |
| 13 | +DEBUG=0 |
| 14 | +debug_mode |
| 15 | + |
| 16 | +# Must be root |
| 17 | +root_check |
| 18 | + |
| 19 | +# Configure Nextcloud |
| 20 | +choice=$(whiptail --title "Nextcloud Configuration" --checklist "Which settings do you want to configure?\nSelect by pressing the spacebar" "$WT_HEIGHT" "$WT_WIDTH" 4 \ |
| 21 | +"CookieLifetime" "(Configure forced logout timeout for users using the web GUI)" OFF \ |
| 22 | +"Share-folder" "(Shares from other users will appear in a folder named 'Shared')" OFF \ |
| 23 | +"Disable workspaces" "(disable top notes in GUI)" OFF 3>&1 1>&2 2>&3) |
| 24 | + |
| 25 | +case "$choice" in |
| 26 | + *"CookieLifetime"*) |
| 27 | + run_static_script cookielifetime |
| 28 | + ;;& |
| 29 | + *"Share-folder"*) |
| 30 | + clear |
| 31 | + 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." |
| 32 | + if [[ "yes" == $(ask_yes_or_no "Do you want to enable this option?") ]] |
| 33 | + then |
| 34 | + occ_command config:system:set share_folder --value="/Shared" |
| 35 | + msg_box "All new Nextcloud shares from other users will appear in the 'Shared' folder from now on." |
| 36 | + fi |
| 37 | + ;;& |
| 38 | + *"Disable workspaces"*) |
| 39 | + msg_box "This option will will disable a feature named 'rich workspaces'. It will disable the top notes in GUI." |
| 40 | + if [[ "yes" == $(ask_yes_or_no "Do you want to disable rich workspaces?") ]] |
| 41 | + then |
| 42 | + # Install jq if not already installed |
| 43 | + install_if_not jq |
| 44 | + # Check if text is enabled |
| 45 | + if ! occ_command app:list --output=json | jq -e '.enabled | .text' > /dev/null |
| 46 | + then |
| 47 | + msg_box "The text app isn't enabled - unable to disable rich workspaces." |
| 48 | + sleep 1 |
| 49 | + else |
| 50 | + # Disable workspaces |
| 51 | + occ_command config:app:set text workspace_available --value=0 |
| 52 | + msg_box "Rich workspaces are now disabled." |
| 53 | + fi |
| 54 | + |
| 55 | + fi |
| 56 | + ;;& |
| 57 | + *) |
| 58 | + ;; |
| 59 | +esac |
| 60 | +exit |
0 commit comments