From 6c2914dc61594d593821e24148ea68695983735e Mon Sep 17 00:00:00 2001 From: Takaya Saeki Date: Mon, 8 Nov 2021 02:35:06 +0900 Subject: [PATCH] Improve robustness of portproxy.service --- distrod_packer/resources/run/systemd/system/portproxy.service | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/distrod_packer/resources/run/systemd/system/portproxy.service b/distrod_packer/resources/run/systemd/system/portproxy.service index 4c0c168..c64e034 100644 --- a/distrod_packer/resources/run/systemd/system/portproxy.service +++ b/distrod_packer/resources/run/systemd/system/portproxy.service @@ -7,7 +7,11 @@ Wants=network-online.target systemd-networkd-wait-online.service Restart=on-failure RestartSec=15 +# WSL_INTEROP and other variables should be set by systemd even without sourcing /etc/environment, +# but if a user enable this just after they updated systemd (apt-upgrade or pacman -Syu), then +# systemd will forget those variables due to restart. So, source /etc/environment just in case. ExecStart=/bin/sh -c '/opt/distrod/bin/portproxy.exe proxy $(/opt/distrod/bin/portproxy show ipv4) -t $(cat /opt/distrod/conf/tcp4_ports)' +EnvironmentFile=/etc/environment [Install] WantedBy=multi-user.target