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:
parent
40355e522b
commit
2ea70c5850
3 changed files with 22 additions and 5 deletions
|
@ -72,10 +72,14 @@ services = ["php8.2-fpm"]
|
|||
[main.apps]
|
||||
name = "Apps"
|
||||
|
||||
[main.apps.auto_update]
|
||||
ask = "Auto update apps"
|
||||
type = "boolean"
|
||||
help = "Automatically update apps each night"
|
||||
[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"
|
||||
|
|
|
@ -65,6 +65,19 @@ get__free_footprint() {
|
|||
# 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() {
|
||||
if [ "$fpm_footprint" != "specific" ]
|
||||
then
|
||||
|
|
|
@ -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=version_retention_obligation --value="auto"
|
||||
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"
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue