mirror of
https://github.com/YunoHost-Apps/nextcloud_ynh.git
synced 2024-09-03 19:55:57 +02:00
remove upgrade_type
This commit is contained in:
parent
aa462e904f
commit
09219ab72d
1 changed files with 154 additions and 160 deletions
152
scripts/upgrade
152
scripts/upgrade
|
@ -3,8 +3,6 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -148,31 +146,28 @@ then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
ynh_script_progression --message="Upgrading $app..." --weight=3
|
||||||
then
|
|
||||||
ynh_script_progression --message="Upgrading $app..." --weight=3
|
|
||||||
|
|
||||||
# Set write access for the following commands
|
# Set write access for the following commands
|
||||||
chown -R $app: "$install_dir" "$data_dir"
|
chown -R $app: "$install_dir" "$data_dir"
|
||||||
|
|
||||||
# Print the current version number of Nextcloud
|
# Print the current version number of Nextcloud
|
||||||
exec_occ -V
|
exec_occ -V
|
||||||
|
|
||||||
|
|
||||||
# Upgrade may fail if this app is enabled
|
# Upgrade may fail if this app is enabled
|
||||||
# Take all apps enabled, and check if mail is one of them
|
# Take all apps enabled, and check if mail is one of them
|
||||||
# Then temporary disable the mail app
|
# Then temporary disable the mail app
|
||||||
mail_app_must_be_reactived=0
|
mail_app_must_be_reactived=0
|
||||||
|
|
||||||
if exec_occ app:list | awk '/Enabled/{f=1;next} /Disabled/{f=0} f' | grep -q -w mail; then
|
if exec_occ app:list | awk '/Enabled/{f=1;next} /Disabled/{f=0} f' | grep -q -w mail; then
|
||||||
exec_occ app:disable mail
|
exec_occ app:disable mail
|
||||||
mail_app_must_be_reactived=1
|
mail_app_must_be_reactived=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# While the current version is not the last version, do an upgrade
|
|
||||||
while [ "$last_version" != "$current_version" ]
|
|
||||||
do
|
|
||||||
|
|
||||||
|
# While the current version is not the last version, do an upgrade
|
||||||
|
while [ "$last_version" != "$current_version" ]
|
||||||
|
do
|
||||||
next_major_version="$(( $current_major_version + 1 ))"
|
next_major_version="$(( $current_major_version + 1 ))"
|
||||||
if [[ "$next_major_version" -ge "$last_major_version" ]]; then
|
if [[ "$next_major_version" -ge "$last_major_version" ]]; then
|
||||||
ynh_print_info --message="Upgrading to Nextcloud $last_version"
|
ynh_print_info --message="Upgrading to Nextcloud $last_version"
|
||||||
|
@ -226,81 +221,81 @@ then
|
||||||
|
|
||||||
# Print the current version number of Nextcloud
|
# Print the current version number of Nextcloud
|
||||||
exec_occ -V
|
exec_occ -V
|
||||||
done
|
done
|
||||||
|
|
||||||
exec_occ db:add-missing-indices -n
|
exec_occ db:add-missing-indices -n
|
||||||
exec_occ db:add-missing-columns -n
|
exec_occ db:add-missing-columns -n
|
||||||
exec_occ db:add-missing-primary-keys -n
|
exec_occ db:add-missing-primary-keys -n
|
||||||
exec_occ db:convert-filecache-bigint -n
|
exec_occ db:convert-filecache-bigint -n
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE NEXTCLOUD
|
# CONFIGURE NEXTCLOUD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reconfiguring $app..." --weight=9
|
ynh_script_progression --message="Reconfiguring $app..." --weight=9
|
||||||
|
|
||||||
# Verify the checksum and backup the file if it's different
|
# Verify the checksum and backup the file if it's different
|
||||||
ynh_backup_if_checksum_is_different --file="$install_dir/config/config.php"
|
ynh_backup_if_checksum_is_different --file="$install_dir/config/config.php"
|
||||||
|
|
||||||
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"
|
||||||
|
|
||||||
# Reneable the mail app
|
# Reneable the mail app
|
||||||
if [ $mail_app_must_be_reactived -eq 1 ]; then
|
if [ $mail_app_must_be_reactived -eq 1 ]; then
|
||||||
exec_occ app:enable mail
|
exec_occ app:enable mail
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure that UpdateNotification app is disabled
|
# Ensure that UpdateNotification app is disabled
|
||||||
exec_occ app:disable updatenotification
|
exec_occ app:disable updatenotification
|
||||||
|
|
||||||
# Enable LDAP plugin
|
# Enable LDAP plugin
|
||||||
exec_occ app:enable user_ldap
|
exec_occ app:enable user_ldap
|
||||||
|
|
||||||
# Update all installed apps
|
# Update all installed apps
|
||||||
exec_occ app:update --all
|
exec_occ app:update --all
|
||||||
|
|
||||||
# move the logs from the data_dir to the standard /var/log
|
# move the logs from the data_dir to the standard /var/log
|
||||||
# it would be better in the ENSURE DOWNWARD COMPATIBILITY section
|
# it would be better in the ENSURE DOWNWARD COMPATIBILITY section
|
||||||
# but it must be after the exec_occ() definition, so it's here
|
# but it must be after the exec_occ() definition, so it's here
|
||||||
if [ -f "$data_dir/data/nextcloud.log" ]; then
|
if [ -f "$data_dir/data/nextcloud.log" ]; then
|
||||||
mkdir -p "/var/log/$app"
|
mkdir -p "/var/log/$app"
|
||||||
chmod 750 "/var/log/$app"
|
chmod 750 "/var/log/$app"
|
||||||
mv "$data_dir"/data/nextcloud.log* "/var/log/$app"
|
mv "$data_dir"/data/nextcloud.log* "/var/log/$app"
|
||||||
# adapt the nextcloud config
|
# adapt the nextcloud config
|
||||||
exec_occ config:system:set logfile --value="/var/log/$app/nextcloud.log"
|
exec_occ config:system:set logfile --value="/var/log/$app/nextcloud.log"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Load the config file in nextcloud
|
# Load the config file in nextcloud
|
||||||
exec_occ config:import "$nc_conf"
|
exec_occ config:import "$nc_conf"
|
||||||
|
|
||||||
# Then remove the config file
|
# Then remove the config file
|
||||||
ynh_secure_remove --file="$nc_conf"
|
ynh_secure_remove --file="$nc_conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ALLOW USERS TO DISCONNECT FROM NEXTCLOUD
|
# ALLOW USERS TO DISCONNECT FROM NEXTCLOUD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Add dynamic logout URL to the config
|
# Add dynamic logout URL to the config
|
||||||
exec_occ config:system:get logout_url >/dev/null 2>&1 \
|
exec_occ config:system:get logout_url >/dev/null 2>&1 \
|
||||||
|| echo "
|
|| echo "
|
||||||
//-YunoHost-
|
//-YunoHost-
|
||||||
// set logout_url according to main domain
|
// set logout_url according to main domain
|
||||||
\$main_domain = exec('cat /etc/yunohost/current_host');
|
\$main_domain = exec('cat /etc/yunohost/current_host');
|
||||||
\$CONFIG['logout_url'] = 'https://'.\$main_domain.'/yunohost/sso/?action=logout';
|
\$CONFIG['logout_url'] = 'https://'.\$main_domain.'/yunohost/sso/?action=logout';
|
||||||
//-YunoHost-
|
//-YunoHost-
|
||||||
" >> "$install_dir/config/config.php"
|
" >> "$install_dir/config/config.php"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHANGE HOSTNAME FOR ACTIVITY NOTIFICATIONS
|
# CHANGE HOSTNAME FOR ACTIVITY NOTIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
exec_occ config:system:set overwrite.cli.url --value="https://${domain}${path}"
|
exec_occ config:system:set overwrite.cli.url --value="https://${domain}${path}"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MOUNT HOME FOLDERS AS EXTERNAL STORAGE
|
# MOUNT HOME FOLDERS AS EXTERNAL STORAGE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Enable External Storage and create local mount to home folder as needed
|
# Enable External Storage and create local mount to home folder as needed
|
||||||
if [ $user_home -eq 1 ]; then
|
if [ $user_home -eq 1 ]; then
|
||||||
exec_occ app:enable files_external
|
exec_occ app:enable files_external
|
||||||
exec_occ files_external:list --output=json \
|
exec_occ files_external:list --output=json \
|
||||||
| grep -q '"storage":"\\\\OC\\\\Files\\\\Storage\\\\Local"' \
|
| grep -q '"storage":"\\\\OC\\\\Files\\\\Storage\\\\Local"' \
|
||||||
|
@ -309,16 +304,15 @@ then
|
||||||
for u in $(ynh_user_list); do
|
for u in $(ynh_user_list); do
|
||||||
setfacl --modify g:$app:rwx "/home/$u" || true
|
setfacl --modify g:$app:rwx "/home/$u" || true
|
||||||
done
|
done
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STORE THE CHECKSUM OF THE CONFIG FILE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Calculate and store the config file checksum into the app settings
|
|
||||||
ynh_store_file_checksum --file="${install_dir}/config/config.php"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STORE THE CHECKSUM OF THE CONFIG FILE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Calculate and store the config file checksum into the app settings
|
||||||
|
ynh_store_file_checksum --file="${install_dir}/config/config.php"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REGEN PERMISSIONS
|
# REGEN PERMISSIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue