Skip to content

Commit

Permalink
ownCloud: Revision for v10.15.0 (SynoCommunity#6280)
Browse files Browse the repository at this point in the history
* Add PHP settings
* Refresh PHP extensions
* Refine database setup and install wizard
  • Loading branch information
mreid-tt authored Oct 19, 2024
1 parent 3e68981 commit 5d0616d
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 12 deletions.
2 changes: 1 addition & 1 deletion spk/owncloud/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SPK_NAME = owncloud
SPK_VERS = 10.15.0
SPK_REV = 19
SPK_REV = 20
SPK_ICON = src/owncloud.png

DEPENDS = cross/owncloud
Expand Down
12 changes: 10 additions & 2 deletions spk/owncloud/src/conf/resource
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,32 @@
"backend": 8,
"connect_timeout": 120,
"extensions": [
"bcmath",
"apcu",
"bz2",
"curl",
"exif",
"ftp",
"gd",
"gmp",
"iconv",
"imagick",
"imap",
"intl",
"ldap",
"memcached",
"openssl",
"pdo_mysql",
"phar",
"posix",
"redis",
"ssh2",
"zip",
"zlib"
],
"group": "http",
"php_settings": {
"error_log": "/var/services/web_packages/owncloud/php_errors.log",
"pdo_mysql.default_socket": "/run/mysqld/mysqld10.sock"
},
"profile_desc": "PHP Profile for ownCloud",
"profile_name": "ownCloud Profile",
"user": "sc-owncloud"
Expand Down
11 changes: 7 additions & 4 deletions spk/owncloud/src/service-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ fi
MYSQL="/usr/local/mariadb10/bin/mysql"
MYSQLDUMP="/usr/local/mariadb10/bin/mysqldump"
MYSQL_DATABASE="${SYNOPKG_PKGNAME}"
MYSQL_USER="oc_${wizard_owncloud_admin_username}"
WEB_ROOT="${WEB_DIR}/${SYNOPKG_PKGNAME}"
SYNOSVC="/usr/syno/sbin/synoservice"

Expand Down Expand Up @@ -76,13 +77,16 @@ exec_occ() {
setup_owncloud_instance()
{
if [ "${SYNOPKG_PKG_STATUS}" = "INSTALL" ]; then
# Setup database
${MYSQL} -u root -p"${wizard_mysql_password_root}" -e "CREATE DATABASE ${MYSQL_DATABASE}; GRANT ALL PRIVILEGES ON ${MYSQL_DATABASE}.* TO '${MYSQL_USER}'@'localhost' IDENTIFIED BY '${wizard_mysql_password_owncloud}';"

# Setup configuration file
exec_occ maintenance:install \
--database "mysql" \
--database-name "${SYNOPKG_PKGNAME}" \
--database-name "${MYSQL_DATABASE}" \
--database-host "localhost:/run/mysqld/mysqld10.sock" \
--database-user "root" \
--database-pass "${wizard_mysql_password_root}" \
--database-user "${MYSQL_USER}" \
--database-pass "${wizard_mysql_password_owncloud}" \
--admin-user "${wizard_owncloud_admin_username}" \
--admin-pass "${wizard_owncloud_admin_password}" \
--data-dir "${DATA_DIR}" 2>&1
Expand Down Expand Up @@ -165,7 +169,6 @@ validate_preinst ()
fi

if [ "${SYNOPKG_PKG_STATUS}" = "INSTALL" ]; then
MYSQL_USER="oc_${wizard_owncloud_admin_username}"
# Check database
if ! ${MYSQL} -u root -p"${wizard_mysql_password_root}" -e quit > /dev/null 2>&1; then
echo "Incorrect MySQL 'root' password"
Expand Down
12 changes: 10 additions & 2 deletions spk/owncloud/src/web/owncloud.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,24 @@
"enable_cache": true,
"enable_xdebug": false,
"extensions": [
"bcmath",
"apcu",
"bz2",
"curl",
"exif",
"ftp",
"gd",
"gmp",
"iconv",
"imagick",
"imap",
"intl",
"ldap",
"memcached",
"openssl",
"pdo_mysql",
"phar",
"posix",
"redis",
"ssh2",
"zip",
"zlib"
],
Expand All @@ -30,6 +34,10 @@
"start_servers": 2
},
"open_basedir": "",
"php_settings": {
"error_log": "/var/services/web/owncloud/php_errors.log",
"pdo_mysql.default_socket": "/run/mysqld/mysqld10.sock"
},
"profile_desc": "PHP Profile for ownCloud",
"profile_name": "ownCloud Profile"
}
31 changes: 30 additions & 1 deletion spk/owncloud/src/wizard_templates/install_uifile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ page_append ()

RESTORE_BACKUP_FILE="wizard_owncloud_restore"
BACKUP_FILE_PATH="wizard_backup_file"
RESTORE_BLANK_TEXT="{{{OWNCLOUD_BACKUP_FILE_VALIDATION_BLANK_TEXT}}}"
RESTORE_ERROR_TEXT="{{{OWNCLOUD_BACKUP_FILE_VALIDATION_ERROR_TEXT}}}"
SHARE_ERROR_TEXT="{{{OWNCLOUD_DATA_DIRECTORY_VALIDATION_ERROR_TEXT}}}"
MYSQL_ROOT_PASSWORD="wizard_mysql_password_root"
Expand All @@ -35,8 +36,13 @@ checkBackupRestore()
var backupFilePath = arguments[0];
var step = arguments[2];
var backupRestore = step.getComponent("${RESTORE_BACKUP_FILE}");
const backupFileRegex = /^\/(volume|volumeUSB)[0-9]+\/([^\/]+\/)*owncloud_backup_v\d+\.\d+\.\d+_\d{8}\.tar\.gz$/;
if (backupRestore.checked) {
if (backupFilePath === "") {
return "${RESTORE_BLANK_TEXT}";
} else if (backupFileRegex.test(backupFilePath)) {
return true;
} else {
return "${RESTORE_ERROR_TEXT}";
}
}
Expand Down Expand Up @@ -169,6 +175,18 @@ EOF
echo "$DEACTIVAETE" | quote_json
}

getPasswordValidator()
{
validator=$(/bin/cat<<EOF
{
var password = arguments[0];
return -1 !== password.search("(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[^A-Za-z0-9])(?=.{10,})");
}
EOF
)
echo "$validator" | quote_json
}

# Check for multiple PHP profiles
check_php_profiles ()
{
Expand Down Expand Up @@ -210,7 +228,7 @@ PAGE_ADMIN_CONFIG=$(/bin/cat<<EOF
"key": "${BACKUP_FILE_PATH}",
"desc": "{{{OWNCLOUD_BACKUP_FILE_LOCATION_LABEL}}}",
"disabled": true,
"emptyText": "${SYNOPKG_PKGDEST_VOL}/${SYNOPKG_PKGNAME}/backup",
"emptyText": "${SYNOPKG_PKGDEST_VOL}/backup/${SYNOPKG_PKGNAME}_backup_v10.15.0_20241015.tar.gz",
"validator": {
"fn": "$(checkBackupRestore)"
}
Expand Down Expand Up @@ -255,6 +273,17 @@ PAGE_ADMIN_CONFIG=$(/bin/cat<<EOF
"allowBlank": false
}
}]
}, {
"type": "password",
"desc": "{{{MYSQL_OWNCLOUD_PASSWORD_DESCRIPTION}}}",
"subitems": [{
"key": "wizard_mysql_password_owncloud",
"desc": "{{{MYSQL_OWNCLOUD_PASSWORD_LABEL}}}",
"invalidText": "{{{MYSQL_OWNCLOUD_PASSWORD_VALIDATION_ERROR_TEXT}}}",
"validator": {
"fn": "$(getPasswordValidator)"
}
}]
}, {
"type": "password",
"desc": "{{{MYSQL_ROOT_PASSWORD_DESCRIPTION}}}",
Expand Down
6 changes: 5 additions & 1 deletion spk/owncloud/src/wizard_templates/install_uifile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ OWNCLOUD_INSTALL_LABEL: "Install new deployment"
OWNCLOUD_RESTORE_LABEL: "Restore from archive"
OWNCLOUD_BACKUP_FILE_LOCATION_DESCRIPTION: "Please provide the complete path to the archive you wish to restore."
OWNCLOUD_BACKUP_FILE_LOCATION_LABEL: "Backup file location"
OWNCLOUD_BACKUP_FILE_VALIDATION_ERROR_TEXT: "An empty file path is not allowed when restore is enabled."
OWNCLOUD_BACKUP_FILE_VALIDATION_BLANK_TEXT: "An empty file path is not allowed when restore is enabled."
OWNCLOUD_BACKUP_FILE_VALIDATION_ERROR_TEXT: "Invalid file path. Please provide the full path to a valid backup archive."
OWNCLOUD_DATA_DIRECTORY_DESCRIPTION: "ownCloud data directory"
OWNCLOUD_DATA_DIRECTORY_LABEL: "Share name"
OWNCLOUD_DATA_DIRECTORY_VALIDATION_ERROR_TEXT: "The shared folder name contains invalid characters or starts/ends with a space."
Expand All @@ -14,6 +15,9 @@ OWNCLOUD_ADMIN_USER_NAME_DESCRIPTION: "Administrator's login. Defaults to 'admin
OWNCLOUD_ADMIN_USER_NAME_LABEL: "User name"
OWNCLOUD_ADMIN_PASSWORD_DESCRIPTION: "Administrator's password. Defaults to 'admin'"
OWNCLOUD_ADMIN_PASSWORD_LABEL: "Password"
MYSQL_OWNCLOUD_PASSWORD_DESCRIPTION: "Create a password for the MySQL database account"
MYSQL_OWNCLOUD_PASSWORD_LABEL: "MySQL 'owncloud' password"
MYSQL_OWNCLOUD_PASSWORD_VALIDATION_ERROR_TEXT: "Password is invalid. Ensure it includes at least one uppercase letter, one lowercase letter, one digit, one special character, and has a minimum length of 10 characters."
MYSQL_ROOT_PASSWORD_DESCRIPTION: "Enter your MySQL superuser account password"
MYSQL_ROOT_PASSWORD_LABEL: "MySQL 'root' password"

Expand Down
6 changes: 5 additions & 1 deletion spk/owncloud/src/wizard_templates/install_uifile_fre.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ OWNCLOUD_INSTALL_LABEL: "Installer un nouveau déploiement"
OWNCLOUD_RESTORE_LABEL: "Restaurer à partir d'une archive"
OWNCLOUD_BACKUP_FILE_LOCATION_DESCRIPTION: "Veuillez fournir le chemin complet de l'archive que vous souhaitez restaurer."
OWNCLOUD_BACKUP_FILE_LOCATION_LABEL: "Emplacement du fichier de sauvegarde"
OWNCLOUD_BACKUP_FILE_VALIDATION_ERROR_TEXT: "Un chemin de fichier vide n'est pas autorisé lorsque la restauration est activée."
OWNCLOUD_BACKUP_FILE_VALIDATION_BLANK_TEXT: "Un chemin de fichier vide n'est pas autorisé lorsque la restauration est activée."
OWNCLOUD_BACKUP_FILE_VALIDATION_ERROR_TEXT: "Chemin de fichier non valide. Veuillez fournir le chemin complet vers une archive de sauvegarde valide."
OWNCLOUD_DATA_DIRECTORY_DESCRIPTION: "Répertoire de données ownCloud"
OWNCLOUD_DATA_DIRECTORY_LABEL: "Partager le nom"
OWNCLOUD_DATA_DIRECTORY_VALIDATION_ERROR_TEXT: "Le nom du dossier partagé contient des caractères non valides ou commence/se termine par un espace."
Expand All @@ -14,6 +15,9 @@ OWNCLOUD_ADMIN_USER_NAME_DESCRIPTION: "Connexion de l'administrateur. Par défau
OWNCLOUD_ADMIN_USER_NAME_LABEL: "Nom d'utilisateur"
OWNCLOUD_ADMIN_PASSWORD_DESCRIPTION: "Mot de passe de l'administrateur. Par défaut, 'admin'"
OWNCLOUD_ADMIN_PASSWORD_LABEL: "Mot de passe"
MYSQL_OWNCLOUD_PASSWORD_DESCRIPTION: "Créer un mot de passe pour le compte de base de données MySQL"
MYSQL_OWNCLOUD_PASSWORD_LABEL: "Mot de passe MySQL « owncloud »"
MYSQL_OWNCLOUD_PASSWORD_VALIDATION_ERROR_TEXT: "Le mot de passe n'est pas valide. Assurez-vous qu'il comprend au moins une lettre majuscule, une lettre minuscule, un chiffre, un caractère spécial et qu'il a une longueur minimale de 10 caractères."
MYSQL_ROOT_PASSWORD_DESCRIPTION: "Entrez le mot de passe de votre compte superutilisateur MySQL"
MYSQL_ROOT_PASSWORD_LABEL: "Mot de passe « root » de MySQL"

Expand Down

0 comments on commit 5d0616d

Please sign in to comment.