1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/galene_ynh.git synced 2024-09-03 18:36:31 +02:00
This commit is contained in:
Éric Gaspar 2024-08-31 09:35:29 +02:00
parent c1b73275f6
commit 28eb503206
7 changed files with 6 additions and 53 deletions

View file

@ -18,7 +18,7 @@ userdoc = "https://galene.org/faq.html"
code = "https://github.com/jech/galene"
[integration]
yunohost = ">= 11.2.18"
yunohost = ">= 11.2.29"
helpers_version = "2.1"
architectures = "all"
multi_instance = false

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

View file

@ -36,30 +36,21 @@ ynh_script_progression "Updating configuration..."
domain="$new_domain"
# Configure Galène
ynh_config_add --template="config.json" --destination="$install_dir/live/data/config.json"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/live/data/config.json"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/live/data/config.json"
# Configure Galene LDAP
#ynh_config_add --template="galene-ldap.json" --destination="$install_dir/live_ldap/data/galene-ldap.json"
#chmod 400 "$install_dir/live_ldap/data/galene-ldap.json"
#chown $app:$app "$install_dir/live_ldap/data/galene-ldap.json"
# Create a group name config
#ynh_config_add --template="groupname.json" --destination="$data_dir/groups/$group_name.json"
##REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$data_dir/groups/$group_name.json"
##REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$data_dir/groups/$group_name.json"
# Create a group name authenticated on LDAP
ynh_config_add --template="groupname-ldap.json" --destination="$data_dir/groups/YunoHost_Users.json"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$data_dir/groups/YunoHost_Users.json"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$data_dir/groups/YunoHost_Users.json"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression "Starting $app's systemd service..."
# Start a systemd service
ynh_systemctl --service=$app --action="start" --log_path="systemd"
ynh_systemctl --service=${app}_ldap --action="start" --log_path="systemd"

View file

@ -23,7 +23,6 @@ ynh_hide_warnings yunohost firewall allow UDP -4 49152:65535
#=================================================
ynh_script_progression "Setting up source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir/build"
ynh_setup_source --dest_dir="$install_dir/build_ldap" --source_id="ldap"
@ -33,8 +32,6 @@ mkdir -p "$install_dir/live_ldap/data"
cp -r "$install_dir/build/static/" "$install_dir/live/"
ynh_replace --match="<div class=\"galene-header\">Galène</div>" --replace="<div class=\"galene-header\" onclick=\"location.href=window.location.origin\" style=\"cursor:pointer\">Galène</div>" --file="$install_dir/live/static/galene.html"
#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"
#=================================================
# SPECIFIC SETUP
#=================================================
@ -75,8 +72,6 @@ ynh_app_setting_set --key=password_hash --value="$password_hash"
# Configure Galène
ynh_config_add --template="config.json" --destination="$install_dir/live/data/config.json"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/live/data/config.json"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/live/data/config.json"
# Configure Galène LDAP
key=$(jose jwk gen -i '{"kty":"oct","alg":"HS256"}')
@ -87,13 +82,9 @@ chown $app:$app "$install_dir/live_ldap/data/galene-ldap.json"
# Create a group name config
ynh_config_add --template="groupname.json" --destination="$data_dir/groups/$group_name.json"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$data_dir/groups/$group_name.json"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$data_dir/groups/$group_name.json"
# Create a group name authenticated on LDAP
ynh_config_add --template="groupname-ldap.json" --destination="$data_dir/groups/YunoHost_Users.json"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$data_dir/groups/YunoHost_Users.json"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$data_dir/groups/YunoHost_Users.json"
#=================================================
# SYSTEM CONFIGURATION
@ -102,10 +93,8 @@ ynh_script_progression "Adding system configurations related to $app..."
public_ip4="$(curl -s ip.yunohost.org)" || true
# Create a dedicated NGINX config
ynh_config_add_nginx
# Create a dedicated systemd config
ynh_config_add_systemd
ynh_config_add_systemd --service=${app}_ldap --template="ldap.service"
@ -117,7 +106,6 @@ yunohost service add ${app}_ldap --description="LDAP integration for the videoco
#=================================================
ynh_script_progression "Starting $app's systemd service..."
# Start a systemd service
ynh_systemctl --service=$app --action="start" --log_path="systemd"
ynh_systemctl --service=${app}_ldap --action="start" --log_path="systemd"

View file

@ -10,24 +10,21 @@ source /usr/share/yunohost/helpers
#=================================================
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..."
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}_ldap >/dev/null
then
ynh_script_progression "Removing ${app}_ldap service integration..."
yunohost service remove ${app}_ldap
fi
# Remove the dedicated systemd config
ynh_config_remove_systemd
ynh_config_remove_systemd${app}_ldap
# Remove the dedicated NGINX config
ynh_config_remove_nginx
#=================================================

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
@ -11,8 +10,6 @@ ynh_script_progression "Restoring the app main directory..."
ynh_restore "$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"
#=================================================
# RESTORE THE DATA DIRECTORY
#=================================================
@ -25,8 +22,6 @@ chown -R $app:www-data "$data_dir"
#=================================================
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression "Restoring system configurations related to $app..."
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"

View file

@ -49,8 +49,6 @@ ynh_safe_rm "$install_dir/live/static/"
cp -r "$install_dir/build/static/" "$install_dir/live/"
ynh_replace --match="<div class=\"galene-header\">Galène</div>" --replace="<div class=\"galene-header\" onclick=\"location.href=window.location.origin\" style=\"cursor:pointer\">Galène</div>" --file="$install_dir/live/static/galene.html"
#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"
#=================================================
# BUILD APP
#=================================================
@ -83,36 +81,23 @@ chmod +x "$install_dir/galene-password-generator"
ynh_script_progression "Updating configuration..."
# If password_hash doesn't exist, create it
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=password_hash --value=$(echo $($install_dir/galene-password-generator $password))
if [ -z "${password_hash:-}" ]; then
password_hash=$(echo $($install_dir/galene-password-generator $password))
ynh_app_setting_set --key=password_hash --value="$password_hash"
fi
ynh_app_setting_set_default --key=password_hash --value=$(echo $($install_dir/galene-password-generator $password))
# Configure Galène
ynh_config_add --template="config.json" --destination="$install_dir/live/data/config.json"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/live/data/config.json"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/live/data/config.json"
# Configure Galène LDAP
# If key doesn't exist, create it
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=key --value=$(jose jwk gen -i '{"kty":"oct","alg":"HS256"}')
if [ -z "${key:-}" ]; then
key=$(jose jwk gen -i '{"kty":"oct","alg":"HS256"}')
ynh_app_setting_set --key=key --value=$key
fi
ynh_app_setting_set_default --key=key --value=$(jose jwk gen -i '{"kty":"oct","alg":"HS256"}')
ynh_config_add --template="galene-ldap.json" --destination="$install_dir/live_ldap/data/galene-ldap.json"
chmod 400 "$install_dir/live_ldap/data/galene-ldap.json"
chown $app:$app "$install_dir/live_ldap/data/galene-ldap.json"
# Create a group name config
ynh_config_add --template="groupname.json" --destination="$data_dir/groups/$group_name.json"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$data_dir/groups/$group_name.json"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$data_dir/groups/$group_name.json"
# Create a group name authenticated on LDAP
ynh_config_add --template="groupname-ldap.json" --destination="$data_dir/groups/YunoHost_Users.json"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$data_dir/groups/YunoHost_Users.json"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$data_dir/groups/YunoHost_Users.json"
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
@ -121,10 +106,8 @@ ynh_script_progression "Upgrading system configurations related to $app..."
public_ip4="$(curl -s ip.yunohost.org)" || true
# Create a dedicated NGINX config
ynh_config_add_nginx
# Create a dedicated systemd config
ynh_config_add_systemd
ynh_config_add_systemd --service=${app}_ldap --template="ldap.service"