diff --git a/debian/yunohost-api.service b/conf/yunohost/yunohost-api.service similarity index 59% rename from debian/yunohost-api.service rename to conf/yunohost/yunohost-api.service index 850255127..aa429ec7a 100644 --- a/debian/yunohost-api.service +++ b/conf/yunohost/yunohost-api.service @@ -4,9 +4,7 @@ After=network.target [Service] Type=simple -Environment=DAEMON_OPTS= -EnvironmentFile=-/etc/default/yunohost-api -ExecStart=/usr/bin/yunohost-api $DAEMON_OPTS +ExecStart=/usr/bin/yunohost-api Restart=always RestartSec=5 TimeoutStopSec=30 diff --git a/debian/yunohost-firewall.service b/conf/yunohost/yunohost-firewall.service similarity index 100% rename from debian/yunohost-firewall.service rename to conf/yunohost/yunohost-firewall.service diff --git a/debian/rules b/debian/rules index 5527d8703..5cf1d9bee 100755 --- a/debian/rules +++ b/debian/rules @@ -8,7 +8,3 @@ override_dh_auto_build: # Generate bash completion file python3 doc/generate_bash_completion.py python3 doc/generate_manpages.py --gzip --output doc/yunohost.8.gz - -override_dh_installinit: - dh_installinit -pyunohost --name=yunohost-api --noscripts - dh_installinit -pyunohost --name=yunohost-firewall --noscripts diff --git a/debian/yunohost-api.default b/debian/yunohost-api.default deleted file mode 100644 index b6a9e5a99..000000000 --- a/debian/yunohost-api.default +++ /dev/null @@ -1,4 +0,0 @@ -# Override yunohost-api options. -# Example to log debug: DAEMON_OPTS="--debug" -# -#DAEMON_OPTS="" diff --git a/hooks/conf_regen/01-yunohost b/hooks/conf_regen/01-yunohost index d30d77ace..22929db33 100755 --- a/hooks/conf_regen/01-yunohost +++ b/hooks/conf_regen/01-yunohost @@ -56,7 +56,16 @@ do_init_regen() { chown root:root /var/cache/yunohost chmod 700 /var/cache/yunohost + cp yunohost-api.service /etc/systemd/system/yunohost-api.service + cp yunohost-firewall.service /etc/systemd/system/yunohost-firewall.service cp yunoprompt.service /etc/systemd/system/yunoprompt.service + + systemctl daemon-reload + + systemctl enable yunohost-api.service + systemctl start yunohost-api.service + # Yunohost-firewall is enabled only during postinstall, not init, not 100% sure why + cp dpkg-origins /etc/dpkg/origins/yunohost # Change dpkg vendor @@ -142,6 +151,8 @@ HandleLidSwitchDocked=ignore HandleLidSwitchExternalPower=ignore EOF + cp yunohost-api.service ${pending_dir}/etc/systemd/system/yunohost-api.service + cp yunohost-firewall.service ${pending_dir}/etc/systemd/system/yunohost-firewall.service cp yunoprompt.service ${pending_dir}/etc/systemd/system/yunoprompt.service if [[ "$(yunohost settings get 'security.experimental.enabled')" == "True" ]]; then @@ -219,6 +230,9 @@ do_post_regen() { } [[ ! "$regen_conf_files" =~ "nftables.service.d/ynh-override.conf" ]] || systemctl daemon-reload [[ ! "$regen_conf_files" =~ "login.conf.d/ynh-override.conf" ]] || systemctl daemon-reload + [[ ! "$regen_conf_files" =~ "yunohost-firewall.service" ]] || systemctl daemon-reload + [[ ! "$regen_conf_files" =~ "yunohost-api.service" ]] || systemctl daemon-reload + if [[ "$regen_conf_files" =~ "yunoprompt.service" ]]; then systemctl daemon-reload action=$([[ -e /etc/systemd/system/yunoprompt.service ]] && echo 'enable' || echo 'disable')