mirror of
https://github.com/YunoHost-Apps/peertube_remote_runner_ynh.git
synced 2024-09-03 19:56:21 +02:00
48 lines
1.8 KiB
Bash
Executable file
48 lines
1.8 KiB
Bash
Executable file
#!/bin/bash
|
||
|
||
#=================================================
|
||
# GENERIC START
|
||
#=================================================
|
||
# IMPORT GENERIC HELPERS
|
||
#=================================================
|
||
|
||
source _common.sh
|
||
source /usr/share/yunohost/helpers
|
||
|
||
#=================================================
|
||
# RUNNER UNREGISTRATION
|
||
#=================================================
|
||
ynh_script_progression --message="Unregistering the runner on Peertube server..." --weight=1
|
||
|
||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_node "$install_dir/node_modules/@peertube/peertube-runner" unregister --url $peertube_url --registration-token $runner_token --runner-name $app\_$runner_id
|
||
|
||
#=================================================
|
||
# REMOVE SYSTEM CONFIGURATIONS
|
||
#=================================================
|
||
# REMOVE SYSTEMD SERVICE
|
||
#=================================================
|
||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||
|
||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||
then
|
||
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
||
yunohost service remove $app
|
||
fi
|
||
|
||
ynh_remove_systemd_config
|
||
|
||
#=================================================
|
||
# REMOVE NPM MODULE
|
||
#=================================================
|
||
ynh_script_progression --message="Removing Peertube remote runner npm module..." --weight=1
|
||
|
||
pushd "$install_dir"
|
||
ynh_use_nodejs
|
||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm uninstall @peertube/peertube-runner
|
||
popd
|
||
|
||
#=================================================
|
||
# END OF SCRIPT
|
||
#=================================================
|
||
|
||
ynh_script_progression --message="Removal of $app completed" --last
|