mirror of
https://github.com/YunoHost-Apps/ihatemoney_ynh.git
synced 2024-09-03 19:26:15 +02:00
Indent with spaces
This commit is contained in:
parent
4c5d6ed057
commit
aa7001d195
2 changed files with 34 additions and 34 deletions
|
@ -18,8 +18,8 @@ source /usr/share/yunohost/helpers
|
||||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
||||||
yunohost service remove $app
|
yunohost service remove $app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -17,9 +17,9 @@ ynh_script_progression --message="Checking version..."
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
if ynh_compare_current_package_version --comparison le --version "4.1.5~ynh2"; then
|
if ynh_compare_current_package_version --comparison le --version "4.1.5~ynh2"; then
|
||||||
upgrade_from_opt=true
|
upgrade_from_opt=true
|
||||||
else
|
else
|
||||||
upgrade_from_opt=false
|
upgrade_from_opt=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -29,9 +29,9 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [[ "$upgrade_from_opt" == "false" ]]; then
|
if [[ "$upgrade_from_opt" == "false" ]]; then
|
||||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="stop"
|
ynh_systemd_action --service_name=$app --action="stop"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -43,50 +43,50 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
# MIGRATION: Remove old code (from pre-4.1.5 versions, not using venv)
|
# MIGRATION: Remove old code (from pre-4.1.5 versions, not using venv)
|
||||||
if [[ "$upgrade_from_opt" == "true" ]]; then
|
if [[ "$upgrade_from_opt" == "true" ]]; then
|
||||||
|
|
||||||
# Remove legacy install dir
|
# Remove legacy install dir
|
||||||
ynh_secure_remove /opt/yunohost/ihatemoney
|
ynh_secure_remove /opt/yunohost/ihatemoney
|
||||||
|
|
||||||
# Remove legacy Supervisor config
|
# Remove legacy Supervisor config
|
||||||
rm -f /etc/supervisor/conf.d/ihatemoney.conf
|
rm -f /etc/supervisor/conf.d/ihatemoney.conf
|
||||||
|
|
||||||
if [ -e /etc/ihatemoney/settings.py ]; then
|
if [ -e /etc/ihatemoney/settings.py ]; then
|
||||||
# Strip out the no longer used part of the settings
|
# Strip out the no longer used part of the settings
|
||||||
python3 -c "d = open('/etc/ihatemoney/settings.py').read().replace('try:\n from settings import *\nexcept ImportError:\n pass\n', ''); open('/etc/ihatemoney/settings.py', 'w').write(d)"
|
python3 -c "d = open('/etc/ihatemoney/settings.py').read().replace('try:\n from settings import *\nexcept ImportError:\n pass\n', ''); open('/etc/ihatemoney/settings.py', 'w').write(d)"
|
||||||
# Rename
|
# Rename
|
||||||
mv /etc/ihatemoney/settings.py "/etc/ihatemoney/ihatemoney.cfg"
|
mv /etc/ihatemoney/settings.py "/etc/ihatemoney/ihatemoney.cfg"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for old_file in "/etc/ihatemoney/ihatemoney.cfg" "/etc/$app/gunicorn.conf.py"; do
|
for old_file in "/etc/ihatemoney/ihatemoney.cfg" "/etc/$app/gunicorn.conf.py"; do
|
||||||
ynh_backup_if_checksum_is_different --file="$old_file"
|
ynh_backup_if_checksum_is_different --file="$old_file"
|
||||||
ynh_delete_file_checksum --file="$old_file"
|
ynh_delete_file_checksum --file="$old_file"
|
||||||
done
|
done
|
||||||
|
|
||||||
install_dir=/var/www/$app
|
install_dir=/var/www/$app
|
||||||
ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
|
ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
|
||||||
|
|
||||||
db_name=ihatemoney
|
db_name=ihatemoney
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If secret_key doesn't exist, create it
|
# If secret_key doesn't exist, create it
|
||||||
if [ -z "${secret_key:-}" ]; then
|
if [ -z "${secret_key:-}" ]; then
|
||||||
secret_key=$(ynh_string_random --length=32)
|
secret_key=$(ynh_string_random --length=32)
|
||||||
ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key
|
ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If hashed_password doesn't exist, create it
|
# If hashed_password doesn't exist, create it
|
||||||
if [ -z "${hashed_password:-}" ]; then
|
if [ -z "${hashed_password:-}" ]; then
|
||||||
password=$(ynh_string_random --length=16)
|
password=$(ynh_string_random --length=16)
|
||||||
hashed_password=$(_hash_password "$password")
|
hashed_password=$(_hash_password "$password")
|
||||||
ynh_secure_remove --file="$install_dir/key.txt"
|
ynh_secure_remove --file="$install_dir/key.txt"
|
||||||
ynh_app_setting_set --app=$app --key=hashed_password --value=$hashed_password
|
ynh_app_setting_set --app=$app --key=hashed_password --value=$hashed_password
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "/var/log/$app" ]; then
|
if [ ! -d "/var/log/$app" ]; then
|
||||||
# Configure log directory
|
# Configure log directory
|
||||||
mkdir -p "/var/log/$app"
|
mkdir -p "/var/log/$app"
|
||||||
chown -R $app:$app "/var/log/$app"
|
chown -R $app:$app "/var/log/$app"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue