1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/flohmarkt_ynh.git synced 2024-09-03 18:36:30 +02:00

get rid of multiple building of paths

This commit is contained in:
Chris Vogel 2024-06-18 14:28:35 +02:00
parent 2370749704
commit 9185ed91ec
3 changed files with 15 additions and 13 deletions

View file

@ -25,6 +25,8 @@ flohmarkt_install="$install_dir"
flohmarkt_sym_install="$( dirname $flohmarkt_install )/$flohmarkt_filename" flohmarkt_sym_install="$( dirname $flohmarkt_install )/$flohmarkt_filename"
flohmarkt_venv_dir="${flohmarkt_install}/venv" flohmarkt_venv_dir="${flohmarkt_install}/venv"
flohmarkt_app_dir="${flohmarkt_install}/app" flohmarkt_app_dir="${flohmarkt_install}/app"
flohmarkt_cron_job="/etc/cron.hourly/${app}"
flohmarkt_urlwatch_dir="${flohmarkt_install}/urlwatch"
# directory containing logfiles # directory containing logfiles
flohmarkt_log_dir="/var/log/${app}" flohmarkt_log_dir="/var/log/${app}"
flohmarkt_sym_log_dir="/var/log/${flohmarkt_filename}" flohmarkt_sym_log_dir="/var/log/${flohmarkt_filename}"
@ -770,24 +772,24 @@ flohmarkt_ynh_venv_requirements() {
} }
flohmarkt_ynh_urlwatch_cron() { flohmarkt_ynh_urlwatch_cron() {
mkdir -m 750 -p "${flohmarkt_install}/urlwatch" mkdir -m 750 -p "${flohmarkt_urlwatch_dir}"
chown ${app}:root "${flohmarkt_install}/urlwatch" chown ${app}:root "${flohmarkt_urlwatch_dir}"
ynh_add_config --template="../conf/urlwatch_config.yaml" \ ynh_add_config --template="../conf/urlwatch_config.yaml" \
--destination="${flohmarkt_install}/urlwatch/config.yaml" --destination="${flohmarkt_urlwatch_dir}/config.yaml"
ynh_add_config --template="../conf/urlwatch_urls.yaml" \ ynh_add_config --template="../conf/urlwatch_urls.yaml" \
--destination="${flohmarkt_install}/urlwatch/urls.yaml" --destination="${flohmarkt_urlwatch_dir}/urls.yaml"
ynh_add_config --template="../conf/urlwatch.cron" \ ynh_add_config --template="../conf/urlwatch.cron" \
--destination="/etc/cron.hourly/${app}" --destination="${flohmarkt_cron_job}"
chown root:root "/etc/cron.hourly/${app}" chown root:root "${flohmarkt_cron_job}"
chmod 755 "/etc/cron.hourly/${app}" chmod 755 "${flohmarkt_cron_job}"
# run urlwatch once to initialize if cache file does not exist, # run urlwatch once to initialize if cache file does not exist,
# but if sending email fails (like on CI) just warn. We do not want # but if sending email fails (like on CI) just warn. We do not want
# to show the output that might contain passwords # to show the output that might contain passwords
if ! [[ -s /var/www/${app}/urlwatch/cache.file ]] && if ! [[ -s ${flohmarkt_urlwatch_dir}/cache.file ]] &&
! ynh_exec_fully_quiet sudo -u ${app} urlwatch \ ! ynh_exec_fully_quiet sudo -u ${app} urlwatch \
--config=/var/www/${app}/urlwatch/config.yaml \ --config=${flohmarkt_urlwatch_dir}/config.yaml \
--urls=/var/www/${app}/urlwatch/urls.yaml \ --urls=${flohmarkt_urlwatch_dir}/urls.yaml \
--cache=/var/www/${app}/urlwatch/cache.file --cache=${flohmarkt_urlwatch_dir}/cache.file
then then
ynh_print_warn --message="initial call to urlwatch failed" ynh_print_warn --message="initial call to urlwatch failed"
fi fi

View file

@ -11,7 +11,7 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/etc/logrotate.d/$app"
ynh_backup --src_path="/opt/couchdb/etc/local.d/05-flohmarkt.ini" ynh_backup --src_path="/opt/couchdb/etc/local.d/05-flohmarkt.ini"
ynh_backup --src_path="/etc/systemd/system/$flohmarkt_filename.service" ynh_backup --src_path="/etc/systemd/system/$flohmarkt_filename.service"
ynh_backup --src_path="/etc/cron.hourly/$flohmarkt_filename" ynh_backup --src_path="${flohmarkt_cron_job}"
ynh_backup --src_path="${flohmarkt_log_dir}" ynh_backup --src_path="${flohmarkt_log_dir}"
# for the following backups we'll want to stop flohmarkt and couchdb # for the following backups we'll want to stop flohmarkt and couchdb

View file

@ -86,6 +86,6 @@ flohmarkt_ynh_create_symlinks
# restore cronjob file for urlwatch # restore cronjob file for urlwatch
ynh_script_progression --message="Restoring cronjob for urlwatch..." --weight=1 ynh_script_progression --message="Restoring cronjob for urlwatch..." --weight=1
ynh_restore_file --origin_path="/etc/cron.hourly/$flohmarkt_filename" ynh_restore_file --origin_path="${flohmarkt_cron_job}"
ynh_script_progression --message="Restoration completed for $app" --last ynh_script_progression --message="Restoration completed for $app" --last