1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/flohmarkt_ynh.git synced 2024-09-03 18:36:30 +02:00
flohmarkt_ynh/scripts/_common.sh
Chris Vogel b943dfa6f1 paths and filenames - part II
adjusted paths after trying, thinking and talking to people in the matrix room again.
2024-05-07 12:18:36 +02:00

68 lines
2.3 KiB
Bash

#!/bin/bash
#=================================================
# COMMON VARIABLES
#=================================================
## new filenames starting 0.00~ynh5
# make a filename/service name from domain/path
if [[ "$path" == /* ]]; then
url_path="${path:1}"
fi
if [[ "__${url_path}__" == '____' ]]; then
flohmarkt_filename="$domain"
else
flohmarkt_filename="$domain-${url_path}"
fi
# this filename is used for logfile name and systemd.service name
# and for symlinking install_dir and data_dir
flohmarkt_filename="${YNH_APP_ID}_${flohmarkt_filename//[^A-Za-z0-9._-]/_}"
# directory flohmarkts software is installed to
# contains ./venv and ./src as sub-directories
flohmarkt_install="$install_dir"
flohmarkt_sym_install="$( dirname $flohmarkt_install )/$flohmarkt_filename"
flohmarkt_venv_dir="${flohmarkt_install}/venv"
flohmarkt_app_dir="${flohmarkt_install}/app"
# directory containing logfiles
flohmarkt_log_dir="/var/log/${YNH_APP_ID}/${flohmarkt_filename}"
# filename for logfiles - ¡ojo! if not ends with .log will be interpreted
# as a directory by ynh_use_logrotate
# https://github.com/YunoHost/issues/issues/2383
flohmarkt_logfile="${flohmarkt_log_dir}/${app}.log"
# flohmarkt data_dir
flohmarkt_data_dir="$data_dir"
flohmarkt_sym_data_dir="$( dirname $flohmarkt_data_dir )/$flohmarkt_filename"
## old filenames before 0.00~ynh5 - for reference and needed to
# migrate (see below)
flohmarkt_old_install="$install_dir/$app/"
flohmarkt_old_venv_dir="$install_dir/venv"
flohmarkt_old_log_dir="/var/log/$app/"
flohmarkt_old_logfile="$app"
flohmarkt_old_service="$app"
#=================================================
# PERSONAL HELPERS
#=================================================
# move files and directories to their new places
flohmarkt_ynh_upgrade_path_ynh5() {
# flohmarkt and couchdb are already stopped in upgrade script
# move install_dir
# move venv_dir
# move data_dir
# move systemd.service
# move logfiles
# update settings for above
false
# there's still some work open - see above
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================