1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/shellinabox_ynh.git synced 2024-09-03 20:26:12 +02:00
This commit is contained in:
moutonjr 2021-08-16 13:01:35 +02:00 committed by GitHub
commit 082538a223
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 52 additions and 1 deletions

38
conf/shellinabox.service Normal file
View file

@ -0,0 +1,38 @@
# Make it bootable at startup
[Install]
WantedBy=multi-user.target
[Unit]
Documentation=man:shellinaboxd(1)
# Sourcing LSB Path
SourcePath=/etc/init.d/shellinabox
Description=LSB: Shell In A Box Daemon
Before=multi-user.target
Before=graphical.target
After=network-online.target
# Awaits LDAP is specific user binding at startup
After=slapd.service
After=remote-fs.target
Wants=network-online.target
Requires=slapd.service
[Service]
Type=forking
# Calls for restart when there is a fail
Restart=on-failure
RestartSec=5min
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=no
SuccessExitStatus=5 6
# Gracefully wait for every service to come up
ExecStartPre=/bin/sleep 3
ExecStart=/etc/init.d/shellinabox start
ExecStop=/etc/init.d/shellinabox stop
ExecReload=/etc/init.d/shellinabox reload

View file

@ -35,6 +35,7 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="/etc/shellinabox"
ynh_backup --src_path="/etc/default/shellinabox"
ynh_backup --src_path="/etc/systemd/system/shellinabox.service"
#=================================================
# BACKUP THE NGINX CONFIGURATION

View file

@ -78,10 +78,14 @@ ynh_script_progression --message="Configuring shellinabox..." --weight=2
cp ../conf/shellinabox /etc/default/shellinabox
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="/etc/default/shellinabox"
# Allow the service to log in syslog
ynh_replace_string --match_string=" -- -q --background" --replace_string=" -- --background" --target_file="/etc/init.d/shellinabox"
systemctl daemon-reload
# Enable SystemD respawn feature and boot order to avoid premature crashs
cp ../conf/shellinabox.service /etc/systemd/system/shellinabox.service
systemctl daemon-reload
ynh_systemd_action --service_name=shellinabox --action=restart
#=================================================
@ -90,6 +94,7 @@ ynh_systemd_action --service_name=shellinabox --action=restart
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="/etc/default/shellinabox"
ynh_store_file_checksum --file="/etc/systemd/system/shellinabox.service"
#=================================================
# GENERIC FINALIZATION

View file

@ -39,6 +39,9 @@ ynh_script_progression --message="Removing shellinabox..." --weight=20
ynh_package_autopurge shellinabox
# Remove Systemd auto-created daemon
rm -f /etc/systemd/system/shellinabox.service
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================

View file

@ -59,6 +59,7 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="/etc/shellinabox"
ynh_restore_file --origin_path="/etc/default/shellinabox"
ynh_restore_file --origin_path="/etc/systemd/system/shellinabox.service"
# Allow the service to log in syslog
ynh_replace_string --match_string=" -- -q --background" --replace_string=" -- --background" --target_file="/etc/init.d/shellinabox"

View file

@ -69,10 +69,13 @@ ynh_script_progression --message="Upgrading shellinabox configuration..." --weig
# Verify the checksum and backup the file if it's different
ynh_backup_if_checksum_is_different --file="/etc/default/shellinabox"
ynh_backup_if_checksum_is_different --file="/etc/systemd/system/shellinabox.service"
cp ../conf/shellinabox /etc/default/shellinabox
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="/etc/default/shellinabox"
cp ../conf/shellinabox.service /etc/systemd/system/shellinabox.service
ynh_replace_string --match_string=" -- -q --background" --replace_string=" -- --background" --target_file="/etc/init.d/shellinabox"
systemctl daemon-reload