mirror of
https://github.com/YunoHost-Apps/simplex_ynh.git
synced 2024-09-03 20:26:28 +02:00
[autopatch] Automatic patch attempt for helpers 2.1
This commit is contained in:
parent
9bbd9a138c
commit
6d33f626c4
11 changed files with 76 additions and 243 deletions
|
@ -1,14 +0,0 @@
|
|||
version = "1.0"
|
||||
|
||||
[main]
|
||||
name = "Simplex configuration"
|
||||
services = ["xftp"]
|
||||
|
||||
[main.config]
|
||||
name = "Configuration Options"
|
||||
|
||||
[main.config.storage_quota]
|
||||
ask = "File storage quota"
|
||||
type = "string"
|
||||
help = "File storage quota (e.g. 100gb)"
|
||||
bind = "storage_quota:/etc/opt/simplex-xftp/file-server.ini"
|
|
@ -18,7 +18,8 @@ cpe = "cpe:2.3:a:simplex:simplex_chat"
|
|||
fund = "https://opencollective.com/simplex-chat"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.2"
|
||||
yunohost = ">= 11.2.18"
|
||||
helpers_version = "2.1"
|
||||
architectures = ["amd64", "arm64"]
|
||||
multi_instance = false
|
||||
|
||||
|
|
|
@ -1,19 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# COMMON VARIABLES
|
||||
# COMMON VARIABLES AND CUSTOM HELPERS
|
||||
#=================================================
|
||||
# PHP APP SPECIFIC
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# FUTURE OFFICIAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -1,40 +1,31 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# 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
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
ynh_print_info --message="Declaring files to be backed up..."
|
||||
ynh_print_info "Declaring files to be backed up..."
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$install_dir"
|
||||
ynh_backup "$install_dir"
|
||||
|
||||
ynh_backup --src_path="/etc/opt/simplex"
|
||||
ynh_backup --src_path="/etc/opt/simplex-xftp"
|
||||
ynh_backup --src_path="/var/opt/simplex"
|
||||
ynh_backup --src_path="/var/opt/simplex-xftp"
|
||||
ynh_backup "/etc/opt/simplex"
|
||||
ynh_backup "/etc/opt/simplex-xftp"
|
||||
ynh_backup "/var/opt/simplex"
|
||||
ynh_backup "/var/opt/simplex-xftp"
|
||||
|
||||
#=================================================
|
||||
# BACKUP SYSTEMD
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||
ynh_backup --src_path="/etc/systemd/system/xftp.service"
|
||||
ynh_backup "/etc/systemd/system/$app.service"
|
||||
ynh_backup "/etc/systemd/system/xftp.service"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
|
|
102
scripts/config
102
scripts/config
|
@ -1,102 +0,0 @@
|
|||
#!/bin/bash
|
||||
# In simple cases, you don't need a config script.
|
||||
|
||||
# With a simple config_panel.toml, you can write in the app settings, in the
|
||||
# upstream config file or replace complete files (logo ...) and restart services.
|
||||
|
||||
# The config scripts allows you to go further, to handle specific cases
|
||||
# (validation of several interdependent fields, specific getter/setter for a value,
|
||||
# display dynamic informations or choices, pre-loading of config type .cube... ).
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
|
||||
final_path=$(ynh_app_setting_get $app final_path)
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC GETTERS FOR TOML SHORT KEY
|
||||
#=================================================
|
||||
|
||||
get__amount() {
|
||||
# Here we can imagine to have an API call to stripe to know the amount of donation during a month
|
||||
local amount = 200
|
||||
|
||||
# It's possible to change some properties of the question by overriding it:
|
||||
if [ $amount -gt 100 ]
|
||||
then
|
||||
cat << EOF
|
||||
style: success
|
||||
value: $amount
|
||||
ask:
|
||||
en: A lot of donation this month: **$amount €**
|
||||
EOF
|
||||
else
|
||||
cat << EOF
|
||||
style: danger
|
||||
value: $amount
|
||||
ask:
|
||||
en: Not so much donation this month: $amount €
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
get__prices() {
|
||||
local prices = "$(grep "DONATION\['" "$final_path/settings.py" | sed -r "s@^DONATION\['([^']*)'\]\['([^']*)'\] = '([^']*)'@\1/\2/\3@g" | sed -z 's/\n/,/g;s/,$/\n/')"
|
||||
if [ "$prices" == "," ];
|
||||
then
|
||||
# Return YNH_NULL if you prefer to not return a value at all.
|
||||
echo YNH_NULL
|
||||
else
|
||||
echo $prices
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC VALIDATORS FOR TOML SHORT KEYS
|
||||
#=================================================
|
||||
validate__publishable_key() {
|
||||
|
||||
# We can imagine here we test if the key is really a publisheable key
|
||||
(is_secret_key $publishable_key) &&
|
||||
echo 'This key seems to be a secret key'
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETTERS FOR TOML SHORT KEYS
|
||||
#=================================================
|
||||
set__prices() {
|
||||
|
||||
#---------------------------------------------
|
||||
# IMPORTANT: setter are trigger only if a change is detected
|
||||
#---------------------------------------------
|
||||
for price in $(echo $prices | sed "s/,/ /"); do
|
||||
frequency=$(echo $price | cut -d/ -f1)
|
||||
currency=$(echo $price | cut -d/ -f2)
|
||||
price_id=$(echo $price | cut -d/ -f3)
|
||||
sed "d/DONATION\['$frequency'\]\['$currency'\]" "$final_path/settings.py"
|
||||
|
||||
echo "DONATION['$frequency']['$currency'] = '$price_id'" >> "$final_path/settings.py"
|
||||
done
|
||||
|
||||
#---------------------------------------------
|
||||
# IMPORTANT: to be able to upgrade properly, you have to saved the value in settings too
|
||||
#---------------------------------------------
|
||||
ynh_app_setting_set $app prices $prices
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
ynh_app_config_run $1
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -14,12 +8,12 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
#storage_quota="20gb"
|
||||
#ynh_app_setting_set --app=$app --key=storage_quota --value=$storage_quota
|
||||
#ynh_app_setting_set --key=storage_quota --value=$storage_quota
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=1
|
||||
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"
|
||||
|
@ -28,8 +22,8 @@ ynh_setup_source --dest_dir="$install_dir" --source_id="xftp"
|
|||
mkdir -p /etc/opt/simplex-xftp /etc/opt/simplex /var/opt/simplex-xftp /var/opt/simplex
|
||||
chown -R $app:$app /etc/opt/simplex-xftp /etc/opt/simplex /var/opt/simplex-xftp /var/opt/simplex
|
||||
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:$app "$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:$app "$install_dir"
|
||||
chmod +x $install_dir/smp-server
|
||||
chmod +x $install_dir/xftp-server
|
||||
|
||||
|
@ -38,7 +32,7 @@ chmod +x $install_dir/xftp-server
|
|||
#=================================================
|
||||
|
||||
public_ip4="$(curl -s ip.yunohost.org)" || true
|
||||
ynh_app_setting_set --app=$app --key=public_ip4 --value=$public_ip4
|
||||
ynh_app_setting_set --key=public_ip4 --value=$public_ip4
|
||||
|
||||
pushd "$install_dir"
|
||||
./smp-server init --no-password --ip $public_ip4 --store-log --yes
|
||||
|
@ -46,12 +40,12 @@ pushd "$install_dir"
|
|||
popd
|
||||
|
||||
fingerprint=$(cat /etc/opt/simplex/fingerprint)
|
||||
ynh_app_setting_set --app=$app --key=fingerprint --value=$fingerprint
|
||||
ynh_app_setting_set --key=fingerprint --value=$fingerprint
|
||||
|
||||
xftp_fingerprint=$(cat /etc/opt/simplex-xftp/fingerprint)
|
||||
ynh_app_setting_set --app=$app --key=xftp_fingerprint --value=$xftp_fingerprint
|
||||
ynh_app_setting_set --key=xftp_fingerprint --value=$xftp_fingerprint
|
||||
|
||||
ynh_replace_string --match_string="port: 443" --replace_string="port: $port_xftp" --target_file="/etc/opt/simplex-xftp/file-server.ini"
|
||||
ynh_replace --match="port: 443" --replace="port: $port_xftp" --file="/etc/opt/simplex-xftp/file-server.ini"
|
||||
|
||||
chown -R $app:$app "/etc/opt/simplex"
|
||||
chown -R $app:$app "/etc/opt/simplex-xftp"
|
||||
|
@ -59,9 +53,9 @@ chown -R $app:$app "/etc/opt/simplex-xftp"
|
|||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
#ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||
#ynh_script_progression "Adding $app's configuration..."
|
||||
|
||||
#ynh_add_config --template="file-server.ini" --destination="/etc/opt/simplex-xftp/file-server.ini"
|
||||
#ynh_config_add --template="file-server.ini" --destination="/etc/opt/simplex-xftp/file-server.ini"
|
||||
|
||||
#chmod 400 "/etc/opt/simplex-xftp/file-server.ini"
|
||||
#chown $app:$app "/etc/opt/simplex-xftp/file-server.ini"
|
||||
|
@ -69,11 +63,11 @@ chown -R $app:$app "/etc/opt/simplex-xftp"
|
|||
#=================================================
|
||||
# SYSTEM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding system configurations related to $app..." --weight=6
|
||||
ynh_script_progression "Adding system configurations related to $app..."
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
ynh_add_systemd_config --service=xftp --template=../conf/xftp.systemd.service
|
||||
ynh_config_add_systemd
|
||||
ynh_config_add_systemd --service=xftp --template=../conf/xftp.systemd.service
|
||||
|
||||
yunohost service add $app --description="Messaging platform" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port"
|
||||
yunohost service add xftp --description="Messaging platform" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port_xftp"
|
||||
|
@ -81,14 +75,14 @@ yunohost service add xftp --description="Messaging platform" --log="/var/log/$ap
|
|||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
ynh_script_progression "Starting $app's systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
||||
ynh_systemd_action --service_name="xftp" --action="start" --log_path="systemd"
|
||||
ynh_systemctl --service=$app --action="start" --log_path="systemd"
|
||||
ynh_systemctl --service="xftp" --action="start" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installation of $app completed" --last
|
||||
ynh_script_progression "Installation of $app completed"
|
||||
|
|
|
@ -1,39 +1,33 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# REMOVE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||
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_exec_warn_less yunohost service status $app >/dev/null
|
||||
if ynh_hide_warnings yunohost service status $app >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
||||
ynh_script_progression "Removing $app service integration..."
|
||||
yunohost service remove $app
|
||||
yunohost service remove xftp
|
||||
fi
|
||||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
ynh_remove_systemd_config --service=xftp
|
||||
ynh_config_remove_systemd
|
||||
ynh_config_remove_systemdxftp
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="/etc/opt/simplex"
|
||||
ynh_secure_remove --file="/etc/opt/simplex-xftp"
|
||||
ynh_secure_remove --file="/var/opt/simplex"
|
||||
ynh_secure_remove --file="/var/opt/simplex-xftp"
|
||||
ynh_safe_rm "/etc/opt/simplex"
|
||||
ynh_safe_rm "/etc/opt/simplex-xftp"
|
||||
ynh_safe_rm "/var/opt/simplex"
|
||||
ynh_safe_rm "/var/opt/simplex-xftp"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removal of $app completed" --last
|
||||
ynh_script_progression "Removal of $app completed"
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# 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
|
||||
|
@ -13,19 +7,18 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||
ynh_script_progression "Restoring the app main directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$install_dir"
|
||||
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
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
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
||||
ynh_script_progression "Restoring the data directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
||||
ynh_restore "$data_dir"
|
||||
|
||||
# (Same as for install dir)
|
||||
chown -R $app:www-data "$data_dir"
|
||||
|
@ -35,19 +28,19 @@ chown -R $app:www-data "$data_dir"
|
|||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=4
|
||||
ynh_script_progression "Restoring system configurations related to $app..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/opt/simplex"
|
||||
ynh_restore_file --origin_path="/etc/opt/simplex-xftp"
|
||||
ynh_restore "/etc/opt/simplex"
|
||||
ynh_restore "/etc/opt/simplex-xftp"
|
||||
|
||||
ynh_restore_file --origin_path="/var/opt/simplex"
|
||||
ynh_restore_file --origin_path="/var/opt/simplex-xftp"
|
||||
ynh_restore "/var/opt/simplex"
|
||||
ynh_restore "/var/opt/simplex-xftp"
|
||||
|
||||
chown -R $app:$app /var/opt/simplex-xftp /var/opt/simplex /etc/opt/simplex-xftp /etc/opt/simplex
|
||||
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||
ynh_restore "/etc/systemd/system/$app.service"
|
||||
systemctl enable $app.service --quiet
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/xftp.service"
|
||||
ynh_restore "/etc/systemd/system/xftp.service"
|
||||
systemctl enable xftp.service --quiet
|
||||
|
||||
yunohost service add $app --description="Messaging platform" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port"
|
||||
|
@ -56,13 +49,13 @@ yunohost service add xftp --description="Messaging platform" --log="/var/log/$ap
|
|||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
ynh_script_progression "Starting $app's systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
||||
ynh_systemd_action --service_name=xftp --action="start" --log_path="systemd"
|
||||
ynh_systemctl --service=$app --action="start" --log_path="systemd"
|
||||
ynh_systemctl --service=xftp --action="start" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoration completed for $app" --last
|
||||
ynh_script_progression "Restoration completed for $app"
|
||||
|
|
|
@ -1,45 +1,37 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||
ynh_script_progression "Stopping $app's systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
|
||||
ynh_systemd_action --service_name=xftp --action="stop" --log_path="systemd"
|
||||
ynh_systemctl --service=$app --action="stop" --log_path="systemd"
|
||||
ynh_systemctl --service=xftp --action="stop" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
ynh_script_progression "Ensuring downward compatibility..."
|
||||
|
||||
#if [ -z "${storage_quota:-}" ]; then
|
||||
# storage_quota="20gb"
|
||||
# ynh_app_setting_set --app=$app --key=storage_quota --value=$storage_quota
|
||||
# ynh_app_setting_set --key=storage_quota --value=$storage_quota
|
||||
#fi
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||
ynh_script_progression "Upgrading source files..."
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
ynh_setup_source --dest_dir="$install_dir" --source_id="xftp"
|
||||
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$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"
|
||||
chmod +x $install_dir/smp-server
|
||||
chmod +x $install_dir/xftp-server
|
||||
|
||||
|
@ -52,16 +44,16 @@ if [ ! -d /etc/opt/simplex-xftp ]; then
|
|||
mkdir -p "/etc/opt/simplex-xftp"
|
||||
|
||||
public_ip4="$(curl -s ip.yunohost.org)" || true
|
||||
ynh_app_setting_set --app=$app --key=public_ip4 --value=$public_ip4
|
||||
ynh_app_setting_set --key=public_ip4 --value=$public_ip4
|
||||
|
||||
pushd "$install_dir"
|
||||
./xftp-server init --ip $public_ip4 --quota '20gb' --store-log --path $data_dir
|
||||
popd
|
||||
|
||||
xftp_fingerprint=$(cat /etc/opt/simplex-xftp/fingerprint)
|
||||
ynh_app_setting_set --app=$app --key=xftp_fingerprint --value=$xftp_fingerprint
|
||||
ynh_app_setting_set --key=xftp_fingerprint --value=$xftp_fingerprint
|
||||
|
||||
ynh_replace_string --match_string="port: 443" --replace_string="port: $port_xftp" --target_file="/etc/opt/simplex-xftp/file-server.ini"
|
||||
ynh_replace --match="port: 443" --replace="port: $port_xftp" --file="/etc/opt/simplex-xftp/file-server.ini"
|
||||
|
||||
chown -R $app:$app /etc/opt/simplex-xftp /var/opt/simplex-xftp
|
||||
fi
|
||||
|
@ -69,9 +61,9 @@ fi
|
|||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
#ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||
#ynh_script_progression "Adding $app's configuration..."
|
||||
|
||||
#ynh_add_config --template="file-server.ini" --destination="/etc/opt/simplex-xftp/file-server.ini"
|
||||
#ynh_config_add --template="file-server.ini" --destination="/etc/opt/simplex-xftp/file-server.ini"
|
||||
|
||||
#chmod 400 "/etc/opt/simplex-xftp/file-server.ini"
|
||||
#chown $app:$app "/etc/opt/simplex-xftp/file-server.ini"
|
||||
|
@ -79,11 +71,11 @@ fi
|
|||
#=================================================
|
||||
# REAPPLY SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=4
|
||||
ynh_script_progression "Upgrading system configurations related to $app..."
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
ynh_add_systemd_config --service=xftp --template=../conf/xftp.systemd.service
|
||||
ynh_config_add_systemd
|
||||
ynh_config_add_systemd --service=xftp --template=../conf/xftp.systemd.service
|
||||
|
||||
yunohost service add $app --description="Messaging platform" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port"
|
||||
yunohost service add xftp --description="Messaging platform" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port_xftp"
|
||||
|
@ -91,13 +83,13 @@ yunohost service add xftp --description="Messaging platform" --log="/var/log/$ap
|
|||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
ynh_script_progression "Starting $app's systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
||||
ynh_systemd_action --service_name=xftp --action="start" --log_path="systemd"
|
||||
ynh_systemctl --service=$app --action="start" --log_path="systemd"
|
||||
ynh_systemctl --service=xftp --action="start" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||
ynh_script_progression "Upgrade of $app completed"
|
||||
|
|
2
sources/extra_files/app/.gitignore
vendored
2
sources/extra_files/app/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
*~
|
||||
*.sw[op]
|
2
sources/patches/.gitignore
vendored
2
sources/patches/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
*~
|
||||
*.sw[op]
|
Loading…
Add table
Reference in a new issue