Skip to content

Commit fa5115d

Browse files
authored
new nextcloud_configuration.sh (#1077)
1 parent b85c42d commit fa5115d

4 files changed

+94
-6
lines changed

nextcloud-startup-script.sh

+5-6
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ download_static_script change_db_pass
241241
download_static_script nextcloud
242242
download_static_script update-config
243243
download_static_script apps
244+
download_static_script configuration
244245
download_le_script activate-ssl
245246
if home_sme_server
246247
then
@@ -377,8 +378,7 @@ clear
377378
choice=$(whiptail --title "Extra configurations" --checklist "Choose what you want to configure\nSelect by pressing the spacebar" "$WT_HEIGHT" "$WT_WIDTH" 4 \
378379
"Security" "(Add extra security based on this http://goo.gl/gEJHi7)" OFF \
379380
"Static IP" "(Set static IP in Ubuntu with netplan.io)" OFF \
380-
"Automatic updates" "(Automatically update your server every week on Sundays)" OFF \
381-
"CookieLifetime" "(Configure forced logout timeout for users using the web GUI)" OFF 3>&1 1>&2 2>&3)
381+
"Automatic updates" "(Automatically update your server every week on Sundays)" OFF 3>&1 1>&2 2>&3)
382382

383383
case *"$choice" in
384384
*"Security"*)
@@ -394,10 +394,6 @@ case *"$choice" in
394394
clear
395395
run_static_script automatic_updates
396396
;;&
397-
*"CookieLifetime"*)
398-
clear
399-
run_static_script cookielifetime
400-
;;&
401397
*)
402398
;;
403399
esac
@@ -422,6 +418,9 @@ else
422418
fi
423419
clear
424420

421+
# Nextcloud configuration
422+
bash $SCRIPTS/configuration.sh
423+
425424
# Install apps
426425
bash $SCRIPTS/apps.sh
427426

static/change-root-profile.sh

+1
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,6 @@ ROOT-PROFILE
4646
echo "alias nextcloud_occ='sudo -u www-data php $NCPATH/occ'"
4747
echo "alias run_update_nextcloud='bash $SCRIPTS/update.sh'"
4848
echo "alias additional_apps='bash $SCRIPTS/apps.sh'"
49+
echo "alias nextcloud_configuration='bash $SCRIPTS/configuration.sh'"
4950
} > /root/.bash_aliases
5051

static/configuration.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
mkdir -p "$SCRIPTS"
20+
print_text_in_color "$ICyan" "Running the nextcloud configuration script..."
21+
22+
if network_ok
23+
then
24+
# Delete, download, run
25+
run_static_script nextcloud_configuration
26+
fi
27+
28+
exit

static/nextcloud_configuration.sh

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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

Comments
 (0)