1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/nextcloud_ynh.git synced 2024-09-03 19:55:57 +02:00

[wip] Auto upgrade apps

This commit is contained in:
ljf 2023-12-11 00:48:23 +01:00
parent 40355e522b
commit 2ea70c5850
No known key found for this signature in database
3 changed files with 22 additions and 5 deletions

View file

@ -72,10 +72,14 @@ services = ["php8.2-fpm"]
[main.apps] [main.apps]
name = "Apps" name = "Apps"
[main.apps.auto_update] [main.apps.auto_upgrade_apps]
ask = "Auto update apps" ask = "Upgrade apps"
type = "boolean" type = "select"
help = "Automatically update apps each night" 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] [main.apps.defaultapp]
ask = "Default app to display" ask = "Default app to display"

View file

@ -65,6 +65,19 @@ get__free_footprint() {
# SPECIFIC SETTERS FOR TOML SHORT KEYS # SPECIFIC SETTERS FOR TOML SHORT KEYS
#================================================= #=================================================
set__auto_upgrade_apps() {
declare -A frequencies=( [daily]="10 00 * * *" [weekly]="10 00 * * 0" [monthly]="10 00 1 * *" )
if [ "$frequencies[$auto_upgrade_apps]" ]
then
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/nextcloud_upgrade_apps
else
ynh_secure_remove --file=/etc/cron.d/nextcloud_upgrade_apps
fi
ynh_app_setting_set --app=$app --key=auto_upgrade_apps --value="$auto_upgrade_apps"
}
set__fpm_footprint() { set__fpm_footprint() {
if [ "$fpm_footprint" != "specific" ] if [ "$fpm_footprint" != "specific" ]
then then

View file

@ -38,7 +38,7 @@ 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=trashbin_retention_obligation --value="auto"
ynh_app_setting_set --app=$app --key=version_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=enable_previews --value=1
ynh_app_setting_set --app=$app --key=auto_update --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" ynh_app_setting_set --app=$app --key=defaultapp --value="dashboard,files"
#================================================= #=================================================