mirror of
https://github.com/YunoHost-Apps/vikunja_ynh.git
synced 2024-09-03 18:06:26 +02:00
Fix
This commit is contained in:
parent
094a09d54e
commit
ae669c56eb
7 changed files with 31 additions and 28 deletions
|
@ -7,7 +7,7 @@ Requires=postgresql.service redis.service
|
||||||
Type=simple
|
Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
WorkingDirectory=/opt/__APP__
|
WorkingDirectory=/opt/__APP__/
|
||||||
ExecStart=/opt/__APP__/vikunja
|
ExecStart=/opt/__APP__/vikunja
|
||||||
RestartSec=2s
|
RestartSec=2s
|
||||||
Restart=always
|
Restart=always
|
||||||
|
|
|
@ -24,6 +24,7 @@ ynh_print_info --message="Loading installation settings..."
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
backend_path=$(ynh_app_setting_get --app=$app --key=backend_path)
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
|
|
||||||
|
@ -40,7 +41,7 @@ ynh_print_info --message="Declaring files to be backed up..."
|
||||||
ynh_backup --src_path="$final_path"
|
ynh_backup --src_path="$final_path"
|
||||||
|
|
||||||
# Backend
|
# Backend
|
||||||
ynh_backup --src_path="/opt/$app"
|
ynh_backup --src_path="$backend_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
|
|
|
@ -28,6 +28,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
# Needed for helper "ynh_add_nginx_config"
|
# Needed for helper "ynh_add_nginx_config"
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
backend_path=$(ynh_app_setting_get --app=$app --key=backend_path)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
|
@ -117,9 +118,9 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||||
domain="$new_domain"
|
domain="$new_domain"
|
||||||
path="$new_path"
|
path="$new_path"
|
||||||
redis_db=$(ynh_redis_get_free_db)
|
redis_db=$(ynh_redis_get_free_db)
|
||||||
ynh_add_config --template="../conf/config.yml" --destination="/etc/$app/config.yml"
|
ynh_add_config --template="../conf/config.yml" --destination="$backend_path/config.yml"
|
||||||
|
|
||||||
chmod 600 "/etc/$app/config.yml"
|
chmod 600 "$backend_path/config.yml"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# GENERIC FINALISATION
|
||||||
|
|
|
@ -37,6 +37,7 @@ enable_registration="true"
|
||||||
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||||
|
|
||||||
final_path=/var/www/$app
|
final_path=/var/www/$app
|
||||||
|
backend_path=/opt/$app
|
||||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||||
|
|
||||||
# Register (book) web path
|
# Register (book) web path
|
||||||
|
@ -107,16 +108,18 @@ chown -R $app:www-data "$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up backend..." --weight=1
|
ynh_script_progression --message="Setting up backend..." --weight=1
|
||||||
|
|
||||||
|
ynh_app_setting_set --app=$app --key=backend_path --value=$backend_path
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
mkdir -p "/opt/$app"
|
mkdir -p "$backend_path"
|
||||||
mkdir -p "/opt/$app/files"
|
mkdir -p "$backend_path/files"
|
||||||
tempdir="$(mktemp -d)"
|
tempdir="$(mktemp -d)"
|
||||||
ynh_setup_source --dest_dir=$tempdir --source_id=$YNH_ARCH
|
ynh_setup_source --dest_dir=$tempdir --source_id=$YNH_ARCH
|
||||||
back="$(find $tempdir -name "vikunja-*" \! -name "*.sha256")"
|
back="$(find $tempdir -name "vikunja-*" \! -name "*.sha256")"
|
||||||
cp "$back" "/opt/$app/vikunja"
|
cp "$back" "$backend_path/vikunja"
|
||||||
|
|
||||||
chmod +x "/opt/$app/vikunja"
|
chmod +x "$backend_path/vikunja"
|
||||||
chown -R $app:www-data "/opt/$app/files"
|
chown -R $app:www-data "$backend_path/files"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -132,10 +135,10 @@ ynh_add_nginx_config
|
||||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||||
|
|
||||||
redis_db=$(ynh_redis_get_free_db)
|
redis_db=$(ynh_redis_get_free_db)
|
||||||
ynh_add_config --template="../conf/config.yml" --destination="/opt/$app/config.yml"
|
ynh_add_config --template="../conf/config.yml" --destination="$backend_path/config.yml"
|
||||||
|
|
||||||
chmod 400 "/opt/$app/config.yml"
|
chmod 400 "$backend_path/config.yml"
|
||||||
chown $app:$app "/opt/$app/config.yml"
|
chown $app:$app "$backend_path/config.yml"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
|
|
|
@ -19,6 +19,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
backend_path=$(ynh_app_setting_get --app=$app --key=backend_path)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
|
|
||||||
|
@ -74,6 +75,9 @@ ynh_script_progression --message="Removing $app main directory..." --weight=6
|
||||||
# Remove the app directory securely
|
# Remove the app directory securely
|
||||||
ynh_secure_remove --file="$final_path"
|
ynh_secure_remove --file="$final_path"
|
||||||
|
|
||||||
|
# Remove backend
|
||||||
|
ynh_secure_remove --file="$backend_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -92,14 +96,6 @@ ynh_script_progression --message="Removing the dedicated system user..." --weigh
|
||||||
# Delete a system user
|
# Delete a system user
|
||||||
ynh_system_user_delete --username=$app
|
ynh_system_user_delete --username=$app
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE BACKEND
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing backend..." --weight=1
|
|
||||||
|
|
||||||
# Delete /opt/vikunja
|
|
||||||
ynh_secure_remove --file="/opt/$app"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -26,6 +26,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
backend_path=$(ynh_app_setting_get --app=$app --key=backend_path)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||||
|
@ -66,9 +67,9 @@ chmod -R o-rwx "$final_path"
|
||||||
chown -R $app:www-data "$final_path"
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
# Backend
|
# Backend
|
||||||
ynh_restore_file --origin_path="/opt/$app"
|
ynh_restore_file --origin_path="$backend_path"
|
||||||
chmod +x "/opt/$app/vikunja"
|
chmod +x "$backend_path/vikunja"
|
||||||
chown -R $app:www-data "/opt/$app/files"
|
chown -R $app:www-data "$backend_path/files"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
# REINSTALL DEPENDENCIES
|
||||||
|
|
|
@ -19,6 +19,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
backend_path=$(ynh_app_setting_get --app=$app --key=backend_path)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
|
@ -103,21 +104,21 @@ then
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
# Frontend
|
# Frontend
|
||||||
ynh_setup_source --dest_dir="$final_path" --source_id="front" --keep="/etc/$app/config.yml"
|
ynh_setup_source --dest_dir="$final_path" --source_id="front"
|
||||||
|
|
||||||
# Backend
|
# Backend
|
||||||
mkdir -p "/opt/$app/files"
|
mkdir -p "$backend_path/files"
|
||||||
tempdir="$(mktemp -d)"
|
tempdir="$(mktemp -d)"
|
||||||
ynh_setup_source --dest_dir=$tempdir --source_id=$YNH_ARCH
|
ynh_setup_source --dest_dir=$tempdir --source_id=$YNH_ARCH
|
||||||
back="$(find $tempdir -name "vikunja-*" \! -name "*.sha256")"
|
back="$(find $tempdir -name "vikunja-*" \! -name "*.sha256")"
|
||||||
cp "$back" "/opt/$app/vikunja"
|
cp "$back" "$backend_path/vikunja"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$final_path"
|
||||||
chown -R $app:www-data "$final_path"
|
chown -R $app:www-data "$final_path"
|
||||||
chmod +x "/opt/$app/vikunja"
|
chmod +x "$backend_path/vikunja"
|
||||||
chown -R $app:www-data "/opt/$app/files"
|
chown -R $app:www-data "$backend_path/files"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
|
Loading…
Add table
Reference in a new issue