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
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -13,30 +12,16 @@ ynh_print_info "Declaring files to be backed up..."
ynh_backup "$install_dir"
#=================================================
# BACKUP THE NGINX CONFIGURATION
# SYSTEM CONFIGURATION
#=================================================
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_backup "/etc/logrotate.d/$app"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup "/etc/systemd/system/$app.service"
ynh_backup "/etc/systemd/system/$app-celery.service"
#=================================================
# BACKUP VARIOUS FILES
#=================================================
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
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# 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/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"
#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"
#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"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression "Configuring NGINX web server..."
# Create a dedicated NGINX config
ynh_config_add_nginx
#=================================================
# SPECIFIC SETUP
#=================================================
# INSTALL XXHASH
#=================================================
@ -84,7 +82,7 @@ fi
ynh_script_progression "Install weblate using PIP..."
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'
(
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"
# 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"
#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"
#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"
#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"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app: "$install_dir"
chown "$app:www-data" "$install_dir"
chown -R "$app:www-data" "$install_dir/data"
#=================================================

View file

@ -4,49 +4,24 @@ source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
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
ynh_script_progression "Removing $app service integration..."
if ynh_hide_warnings yunohost service status $app >/dev/null; then
yunohost service remove $app
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
ynh_script_progression "Removing $app-celery service integration..."
if ynh_hide_warnings yunohost service status "$app-celery" >/dev/null; then
yunohost service remove "$app-celery"
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"$app-celery"
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression "Removing logrotate configuration..."
# Remove the app-specific logrotate config
ynh_config_remove_logrotate
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression "Removing NGINX web server configuration..."
# Remove the dedicated NGINX config
ynh_config_remove_nginx
#=================================================
@ -62,8 +37,6 @@ pushd $tempdir
popd
ynh_safe_rm "$tempdir"
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================

View file

@ -1,6 +1,5 @@
#!/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 /usr/share/yunohost/helpers
@ -14,10 +13,10 @@ ynh_restore "$install_dir"
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"
#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"
#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"
#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"
#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"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app: "$install_dir"
chown $app:www-data "$install_dir"
chown -R $app:www-data "$install_dir/data"
#=================================================

View file

@ -104,7 +104,7 @@ upgrade() {
ynh_safe_rm "${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'
(
set +o nounset
@ -128,6 +128,7 @@ upgrade() {
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression "Create weblate configuration file..."
# save old settings file
settings="$install_dir/venv/lib/$weblate_pypath/site-packages/weblate/settings.py"
path="${path%/}"
@ -199,12 +200,13 @@ upgrade $(ynh_app_upstream_version) "../conf/settings.py"
# Set right permissions for curl installation
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"
#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 -R $app: "$install_dir"
chown "$app:www-data" "$install_dir"
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"
#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 750 "$install_dir"
chmod -R o-rwx "$install_dir"
#=================================================
# SETUP LOGROTATE
#=================================================