mirror of
https://github.com/YunoHost-Apps/nextcloud_ynh.git
synced 2024-09-03 19:55:57 +02:00
Merge b289065015
into 64a5081946
This commit is contained in:
commit
4fb788bcc2
9 changed files with 168 additions and 37 deletions
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"system": {
|
"system": {
|
||||||
|
"maintenance": false,
|
||||||
"updatechecker": false,
|
"updatechecker": false,
|
||||||
"memcache.local": "\\OC\\Memcache\\APCu",
|
"memcache.local": "\\OC\\Memcache\\APCu",
|
||||||
"integrity.check.disabled": true,
|
"integrity.check.disabled": true,
|
||||||
|
@ -12,8 +13,18 @@
|
||||||
"password": ""
|
"password": ""
|
||||||
},
|
},
|
||||||
"hashing_default_password": true,
|
"hashing_default_password": true,
|
||||||
|
"has_internet_connection": true,
|
||||||
|
"default_phone_region": "",
|
||||||
|
"default_timezone": "Europe/Paris",
|
||||||
|
"trashbin_retention_obligation": "auto",
|
||||||
|
"version_retention_obligation": "auto",
|
||||||
|
"enable_previews": true,
|
||||||
|
"defaultapp": "dashboard,files",
|
||||||
|
"lost_password_link": "",
|
||||||
"localstorage.allowsymlinks": true,
|
"localstorage.allowsymlinks": true,
|
||||||
"simpleSignUpLink.shown": false,
|
"simpleSignUpLink.shown": false,
|
||||||
|
"skeletondirectory": "__DATA_DIR__/skeleton/{lang}",
|
||||||
|
|
||||||
"mail_smtpmode": "smtp",
|
"mail_smtpmode": "smtp",
|
||||||
"mail_smtpport": "25",
|
"mail_smtpport": "25",
|
||||||
"mail_smtpauth": 1,
|
"mail_smtpauth": 1,
|
||||||
|
|
|
@ -2,14 +2,96 @@ version = "1.0"
|
||||||
|
|
||||||
[main]
|
[main]
|
||||||
name = "Nextcloud configuration"
|
name = "Nextcloud configuration"
|
||||||
|
services = ["php8.2-fpm"]
|
||||||
|
|
||||||
[main.maintenance_mode]
|
[main.mode]
|
||||||
name = "Maintenance mode"
|
name = "Modes"
|
||||||
|
|
||||||
[main.maintenance_mode.maintenance_mode]
|
[main.mode.maintenance]
|
||||||
ask = "Enable maintenance mode"
|
ask = "Enable maintenance mode"
|
||||||
type = "boolean"
|
type = "boolean"
|
||||||
default = "0"
|
bind = ":__INSTALL_DIR__/config/config.php"
|
||||||
|
|
||||||
|
[main.mode.has_internet_connection]
|
||||||
|
ask = "Internet connection available"
|
||||||
|
type = "boolean"
|
||||||
|
bind = ":__INSTALL_DIR__/config/config.php"
|
||||||
|
help = "Is Nextcloud connected to the Internet or running in a closed network?"
|
||||||
|
|
||||||
|
[main.localization]
|
||||||
|
name = "Localization"
|
||||||
|
|
||||||
|
[main.localization.default_phone_region]
|
||||||
|
ask = "Default phone region"
|
||||||
|
type = "select"
|
||||||
|
bind = ":__INSTALL_DIR__/config/config.php"
|
||||||
|
help = "It is required to allow inserting phone numbers in the user profiles starting without the country code (e.g. +49 for Germany)."
|
||||||
|
|
||||||
|
[main.localization.default_timezone]
|
||||||
|
ask = "Default timezone"
|
||||||
|
type = "select"
|
||||||
|
bind = ":__INSTALL_DIR__/config/config.php"
|
||||||
|
help = "The default timezone parameter is only used when the timezone of the user can’t be determined."
|
||||||
|
|
||||||
|
[main.account]
|
||||||
|
name = "Account"
|
||||||
|
|
||||||
|
[main.account.lost_password_link]
|
||||||
|
ask = "Lost password link"
|
||||||
|
type = "url"
|
||||||
|
bind = ":__INSTALL_DIR__/config/config.php"
|
||||||
|
help = "Allow to redirect on a custom form to require a password reset (for example to ask you to reset it from this YunoHost webadmin)"
|
||||||
|
|
||||||
|
[main.account.logout_url]
|
||||||
|
ask = "Logout URL"
|
||||||
|
type = "url"
|
||||||
|
bind = ":__INSTALL_DIR__/config/config.php"
|
||||||
|
help = "Redirect on this URL when a user click on 'Logout' action"
|
||||||
|
|
||||||
|
[main.files]
|
||||||
|
name = "Files"
|
||||||
|
|
||||||
|
[main.files.skeleton]
|
||||||
|
ask = "To configure the default files created for new users, you can do it by logging on Nextcloud with an admins account and edit files under `New user default files/default` or if you want to target a specific language `New user default files/FR`."
|
||||||
|
type = "alert"
|
||||||
|
style = "info"
|
||||||
|
|
||||||
|
[main.files.trashbin_retention_obligation]
|
||||||
|
ask = "Trashbin retention"
|
||||||
|
type = "string"
|
||||||
|
bind = ":__INSTALL_DIR__/config/config.php"
|
||||||
|
help = "If the trash bin app is enabled (default), this setting defines the policy for when files and folders in the trash bin will be permanently deleted."
|
||||||
|
|
||||||
|
[main.files.version_retention_obligation]
|
||||||
|
ask = "Version retention"
|
||||||
|
type = "string"
|
||||||
|
bind = ":__INSTALL_DIR__/config/config.php"
|
||||||
|
help = "If the versions app is enabled (default), this setting defines the policy for when versions will be permanently deleted."
|
||||||
|
|
||||||
|
[main.files.enable_previews]
|
||||||
|
ask = "Enable previews"
|
||||||
|
type = "boolean"
|
||||||
|
bind = ":__INSTALL_DIR__/config/config.php"
|
||||||
|
help = "Info: Previews of photos and text documents could consume a lot of resources."
|
||||||
|
|
||||||
|
[main.apps]
|
||||||
|
name = "Apps"
|
||||||
|
|
||||||
|
[main.apps.auto_upgrade_apps]
|
||||||
|
ask = "Upgrade apps"
|
||||||
|
type = "select"
|
||||||
|
choices.manual = "Manually"
|
||||||
|
choices.daily = "Daily at 00:10"
|
||||||
|
choices.weekly = "Weekly at 00:10 on Sunday"
|
||||||
|
choices.monthly = "Monthly at 00:10 on the 1st"
|
||||||
|
help = "Keep in mind that upgrade apps could break things in your instance, so you need to strike the right balance between reliability and safety."
|
||||||
|
|
||||||
|
[main.apps.defaultapp]
|
||||||
|
ask = "Default app to display"
|
||||||
|
type = "tags"
|
||||||
|
bind = ":__INSTALL_DIR__/config/config.php"
|
||||||
|
help = "Set the default app to open on login."
|
||||||
|
|
||||||
|
|
||||||
[main.php_fpm_config]
|
[main.php_fpm_config]
|
||||||
name = "PHP-FPM configuration"
|
name = "PHP-FPM configuration"
|
||||||
|
|
|
@ -61,7 +61,7 @@ ram.runtime = "512M"
|
||||||
[resources.install_dir]
|
[resources.install_dir]
|
||||||
|
|
||||||
[resources.data_dir]
|
[resources.data_dir]
|
||||||
subdirs = ["data"]
|
subdirs = ["data", "skeleton"]
|
||||||
|
|
||||||
[resources.permissions]
|
[resources.permissions]
|
||||||
main.url = "/"
|
main.url = "/"
|
||||||
|
@ -77,4 +77,4 @@ ram.runtime = "512M"
|
||||||
|
|
||||||
[resources.database]
|
[resources.database]
|
||||||
type = "mysql"
|
type = "mysql"
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/cron.d/$app"
|
ynh_backup --src_path="/etc/cron.d/$app"
|
||||||
|
ynh_backup --src_path="/etc/cron.d/${app}_upgrade_apps" --not_mandatory
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE MYSQL DATABASE
|
# BACKUP THE MYSQL DATABASE
|
||||||
|
|
|
@ -21,21 +21,21 @@ current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC GETTERS FOR TOML SHORT KEY
|
# SPECIFIC GETTERS FOR TOML SHORT KEY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
get__default_phone_region() {
|
||||||
|
cat << EOF
|
||||||
|
value: "$(ynh_read_var_in_file --file="$install_dir/config/config.php" --key="default_phone_region")"
|
||||||
|
choices:
|
||||||
|
EOF
|
||||||
|
jq '.[][] | " \"\(.alpha_2)\": \"\(.name)\""' -r /usr/share/iso-codes/json/iso_3166-1.json
|
||||||
|
|
||||||
get__maintenance_mode() {
|
}
|
||||||
# Maintenance mode status
|
|
||||||
maintenance_mode_status="$(cd "$install_dir" && ynh_exec_as "$app" \
|
get__default_timezone() {
|
||||||
php${phpversion} --define apc.enable_cli=1 occ --no-interaction --no-ansi maintenance:mode)" 2> /dev/null
|
cat << EOF
|
||||||
if echo $maintenance_mode_status | grep -q "disabled"
|
value: "$(ynh_read_var_in_file --file="$install_dir/config/config.php" --key="default_timezone")"
|
||||||
then
|
choices:
|
||||||
echo "0"
|
EOF
|
||||||
elif echo $maintenance_mode_status | grep -q "enabled"
|
timedatectl list-timezones --no-pager | sed 's/^/ - /g'
|
||||||
then
|
|
||||||
echo "1"
|
|
||||||
else
|
|
||||||
ynh_print_err --message="Unexpected output from maintenance status check command."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get__fpm_footprint() {
|
get__fpm_footprint() {
|
||||||
|
@ -65,19 +65,17 @@ get__fpm_free_footprint() {
|
||||||
# SPECIFIC SETTERS FOR TOML SHORT KEYS
|
# SPECIFIC SETTERS FOR TOML SHORT KEYS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
set__maintenance_mode() {
|
set__auto_upgrade_apps() {
|
||||||
if [ "$maintenance_mode" -eq "0" ]; then
|
declare -A frequencies=( [daily]="10 00 * * *" [weekly]="10 00 * * 0" [monthly]="10 00 1 * *" )
|
||||||
# If maintenance_mode was set to 0, disable maintenance mode
|
if [ "$frequencies[$auto_upgrade_apps]" ]
|
||||||
(cd "$install_dir" && ynh_exec_as "$app" \
|
then
|
||||||
php${phpversion} --define apc.enable_cli=1 occ --no-interaction --no-ansi maintenance:mode --off)
|
echo "${frequencies[$auto_upgrade_apps]} $app /usr/bin/php$phpversion --define apc.enable_cli=1 -f $install_dir/occ app:update --all" > /etc/cron.d/${app}_upgrade_apps
|
||||||
ynh_print_info "Maintenance mode disabled"
|
else
|
||||||
elif [ "$maintenance_mode" -eq "1" ]; then
|
ynh_secure_remove --file=/etc/cron.d/nextcloud_upgrade_apps
|
||||||
# If maintenance_mode was set to 1, enable maintenance mode
|
|
||||||
(cd "$install_dir" && ynh_exec_as "$app" \
|
|
||||||
php${phpversion} --define apc.enable_cli=1 occ --no-interaction --no-ansi maintenance:mode --on)
|
|
||||||
ynh_print_info "Maintenance mode enabled"
|
|
||||||
fi
|
fi
|
||||||
ynh_app_setting_set --app=$app --key=maintenance_mode --value="$maintenance_mode"
|
|
||||||
|
ynh_app_setting_set --app=$app --key=auto_upgrade_apps --value="$auto_upgrade_apps"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set__fpm_footprint() {
|
set__fpm_footprint() {
|
||||||
|
|
|
@ -4,9 +4,24 @@ source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
source _ynh_mysql_connect_as.sh
|
source _ynh_mysql_connect_as.sh
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# INIT STUFF FOR CONFIG PANEL, ETC
|
||||||
|
#=================================================
|
||||||
|
|
||||||
phpflags="--define apc.enable_cli=1"
|
phpflags="--define apc.enable_cli=1"
|
||||||
|
|
||||||
|
ynh_app_setting_set --app=$app --key=maintenance --value=0
|
||||||
ynh_app_setting_set --app=$app --key=phpflags --value=$phpflags
|
ynh_app_setting_set --app=$app --key=phpflags --value=$phpflags
|
||||||
|
ynh_app_setting_set --app=$app --key=has_internet_connection --value=1
|
||||||
|
ynh_app_setting_set --app=$app --key=default_phone_region --value=""
|
||||||
|
ynh_app_setting_set --app=$app --key=default_timezone --value="Europe/Paris"
|
||||||
|
ynh_app_setting_set --app=$app --key=lost_password_link --value=""
|
||||||
|
ynh_app_setting_set --app=$app --key=logout_url --value=""
|
||||||
|
ynh_app_setting_set --app=$app --key=trashbin_retention_obligation --value="auto"
|
||||||
|
ynh_app_setting_set --app=$app --key=version_retention_obligation --value="auto"
|
||||||
|
ynh_app_setting_set --app=$app --key=enable_previews --value=1
|
||||||
|
ynh_app_setting_set --app=$app --key=auto_upgrade_apps --value="manual"
|
||||||
|
ynh_app_setting_set --app=$app --key=defaultapp --value="dashboard,files"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A MYSQL DATABASE
|
# CREATE A MYSQL DATABASE
|
||||||
|
@ -119,6 +134,7 @@ ynh_secure_remove --file="$nc_conf"
|
||||||
nc_conf="$install_dir/config.json"
|
nc_conf="$install_dir/config.json"
|
||||||
ynh_add_config --template="config.json" --destination="$nc_conf"
|
ynh_add_config --template="config.json" --destination="$nc_conf"
|
||||||
|
|
||||||
|
cat $nc_conf
|
||||||
exec_occ config:import "$nc_conf"
|
exec_occ config:import "$nc_conf"
|
||||||
|
|
||||||
# Then remove the config file
|
# Then remove the config file
|
||||||
|
@ -141,11 +157,20 @@ exec_occ ldap:test-config '' \
|
||||||
create_external_storage() {
|
create_external_storage() {
|
||||||
local mount_dir="$1"
|
local mount_dir="$1"
|
||||||
local mount_name="$2"
|
local mount_name="$2"
|
||||||
|
local group="${3:-}"
|
||||||
local mount_id=`exec_occ files_external:create --output=json \
|
local mount_id=`exec_occ files_external:create --output=json \
|
||||||
"$mount_name" 'local' 'null::null' -c "datadir=$mount_dir" || true`
|
"$mount_name" 'local' 'null::null' -c "datadir=$mount_dir" || true`
|
||||||
! [[ $mount_id =~ ^[0-9]+$ ]] \
|
if ! [[ $mount_id =~ ^[0-9]+$ ]]
|
||||||
&& ynh_print_warn --message="Unable to create external storage" \
|
then
|
||||||
|| exec_occ files_external:option "$mount_id" enable_sharing true
|
ynh_print_warn --message="Unable to create external storage"
|
||||||
|
else
|
||||||
|
exec_occ files_external:option "$mount_id" enable_sharing true
|
||||||
|
if [ "$group" != "" ]
|
||||||
|
then
|
||||||
|
exec_occ group:list
|
||||||
|
exec_occ files_external:applicable "$mount_id" --add-group="$group"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Enable External Storage and create local mount to home folder
|
# Enable External Storage and create local mount to home folder
|
||||||
|
@ -229,6 +254,14 @@ create_external_storage "/home/yunohost.multimedia/share" "Shared multimedia"
|
||||||
# Allow nextcloud to write into these directories
|
# Allow nextcloud to write into these directories
|
||||||
ynh_multimedia_addaccess $app
|
ynh_multimedia_addaccess $app
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# EASY SKELETON CONFIGURATION
|
||||||
|
#================================================
|
||||||
|
ynh_script_progression --message="Easying skeleton configuration..." --weight=1
|
||||||
|
|
||||||
|
cp -a --no-target-directory $install_dir/core/skeleton "$data_dir/skeleton/default"
|
||||||
|
create_external_storage "$data_dir/skeleton" "New users default files" "admins"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -240,8 +273,8 @@ chown -R $app:www-data "$install_dir"
|
||||||
chown -R $app: "$data_dir"
|
chown -R $app: "$data_dir"
|
||||||
find $install_dir/ -type f -print0 | xargs -r0 chmod 0644
|
find $install_dir/ -type f -print0 | xargs -r0 chmod 0644
|
||||||
find $install_dir/ -type d -print0 | xargs -r0 chmod 0755
|
find $install_dir/ -type d -print0 | xargs -r0 chmod 0755
|
||||||
find $data_dir/data/ -type f -print0 | xargs -r0 chmod 0640
|
find $data_dir/ -type f -print0 | xargs -r0 chmod 0640
|
||||||
find $data_dir/data/ -type d -print0 | xargs -r0 chmod 0750
|
find $data_dir/ -type d -print0 | xargs -r0 chmod 0750
|
||||||
chmod 640 "$install_dir/config/config.php"
|
chmod 640 "$install_dir/config/config.php"
|
||||||
chmod 755 /home/yunohost.app
|
chmod 755 /home/yunohost.app
|
||||||
chmod 750 $install_dir
|
chmod 750 $install_dir
|
||||||
|
|
|
@ -25,6 +25,7 @@ ynh_remove_fail2ban_config
|
||||||
# Remove a cron file
|
# Remove a cron file
|
||||||
# TODO: Ensure that cron job is not running (How !?)
|
# TODO: Ensure that cron job is not running (How !?)
|
||||||
ynh_secure_remove --file="/etc/cron.d/$app"
|
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||||
|
ynh_secure_remove --file="/etc/cron.d/${app}_upgrade_apps"
|
||||||
|
|
||||||
# Cleaning ACL in home directories
|
# Cleaning ACL in home directories
|
||||||
for i in $(ls /home); do
|
for i in $(ls /home); do
|
||||||
|
|
|
@ -52,6 +52,7 @@ fi
|
||||||
ynh_script_progression --message="Restoring cron job..." --weight=1
|
ynh_script_progression --message="Restoring cron job..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
||||||
|
ynh_restore_file --origin_path="/etc/cron.d/${app}_upgrade_apps" --not_mandatory
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE LOGROTATE CONFIGURATION
|
# BACKUP THE LOGROTATE CONFIGURATION
|
||||||
|
|
|
@ -19,6 +19,10 @@ if [ -z "${phpflags:-}" ]; then
|
||||||
ynh_app_setting_set --app=$app --key=phpflags --value=$phpflags
|
ynh_app_setting_set --app=$app --key=phpflags --value=$phpflags
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "${auto_upgrade_apps:-}" ]; then
|
||||||
|
ynh_app_setting_set --app=$app --key=auto_upgrade_apps --value="manual"
|
||||||
|
fi
|
||||||
|
|
||||||
# Delete existing ini configuration file (backward compatibility)
|
# Delete existing ini configuration file (backward compatibility)
|
||||||
if [ -f /etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini ]; then
|
if [ -f /etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini ]; then
|
||||||
ynh_secure_remove --file=/etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini
|
ynh_secure_remove --file=/etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini
|
||||||
|
|
Loading…
Add table
Reference in a new issue