mirror of
https://github.com/nextcloud/vm.git
synced 2025-10-26 11:27:32 +00:00
Make Webmin optional and move some scripts (#1349)
Signed-off-by: enoch85 <github@hanssonit.se>
This commit is contained in:
parent
456efb8e0b
commit
34f58238c5
35
addons/locales.sh
Normal file
35
addons/locales.sh
Normal file
@ -0,0 +1,35 @@
|
||||
#!/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)
|
||||
|
||||
# Must be root
|
||||
root_check
|
||||
|
||||
# Set locales
|
||||
print_text_in_color "$ICyan" "Setting locales..."
|
||||
if [ "$KEYBOARD_LAYOUT" = "us" ]
|
||||
then
|
||||
print_text_in_color "$ICyan" "US locales are already set."
|
||||
elif [ "$KEYBOARD_LAYOUT" = "se" ]
|
||||
then
|
||||
sudo locale-gen "sv_SE.UTF-8" && sudo dpkg-reconfigure --frontend=noninteractive locales
|
||||
elif [ "$KEYBOARD_LAYOUT" = "de" ]
|
||||
then
|
||||
sudo locale-gen "de_DE.UTF-8" && sudo dpkg-reconfigure --frontend=noninteractive locales
|
||||
elif [ "$KEYBOARD_LAYOUT" = "us" ]
|
||||
then
|
||||
sudo locale-gen "en_US.UTF-8" && sudo dpkg-reconfigure --frontend=noninteractive locales
|
||||
elif [ "$KEYBOARD_LAYOUT" = "fr" ]
|
||||
then
|
||||
sudo locale-gen "fr_FR.UTF-8" && sudo dpkg-reconfigure --frontend=noninteractive locales
|
||||
elif [ "$KEYBOARD_LAYOUT" = "ch" ]
|
||||
then
|
||||
sudo locale-gen "de_CH.UTF-8" && sudo dpkg-reconfigure --frontend=noninteractive locales
|
||||
fi
|
||||
|
||||
# TODO: "localectl list-x11-keymap-layouts" and pair with "cat /etc/locale.gen | grep UTF-8"
|
||||
54
addons/locate_mirror.sh
Normal file
54
addons/locate_mirror.sh
Normal file
@ -0,0 +1,54 @@
|
||||
#!/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)
|
||||
|
||||
# Must be root
|
||||
root_check
|
||||
|
||||
# Use another method if the new one doesn't work
|
||||
if [ -z "$REPO" ]
|
||||
then
|
||||
REPO=$(apt update -q4 && apt-cache policy | grep http | tail -1 | awk '{print $2}')
|
||||
fi
|
||||
|
||||
# Check where the best mirrors are and update
|
||||
msg_box "To make downloads as fast as possible when updating Ubuntu you should have download mirrors that are as close to you as possible.
|
||||
|
||||
Please note that there are no gurantees that the download mirrors this script will find are staying up for the lifetime of this server.
|
||||
|
||||
This is the method used: https://github.com/jblakeman/apt-select"
|
||||
print_text_in_color "$ICyan" "Checking current mirror..."
|
||||
print_text_in_color "$ICyan" "Your current server repository is: $REPO"
|
||||
|
||||
if [[ "no" == $(ask_yes_or_no "Do you want to try to find a better mirror?") ]]
|
||||
then
|
||||
print_text_in_color "$ICyan" "Keeping $REPO as mirror..."
|
||||
sleep 1
|
||||
else
|
||||
if [[ "$KEYBOARD_LAYOUT" =~ ,|/|_ ]]
|
||||
then
|
||||
msg_box "Your keymap contains more than one language, or a special character. ($KEYBOARD_LAYOUT)\nThis script can only handle one keymap at the time.\nThe default mirror ($REPO) will be kept."
|
||||
exit 1
|
||||
fi
|
||||
print_text_in_color "$ICyan" "Locating the best mirrors..."
|
||||
curl_to_dir https://bootstrap.pypa.io get-pip.py /tmp
|
||||
install_if_not python3
|
||||
install_if_not python3-testresources
|
||||
install_if_not python3-distutils
|
||||
cd /tmp && python3 get-pip.py
|
||||
pip install \
|
||||
--upgrade pip \
|
||||
apt-select
|
||||
check_command apt-select -m up-to-date -t 4 -c -C "$KEYBOARD_LAYOUT"
|
||||
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup && \
|
||||
if [ -f sources.list ]
|
||||
then
|
||||
sudo mv sources.list /etc/apt/
|
||||
fi
|
||||
fi
|
||||
clear
|
||||
@ -28,6 +28,7 @@ choice=$(whiptail --title "Which apps do you want to install?" --checklist "Auto
|
||||
"PreviewGenerator" "(Pre-generate previews)" OFF \
|
||||
"LDAP" "(Windows Active directory)" OFF \
|
||||
"Talk" "(Nextcloud Video calls and chat)" OFF \
|
||||
"Webmin" "(Server GUI)" OFF \
|
||||
"SMB-mount" "(Connect to SMB-shares from your local network)" OFF 3>&1 1>&2 2>&3)
|
||||
|
||||
case "$choice" in
|
||||
@ -91,6 +92,9 @@ case "$choice" in
|
||||
print_text_in_color "$ICyan" "Downloading SMB-mount.sh..."
|
||||
run_script APP smbmount
|
||||
;;&
|
||||
*"Webmin"*)
|
||||
run_script APP webmin
|
||||
;;&
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -59,7 +59,7 @@ if [[ "no" == $(ask_yes_or_no "Have you made the necessary preparations?") ]]
|
||||
then
|
||||
msg_box "OK, please do the necessary preparations before you run this script and then simply run it again once you're done.
|
||||
|
||||
To run this script again, execute $SCRIPTS/apps.sh and choose Bitwarden"
|
||||
To run this script again, execute $SCRIPTS/menu.sh and choose Additional Apps --> Bitwarden"
|
||||
exit
|
||||
else
|
||||
sleep 0.1
|
||||
|
||||
@ -38,10 +38,10 @@ The script will also delete everything in trashbin for all users to free up some
|
||||
if [ -f $SCRIPTS/zfs-prune-snapshots ]
|
||||
then
|
||||
rm -f "$SCRIPTS"/zfs-prune-snapshots
|
||||
download_script STATIC zfs-prune-snapshots
|
||||
download_script DISK zfs-prune-snapshots
|
||||
elif [ ! -f $SCRIPTS/zfs-prune-snapshots.sh ]
|
||||
then
|
||||
download_script STATIC zfs-prune-snapshots
|
||||
download_script DISK zfs-prune-snapshots
|
||||
fi
|
||||
check_command chmod +x "$SCRIPTS"/zfs-prune-snapshots.sh
|
||||
# Prune!
|
||||
@ -47,7 +47,7 @@ then
|
||||
fi
|
||||
|
||||
# Set trusted domains
|
||||
run_script STATIC trusted
|
||||
run_script NETWORK trusted
|
||||
|
||||
add_crontab_le() {
|
||||
# shellcheck disable=SC2016
|
||||
|
||||
7
lib.sh
7
lib.sh
@ -80,6 +80,9 @@ LETS_ENC="$GITHUB_REPO/lets-encrypt"
|
||||
APP="$GITHUB_REPO/apps"
|
||||
OLD="$GITHUB_REPO/old"
|
||||
ADDONS="$GITHUB_REPO/addons"
|
||||
MENU="$GITHUB_REPO/menu"
|
||||
DISK="$GITHUB_REPO/disk"
|
||||
NETWORK="$GITHUB_REPO/network"
|
||||
VAGRANT_DIR="$GITHUB_REPO/vagrant"
|
||||
NCREPO="https://download.nextcloud.com/server/releases"
|
||||
ISSUES="https://github.com/nextcloud/vm/issues"
|
||||
@ -887,7 +890,7 @@ rm -f releases
|
||||
}
|
||||
|
||||
# call like: download_script folder_variable name_of_script
|
||||
# e.g. download_script APP additional_apps
|
||||
# e.g. download_script MENU additional_apps
|
||||
# Use it for functions like download_static_script
|
||||
download_script() {
|
||||
rm -f "${SCRIPTS}/${2}.sh" "${SCRIPTS}/${2}.php" "${SCRIPTS}/${2}.py"
|
||||
@ -901,7 +904,7 @@ download_script() {
|
||||
}
|
||||
|
||||
# call like: run_script folder_variable name_of_script
|
||||
# e.g. run_script APP additional_apps
|
||||
# e.g. run_script MENU additional_apps
|
||||
# Use it for functions like run_script STATIC
|
||||
run_script() {
|
||||
rm -f "${SCRIPTS}/${2}.sh" "${SCRIPTS}/${2}.php" "${SCRIPTS}/${2}.py"
|
||||
|
||||
102
menu/additional_apps.sh
Normal file
102
menu/additional_apps.sh
Normal file
@ -0,0 +1,102 @@
|
||||
#!/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
|
||||
|
||||
# Install Apps
|
||||
choice=$(whiptail --title "Which apps do you want to install?" --checklist "Automatically configure and install selected apps\nSelect by pressing the spacebar\nYou can view this menu later by running 'sudo bash $SCRIPTS/menu.sh'" "$WT_HEIGHT" "$WT_WIDTH" 4 \
|
||||
"Fail2ban" "(Extra Bruteforce protection)" OFF \
|
||||
"Adminer" "(PostgreSQL GUI)" OFF \
|
||||
"Netdata" "(Real-time server monitoring)" OFF \
|
||||
"Collabora" "(Online editing [2GB RAM])" OFF \
|
||||
"OnlyOffice" "(Online editing [2GB RAM])" OFF \
|
||||
"Bitwarden" "(External password manager)" OFF \
|
||||
"FullTextSearch" "(Elasticsearch for Nextcloud [2GB RAM])" OFF \
|
||||
"PreviewGenerator" "(Pre-generate previews)" OFF \
|
||||
"LDAP" "(Windows Active directory)" OFF \
|
||||
"Talk" "(Nextcloud Video calls and chat)" OFF \
|
||||
"Webmin" "(Server GUI)" OFF \
|
||||
"SMB-mount" "(Connect to SMB-shares from your local network)" OFF 3>&1 1>&2 2>&3)
|
||||
|
||||
case "$choice" in
|
||||
*"Fail2ban"*)
|
||||
clear
|
||||
print_text_in_color "$ICyan" "Downloading Fail2ban.sh..."
|
||||
run_script APP fail2ban
|
||||
;;&
|
||||
*"Adminer"*)
|
||||
clear
|
||||
print_text_in_color "$ICyan" "Downloading Adminer.sh..."
|
||||
run_script APP adminer
|
||||
;;&
|
||||
*"Netdata"*)
|
||||
clear
|
||||
print_text_in_color "$ICyan" "Downloading Netdata.sh..."
|
||||
run_script APP netdata
|
||||
;;&
|
||||
*"OnlyOffice"*)
|
||||
clear
|
||||
print_text_in_color "$ICyan" "Downloading OnlyOffice.sh..."
|
||||
run_script APP onlyoffice
|
||||
;;&
|
||||
*"Collabora"*)
|
||||
clear
|
||||
print_text_in_color "$ICyan" "Downloading Collabora.sh..."
|
||||
run_script APP collabora
|
||||
;;&
|
||||
*"Bitwarden"*)
|
||||
clear
|
||||
print_text_in_color "$ICyan" "Downloading Bitwarden.sh..."
|
||||
run_script APP tmbitwarden
|
||||
;;&
|
||||
*"FullTextSearch"*)
|
||||
clear
|
||||
print_text_in_color "$ICyan" "Downloading FullTextSearch.sh..."
|
||||
run_script APP fulltextsearch
|
||||
;;&
|
||||
*"PreviewGenerator"*)
|
||||
clear
|
||||
print_text_in_color "$ICyan" "Downloading PreviewGenerator.sh..."
|
||||
run_script APP previewgenerator
|
||||
;;&
|
||||
*"LDAP"*)
|
||||
clear
|
||||
print_text_in_color "$ICyan" "Installing LDAP..."
|
||||
if install_and_enable_app user_ldap
|
||||
then
|
||||
msg_box "LDAP installed! Please visit https://subdomain.yourdomain.com/settings/admin/ldap to finish the setup once this script is done."
|
||||
else
|
||||
msg_box "LDAP installation failed."
|
||||
fi
|
||||
;;&
|
||||
*"Talk"*)
|
||||
clear
|
||||
print_text_in_color "$ICyan" "Downloading Talk.sh..."
|
||||
run_script APP talk
|
||||
;;&
|
||||
*"SMB-mount"*)
|
||||
clear
|
||||
print_text_in_color "$ICyan" "Downloading SMB-mount.sh..."
|
||||
run_script APP smbmount
|
||||
;;&
|
||||
*"Webmin"*)
|
||||
run_script APP webmin
|
||||
;;&
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
clear
|
||||
exit
|
||||
28
menu/configuration.sh
Normal file
28
menu/configuration.sh
Normal file
@ -0,0 +1,28 @@
|
||||
#!/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
|
||||
|
||||
mkdir -p "$SCRIPTS"
|
||||
print_text_in_color "$ICyan" "Running the nextcloud configuration script..."
|
||||
|
||||
if network_ok
|
||||
then
|
||||
# Delete, download, run
|
||||
run_script MENU nextcloud_configuration
|
||||
fi
|
||||
|
||||
exit
|
||||
@ -27,19 +27,19 @@ case "$choice" in
|
||||
"Additional Apps")
|
||||
if network_ok
|
||||
then
|
||||
run_script APP additional_apps
|
||||
run_script MENU additional_apps
|
||||
fi
|
||||
;;
|
||||
"Nextcloud Configuration")
|
||||
if network_ok
|
||||
then
|
||||
run_script STATIC nextcloud_configuration
|
||||
run_script MENU nextcloud_configuration
|
||||
fi
|
||||
;;
|
||||
"Server Configuration")
|
||||
if network_ok
|
||||
then
|
||||
run_script STATIC server_configuration
|
||||
run_script MENU server_configuration
|
||||
fi
|
||||
;;
|
||||
"Update Nextcloud")
|
||||
@ -17,12 +17,12 @@ debug_mode
|
||||
root_check
|
||||
|
||||
mkdir -p "$SCRIPTS"
|
||||
print_text_in_color "$ICyan" "Running the additional apps script..."
|
||||
print_text_in_color "$ICyan" "Running the main menu script..."
|
||||
|
||||
if network_ok
|
||||
then
|
||||
# Delete, download, run
|
||||
run_script APP additional_apps
|
||||
run_script MENU main_menu
|
||||
fi
|
||||
|
||||
exit
|
||||
74
menu/nextcloud_configuration.sh
Normal file
74
menu/nextcloud_configuration.sh
Normal file
@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2020, https://www.hanssonit.se/
|
||||
|
||||
# shellcheck disable=2034,2059
|
||||
true
|
||||
# shellcheck source=lib.sh
|
||||
NC_UPDATE=1 . <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh)
|
||||
unset NC_UPDATE
|
||||
|
||||
# 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\nYou can view this menu later by running 'sudo bash $SCRIPTS/menu.sh'" "$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 \
|
||||
"Disable user flows" "(Disable user settings for Nextcloud Flow)" OFF 3>&1 1>&2 2>&3)
|
||||
|
||||
case "$choice" in
|
||||
*"CookieLifetime"*)
|
||||
run_script STATIC 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
|
||||
# Check if text is enabled
|
||||
if ! is_app_enabled text
|
||||
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
|
||||
;;&
|
||||
*"Disable user flows"*)
|
||||
# Greater than 18.0.3 is 18.0.4 which is required
|
||||
if version_gt "$CURRENTVERSION" "18.0.3"
|
||||
then
|
||||
msg_box "This option will disable the with Nextcloud 18 introduced user flows. It will disable the user flow settings. Admin flows will continue to work."
|
||||
if [[ "yes" == $(ask_yes_or_no "Do you want to disable user flows?") ]]
|
||||
then
|
||||
occ_command config:app:set workflowengine user_scope_disabled --value yes
|
||||
msg_box "User flow settings are now disabled."
|
||||
fi
|
||||
else
|
||||
msg_box "'Disable user flows' is only available on Nextcloud 18.0.4 and above.\nPlease upgrade by running 'sudo bash /var/scripts/update.sh'"
|
||||
sleep 1
|
||||
fi
|
||||
;;&
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
exit
|
||||
97
menu/server_configuration.sh
Normal file
97
menu/server_configuration.sh
Normal file
@ -0,0 +1,97 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2020, https://www.hanssonit.se/
|
||||
|
||||
# Use local lib file in case there is no internet connection
|
||||
if [ -f /var/scripts/lib.sh ]
|
||||
then
|
||||
# shellcheck disable=2034,2059
|
||||
true
|
||||
# shellcheck source=lib.sh
|
||||
source /var/scripts/lib.sh
|
||||
# If we have internet, then use the latest variables from the lib remote file
|
||||
elif printf "Testing internet connection..." && ping github.com -c 2
|
||||
then
|
||||
# shellcheck disable=2034,2059
|
||||
true
|
||||
# shellcheck source=lib.sh
|
||||
. <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh)
|
||||
else
|
||||
printf "You don't seem to have a working internet connection, and /var/scripts/lib.sh is missing so you can't run this script."
|
||||
printf "Please report this to https://github.com/nextcloud/vm/issues/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 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
|
||||
|
||||
# Server configurations
|
||||
choice=$(whiptail --title "Server configurations" --checklist "Choose what you want to configure\nSelect by pressing the spacebar\nYou can view this menu later by running 'sudo bash $SCRIPTS/menu.sh'" "$WT_HEIGHT" "$WT_WIDTH" 4 \
|
||||
"Activate TLS" "(Enable HTTPS with Let's Encrypt)" ON \
|
||||
"Security" "(Add extra security based on this http://goo.gl/gEJHi7)" OFF \
|
||||
"Static IP" "(Set static IP in Ubuntu with netplan.io)" OFF \
|
||||
"Disk Check" "(Check for S.M.A.R.T errors on your disks every week on Mondays)" OFF \
|
||||
"Fail2ban Statuscheck" "(Check status of banned IPs in iptables and Fail2ban)" OFF \
|
||||
"Automatic updates" "(Automatically update your server every week on Sundays)" OFF 3>&1 1>&2 2>&3)
|
||||
|
||||
case "$choice" in
|
||||
*"Fail2ban Statuscheck"*)
|
||||
clear
|
||||
fail2ban-client status nextcloud && fail2ban-client status sshd
|
||||
iptables -L -n
|
||||
;;&
|
||||
*"Disk Check"*)
|
||||
clear
|
||||
run_script DISK smartctl
|
||||
;;&
|
||||
*"Security"*)
|
||||
clear
|
||||
run_script ADDONS security
|
||||
;;&
|
||||
*"Static IP"*)
|
||||
clear
|
||||
run_script NETWORK static_ip
|
||||
;;&
|
||||
*"Automatic updates"*)
|
||||
clear
|
||||
run_script ADDONS automatic_updates
|
||||
;;&
|
||||
*"Activate TLS"*)
|
||||
clear
|
||||
msg_box "The following script will install a trusted
|
||||
TLS certificate through Let's Encrypt.
|
||||
It's recommended to use TLS (https) together with Nextcloud.
|
||||
Please open port 80 and 443 to this servers IP before you continue.
|
||||
More information can be found here:
|
||||
https://www.techandme.se/open-port-80-443/"
|
||||
|
||||
if [[ "yes" == $(ask_yes_or_no "Do you want to install TLS?") ]]
|
||||
then
|
||||
if [ -f $SCRIPTS/activate-tls.sh ]
|
||||
then
|
||||
bash $SCRIPTS/activate-tls.sh
|
||||
else
|
||||
download_script LETS_ENC activate-tls
|
||||
bash $SCRIPTS/activate-tls.sh
|
||||
fi
|
||||
else
|
||||
echo
|
||||
print_text_in_color "$ICyan" "OK, but if you want to run it later, just type: sudo bash $SCRIPTS/activate-tls.sh"
|
||||
any_key "Press any key to continue..."
|
||||
fi
|
||||
|
||||
# Just make sure they are gone
|
||||
rm -f "$SCRIPTS/test-new-config.sh"
|
||||
rm -f "$SCRIPTS/activate-tls.sh"
|
||||
clear
|
||||
;;&
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
exit
|
||||
28
network/trusted.sh
Normal file
28
network/trusted.sh
Normal file
@ -0,0 +1,28 @@
|
||||
#!/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
|
||||
|
||||
download_script NETWORK update-config
|
||||
if [ -f $SCRIPTS/update-config.php ]
|
||||
then
|
||||
# Change config.php
|
||||
php $SCRIPTS/update-config.php $NCPATH/config/config.php 'trusted_domains[]' localhost "${ADDRESS[@]}" "$(hostname)" "$(hostname --fqdn)" >/dev/null 2>&1
|
||||
php $SCRIPTS/update-config.php $NCPATH/config/config.php overwrite.cli.url https://"$(hostname --fqdn)"/ >/dev/null 2>&1
|
||||
|
||||
# Change .htaccess accordingly
|
||||
sed -i "s|RewriteBase /nextcloud|RewriteBase /|g" $NCPATH/.htaccess
|
||||
|
||||
# Cleanup
|
||||
rm -f $SCRIPTS/update-config.php
|
||||
fi
|
||||
53
network/update-config.php
Normal file
53
network/update-config.php
Normal file
@ -0,0 +1,53 @@
|
||||
#!/usr/bin/php
|
||||
|
||||
# Credit to: https://github.com/jnweiger
|
||||
|
||||
<?php
|
||||
|
||||
#
|
||||
# Update or delete an entry in config.php.
|
||||
# Called by kiwi's config.sh
|
||||
#
|
||||
if ($argc < 3)
|
||||
{
|
||||
print "Example Usage:\n\t". __FILE__." path/to/config.php overwritewebroot /nextcloud\n";
|
||||
print "\t".__FILE__." path/to/config.php trusted_domains[] 17.0.2.15 localhost\n";
|
||||
# nothing to do
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!is_file($argv[1]))
|
||||
{
|
||||
# do not create the file, if missing.
|
||||
# Wrong permissions are deadly for nextcloud.
|
||||
## FIXME: get some proper errno or strerror() please?
|
||||
print($argv[1] . ": \$CONFIG cannot be loaded?\n");
|
||||
return;
|
||||
}
|
||||
|
||||
include "$argv[1]";
|
||||
|
||||
if ($argc > 3)
|
||||
{
|
||||
# append [] to the key name, if you need to pass an array object.
|
||||
if (substr($argv[2], -2) === '[]')
|
||||
{
|
||||
$CONFIG[substr($argv[2],0,-2)] = array_slice($argv,3);
|
||||
}
|
||||
else
|
||||
{
|
||||
$CONFIG[$argv[2]] = $argv[3];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# exactly two parameter given -- means delete.
|
||||
unset($CONFIG[$argv[2]]);
|
||||
}
|
||||
|
||||
$text = var_export($CONFIG, true);
|
||||
## A warning is printed, if argv[1] is not writable.
|
||||
## PHP does not issue proper errno or strerror() does it?
|
||||
file_put_contents($argv[1], "<?php\n\$CONFIG = $text;\n");
|
||||
?>
|
||||
@ -172,7 +172,7 @@ then
|
||||
fi
|
||||
|
||||
# Set locales
|
||||
run_script STATIC locales
|
||||
run_script ADDONS locales
|
||||
|
||||
# Nextcloud 18 is required
|
||||
lowest_compatible_nc 18
|
||||
@ -210,7 +210,7 @@ please abort this script (CTRL+C) and report this issue to $ISSUES."
|
||||
fi
|
||||
|
||||
# Upgrade mirrors
|
||||
run_script STATIC locate_mirror
|
||||
run_script ADDONS locate_mirror
|
||||
|
||||
######## The first setup is OK to run to this point several times, but not any further ########
|
||||
if [ -f "$SCRIPTS/you-can-not-run-the-startup-script-several-times" ]
|
||||
@ -239,15 +239,15 @@ print_text_in_color "$ICyan" "Getting scripts from GitHub to be able to run the
|
||||
download_script LETS_ENC activate-tls
|
||||
download_script STATIC temporary-fix
|
||||
download_script STATIC update
|
||||
download_script STATIC trusted
|
||||
download_script STATIC setup_secure_permissions_nextcloud
|
||||
download_script STATIC change_db_pass
|
||||
download_script STATIC nextcloud
|
||||
download_script STATIC update-config
|
||||
download_script STATIC menu
|
||||
download_script STATIC server_configuration
|
||||
download_script STATIC nextcloud_configuration
|
||||
download_script APP additional_apps
|
||||
download_script NETWORK update-config
|
||||
download_script NETWORK trusted
|
||||
download_script MENU menu
|
||||
download_script MENU server_configuration
|
||||
download_script MENU nextcloud_configuration
|
||||
download_script MENU additional_apps
|
||||
|
||||
if home_sme_server
|
||||
then
|
||||
|
||||
@ -66,7 +66,7 @@ debug_mode
|
||||
root_check
|
||||
|
||||
# Set locales
|
||||
run_script STATIC locales
|
||||
run_script ADDONS locales
|
||||
|
||||
# Test RAM size (2GB min) + CPUs (min 1)
|
||||
ram_check 2 Nextcloud
|
||||
@ -163,7 +163,7 @@ install_if_not build-essential
|
||||
# Just check if the function works and run disk setup
|
||||
if home_sme_server
|
||||
then
|
||||
run_script STATIC format-sda-nuc-server
|
||||
run_script DISK format-sda-nuc-server
|
||||
else
|
||||
# Set dual or single drive setup
|
||||
msg_box "This VM is designed to run with two disks, one for OS and one for DATA. This will get you the best performance since the second disk is using ZFS which is a superior filesystem.
|
||||
@ -178,15 +178,15 @@ choice=$(whiptail --title "Choose disk format" --radiolist "How would you like t
|
||||
|
||||
case "$choice" in
|
||||
"2 Disks Auto")
|
||||
run_script STATIC format-sdb
|
||||
run_script DISK format-sdb
|
||||
# Change to zfs-mount-generator
|
||||
run_script STATIC change-to-zfs-mount-generator
|
||||
run_script DISK change-to-zfs-mount-generator
|
||||
|
||||
;;
|
||||
"2 Disks Manual")
|
||||
run_script STATIC format-chosen
|
||||
run_script DISK format-chosen
|
||||
# Change to zfs-mount-generator
|
||||
run_script STATIC change-to-zfs-mount-generator
|
||||
run_script DISK change-to-zfs-mount-generator
|
||||
;;
|
||||
"1 Disk")
|
||||
print_text_in_color "$IRed" "1 Disk setup chosen."
|
||||
@ -235,7 +235,7 @@ do
|
||||
done
|
||||
|
||||
# Check current repo
|
||||
run_script STATIC locate_mirror
|
||||
run_script ADDONS locate_mirror
|
||||
|
||||
# Install PostgreSQL
|
||||
# sudo add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main"
|
||||
@ -473,7 +473,7 @@ echo "pgsql.log_notice = 0"
|
||||
} >> "$PHP_FPM_DIR"/conf.d/20-pdo_pgsql.ini
|
||||
|
||||
# Install Redis (distrubuted cache)
|
||||
run_script STATIC redis-server-ubuntu
|
||||
run_script ADDONS redis-server-ubuntu
|
||||
|
||||
# Install smbclient
|
||||
# php"$PHPVER"-smbclient does not yet work in PHP 7.4
|
||||
@ -704,8 +704,7 @@ choice=$(whiptail --title "Install apps or software" --checklist "Automatically
|
||||
"Text" "" ON \
|
||||
"Mail" "" ON \
|
||||
"Deck" "" ON \
|
||||
"Group-Folders" "" ON \
|
||||
"Webmin" "" ON 3>&1 1>&2 2>&3)
|
||||
"Group-Folders" "" ON 3>&1 1>&2 2>&3)
|
||||
|
||||
case "$choice" in
|
||||
*"Calendar"*)
|
||||
@ -740,9 +739,6 @@ case "$choice" in
|
||||
*"Group-Folders"*)
|
||||
install_and_enable_app groupfolders
|
||||
;;&
|
||||
*"Webmin"*)
|
||||
run_script APP webmin
|
||||
;;&
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
@ -752,7 +748,7 @@ check_command curl_to_dir "$GITHUB_REPO" nextcloud-startup-script.sh "$SCRIPTS"
|
||||
check_command curl_to_dir "$GITHUB_REPO" lib.sh "$SCRIPTS"
|
||||
download_script STATIC instruction
|
||||
download_script STATIC history
|
||||
download_script STATIC static_ip
|
||||
download_script NETWORK static_ip
|
||||
|
||||
if home_sme_server
|
||||
then
|
||||
|
||||
@ -81,7 +81,7 @@ then
|
||||
fi
|
||||
|
||||
# Make sure everyone gets access to menu.sh
|
||||
download_script STATIC menu
|
||||
download_script MENU menu
|
||||
|
||||
# Update docker-ce to overlay2 since devicemapper is deprecated
|
||||
if [ -f /etc/systemd/system/docker.service ]
|
||||
@ -235,7 +235,7 @@ if is_this_installed libzfs2linux
|
||||
then
|
||||
if grep -rq ncdata /etc/mtab
|
||||
then
|
||||
run_script STATIC prune_zfs_snaphots
|
||||
run_script DISK prune_zfs_snaphots
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ print_text_in_color "$ICyan" "Running the nextcloud configuration script..."
|
||||
if network_ok
|
||||
then
|
||||
# Delete, download, run
|
||||
run_script STATIC nextcloud_configuration
|
||||
run_script MENU nextcloud_configuration
|
||||
fi
|
||||
|
||||
exit
|
||||
|
||||
@ -22,7 +22,7 @@ print_text_in_color "$ICyan" "Running the main menu script..."
|
||||
if network_ok
|
||||
then
|
||||
# Delete, download, run
|
||||
run_script STATIC main_menu
|
||||
run_script MENU main_menu
|
||||
fi
|
||||
|
||||
exit
|
||||
|
||||
@ -42,19 +42,19 @@ choice=$(whiptail --title "Server configurations" --checklist "Choose what you w
|
||||
case "$choice" in
|
||||
*"Disk Check"*)
|
||||
clear
|
||||
run_script ADDONS smartctl
|
||||
run_script DISK smartctl
|
||||
;;&
|
||||
*"Security"*)
|
||||
clear
|
||||
run_script STATIC security
|
||||
run_script ADDONS security
|
||||
;;&
|
||||
*"Static IP"*)
|
||||
clear
|
||||
run_script STATIC static_ip
|
||||
run_script NETWORK static_ip
|
||||
;;&
|
||||
*"Automatic updates"*)
|
||||
clear
|
||||
run_script STATIC automatic_updates
|
||||
run_script ADDONS automatic_updates
|
||||
;;&
|
||||
*"Activate TLS"*)
|
||||
clear
|
||||
|
||||
@ -13,7 +13,7 @@ true
|
||||
DEBUG=0
|
||||
debug_mode
|
||||
|
||||
download_script STATIC update-config
|
||||
download_script NETWORK update-config
|
||||
if [ -f $SCRIPTS/update-config.php ]
|
||||
then
|
||||
# Change config.php
|
||||
|
||||
Loading…
Reference in New Issue
Block a user