Commit b50ac3e8 authored by w4t's avatar w4t

wtserver 0.31

parent 44b9f3db
......@@ -44,7 +44,6 @@ Database user : $CFG_CLOUDDBUSER
Database password : $CFG_CLOUDDBPWD
#------------------------------
EOF
echo -e "[${green}DONE${NC}]"
MeasureTimeDuration $START_TIME
}
......@@ -77,11 +76,15 @@ InstallNextcloud() {
CURRENT_NEXTCLOUD_VER=""
fi
# Install or upgrade Nextcloud if necessary
if [ ! -d $CLOUD_DIR ] || [[ ! ${CURRENT_NEXTCLOUD_VER} =~ ^$nextcloud_ver ]]; then
# If there is no directory or no previous version, install the base version immediately
if [ ! -d $CLOUD_DIR ]; then
# If there is no directory at all, install the base version
echo -n -e "$IDENTATION_LVL_1 No existing installation found, installing Nextcloud $nextcloud_ver... "
InstallNextcloudVer $nextcloud_ver $nextcloud_hash
# If there is a directory but not the expected version, we will perform a version update
elif [[ ! ${CURRENT_NEXTCLOUD_VER} =~ ^$nextcloud_ver ]]; then
# Stop php-fpm if running. If theyre not running (which happens on a previously failed install), dont bail
systemctl restart php8.2-fpm stop &> /dev/null || /bin/true
# Backup existing Nextcloud installation
# Create a backup directory to store the current installation and database to
BACKUP_DIRECTORY=$CLOUD_DIR-backup/`date +"%Y-%m-%d-%T"`
......@@ -96,36 +99,32 @@ InstallNextcloud() {
if [ -e "$STORAGE_ROOT/nextcloud/config.php" ]; then
cp "$STORAGE_ROOT/nextcloud/config.php" "$BACKUP_DIRECTORY"
fi
# Perform version-specific upgrades
if [ -n "${CURRENT_NEXTCLOUD_VER}" ]; then
if [ -e "$CLOUD_DIR/config.php" ]; then
# Remove the read-onlyness of the config, which is needed for migrations, especially for v24
sed -i -e '/config_is_read_only/d' "$CLOUD_DIR/config.php"
fi
if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^27 ]]; then
InstallNextcloudVer 28.0.14 8a9edcfd26d318eb7d1cfa44d69796f2d1098a80
CURRENT_NEXTCLOUD_VER="28.0.14"
fi
if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^28 ]]; then
InstallNextcloudVer 29.0.12 6cd53db7a8d730ebd5972081344db41eb2b174a8
CURRENT_NEXTCLOUD_VER="29.0.12"
fi
if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^29 ]]; then
InstallNextcloudVer 30.0.6 c7171b03f9904a2051e765fe09ab3e95e2e564e6
CURRENT_NEXTCLOUD_VER="30.0.6"
fi
if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^30 ]]; then
InstallNextcloudVer 31.0.0 545584d128e3242337548ac2cdf31e6019b738f4
CURRENT_NEXTCLOUD_VER="31.0.0"
fi
fi
else
InstallNextcloudVer $nextcloud_ver $nextcloud_hash
# Ha a könyvtár létezik és a verzió is egyezik, nincs tennivaló
echo -e "$IDENTATION_LVL_1 Nextcloud $nextcloud_ver is already installed. [${green}OK${NC}]"
fi
# Configure Nextcloud permissions
......@@ -182,7 +181,7 @@ EOF
dbruser=root
CFG_CLOUDADMINUSER=root
CFG_CLOUDADMINPWD=$(dd if=/dev/urandom bs=1 count=64 2>/dev/null | sha256sum | fold -w 40 | head -n 1)
case $CFG_CLOUDDBTYPE in
"mysql")
if [ $CFG_CLOUDDBHOST == "localhost" ]; then
......@@ -298,7 +297,7 @@ EOF
sudo -u www-data php8.2 "$CLOUD_DIR"/occ status
sleep 3
echo
;;
;;
"sqlite")
# Setup Nextcloud if the Nextcloud database does not yet exist. Running setup when
# the database does exist wipes the database and user data.
......@@ -315,13 +314,13 @@ EOF
# (cd $STORAGE_ROOT/owncloud; sudo -u www-data php $STORAGE_ROOT/owncloud/index.php;)
#fi
# Migrate users_external data from <0.6.0 to version 3.0.0
# (see https://github.com/nextcloud/user_external).
# This version was probably in use in Mail-in-a-Box v0.41 (February 26, 2019) and earlier.
# We moved to v0.6.3 in 193763f8. Ignore errors - maybe there are duplicated users with the
# correct backend already.
# Migrate users_external data from <0.6.0 to version 3.0.0
# (see https://github.com/nextcloud/user_external).
# This version was probably in use in Mail-in-a-Box v0.41 (February 26, 2019) and earlier.
# We moved to v0.6.3 in 193763f8. Ignore errors - maybe there are duplicated users with the
# correct backend already.
sqlite3 "$STORAGE_ROOT/owncloud/owncloud.db" "UPDATE oc_users_external SET backend='127.0.0.1';" || /bin/true
;;
;;
esac
# Set PHP FPM values to support large file uploads
......@@ -440,7 +439,7 @@ InstallNextcloudVer() {
version=$1
hash=$2
echo -n -e "$IDENTATION_LVL_1 Installing Nextcloud $version"
echo -n -e "$IDENTATION_LVL_1 Installing Nextcloud $version "
# Remove the current Nextcloud installation
rm -rf $CLOUD_DIR
......@@ -455,12 +454,15 @@ InstallNextcloudVer() {
# Empty the skeleton dir to save some space for each new user
rm -rf $CLOUD_DIR/core/skeleton/*
echo -e "[${green}DONE${NC}]"
echo -n -e "$IDENTATION_LVL_1 Installing Nextcloud Apps"
# Create the apps directory if it doesn't exist
mkdir -p $CLOUD_DIR/apps
# Install additional Nextcloud apps
InstallNextcloudApps
echo -e "[${green}DONE${NC}]"
# Fix directory permissions
chmod 750 $CLOUD_DIR/{apps,config}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment