1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/weblate_ynh.git synced 2024-10-01 13:35:04 +02:00
This commit is contained in:
Éric Gaspar 2024-09-18 20:34:28 +02:00
parent 77439578ea
commit cd60686646
6 changed files with 25 additions and 70 deletions

View file

@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -13,30 +12,16 @@ ynh_print_info "Declaring files to be backed up..."
ynh_backup "$install_dir" ynh_backup "$install_dir"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # SYSTEM CONFIGURATION
#================================================= #=================================================
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_backup "/etc/logrotate.d/$app" ynh_backup "/etc/logrotate.d/$app"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup "/etc/systemd/system/$app.service" ynh_backup "/etc/systemd/system/$app.service"
ynh_backup "/etc/systemd/system/$app-celery.service" ynh_backup "/etc/systemd/system/$app-celery.service"
#=================================================
# BACKUP VARIOUS FILES
#=================================================
ynh_backup "/etc/uwsgi/apps-available/$app.ini" ynh_backup "/etc/uwsgi/apps-available/$app.ini"
#================================================= #=================================================

View file

@ -18,8 +18,6 @@ ynh_script_progression "Updating NGINX web server configuration..."
ynh_config_change_url_nginx ynh_config_change_url_nginx
#=================================================
# SPECIFIC MODIFICATIONS
#================================================= #=================================================
# MODIFY SETTINGS # MODIFY SETTINGS
#================================================= #=================================================

View file

@ -37,19 +37,17 @@ ynh_script_progression "Setting up source files..."
mkdir -p "$install_dir/avatar-cache" mkdir -p "$install_dir/avatar-cache"
mkdir -p "$install_dir/data" mkdir -p "$install_dir/data"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir" chmod 750 "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression "Configuring NGINX web server..." ynh_script_progression "Configuring NGINX web server..."
# Create a dedicated NGINX config
ynh_config_add_nginx ynh_config_add_nginx
#=================================================
# SPECIFIC SETUP
#================================================= #=================================================
# INSTALL XXHASH # INSTALL XXHASH
#================================================= #=================================================
@ -84,7 +82,7 @@ fi
ynh_script_progression "Install weblate using PIP..." ynh_script_progression "Install weblate using PIP..."
virtualenv --python=python3 "${install_dir}/venv" virtualenv --python=python3 "${install_dir}/venv"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app: "$install_dir" chown -R $app: "$install_dir"
#run source in a 'sub shell' #run source in a 'sub shell'
( (
set +o nounset set +o nounset
@ -124,10 +122,10 @@ touch "$install_dir/local_settings.py"
ln -sf "$install_dir/local_settings.py" "$install_dir/venv/lib/$weblate_pypath/site-packages/weblate/local_settings.py" ln -sf "$install_dir/local_settings.py" "$install_dir/venv/lib/$weblate_pypath/site-packages/weblate/local_settings.py"
# Set permissions to app files # Set permissions to app files
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir" chmod 750 "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app: "$install_dir" chown -R $app: "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown "$app:www-data" "$install_dir" chown "$app:www-data" "$install_dir"
chown -R "$app:www-data" "$install_dir/data" chown -R "$app:www-data" "$install_dir/data"
#================================================= #=================================================

View file

@ -4,49 +4,24 @@ source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# STANDARD REMOVE # REMOVE SYSTEM CONFIGURATIONS
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#================================================= #=================================================
ynh_script_progression "Removing system configurations related to $app..."
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_hide_warnings yunohost service status $app >/dev/null; then
if ynh_hide_warnings yunohost service status $app >/dev/null
then
ynh_script_progression "Removing $app service integration..."
yunohost service remove $app yunohost service remove $app
fi fi
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_hide_warnings yunohost service status "$app-celery" >/dev/null; then
if ynh_hide_warnings yunohost service status "$app-celery" >/dev/null
then
ynh_script_progression "Removing $app-celery service integration..."
yunohost service remove "$app-celery" yunohost service remove "$app-celery"
fi fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression "Stopping and removing the systemd service..."
# Remove the dedicated systemd config
ynh_config_remove_systemd ynh_config_remove_systemd
ynh_config_remove_systemd"$app-celery" ynh_config_remove_systemd"$app-celery"
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression "Removing logrotate configuration..."
# Remove the app-specific logrotate config
ynh_config_remove_logrotate ynh_config_remove_logrotate
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression "Removing NGINX web server configuration..."
# Remove the dedicated NGINX config
ynh_config_remove_nginx ynh_config_remove_nginx
#================================================= #=================================================
@ -62,8 +37,6 @@ pushd $tempdir
popd popd
ynh_safe_rm "$tempdir" ynh_safe_rm "$tempdir"
#=================================================
# SPECIFIC REMOVE
#================================================= #=================================================
# REMOVE VARIOUS FILES # REMOVE VARIOUS FILES
#================================================= #=================================================

View file

@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -14,10 +13,10 @@ ynh_restore "$install_dir"
touch "$install_dir/local_settings.py" touch "$install_dir/local_settings.py"
ln -sf "$install_dir/local_settings.py" "$install_dir/venv/lib/$weblate_pypath/site-packages/weblate/local_settings.py" ln -sf "$install_dir/local_settings.py" "$install_dir/venv/lib/$weblate_pypath/site-packages/weblate/local_settings.py"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir" chmod 750 "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app: "$install_dir" chown -R $app: "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:www-data "$install_dir" chown $app:www-data "$install_dir"
chown -R $app:www-data "$install_dir/data" chown -R $app:www-data "$install_dir/data"
#================================================= #=================================================

View file

@ -104,7 +104,7 @@ upgrade() {
ynh_safe_rm "${install_dir}/venv" ynh_safe_rm "${install_dir}/venv"
virtualenv --python=python3 "${install_dir}/venv" virtualenv --python=python3 "${install_dir}/venv"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app: "$install_dir" chown -R $app: "$install_dir"
#run source in a 'sub shell' #run source in a 'sub shell'
( (
set +o nounset set +o nounset
@ -128,6 +128,7 @@ upgrade() {
# MODIFY A CONFIG FILE # MODIFY A CONFIG FILE
#================================================= #=================================================
ynh_script_progression "Create weblate configuration file..." ynh_script_progression "Create weblate configuration file..."
# save old settings file # save old settings file
settings="$install_dir/venv/lib/$weblate_pypath/site-packages/weblate/settings.py" settings="$install_dir/venv/lib/$weblate_pypath/site-packages/weblate/settings.py"
path="${path%/}" path="${path%/}"
@ -199,12 +200,13 @@ upgrade $(ynh_app_upstream_version) "../conf/settings.py"
# Set right permissions for curl installation # Set right permissions for curl installation
mkdir -p "$install_dir/avatar-cache" mkdir -p "$install_dir/avatar-cache"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app: "$install_dir" chown -R $app: "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown "$app:www-data" "$install_dir" chown "$app:www-data" "$install_dir"
chown -R "$app:www-data" "$install_dir/data" chown -R "$app:www-data" "$install_dir/data"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir" chmod 750 "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
#================================================= #=================================================