Created attachment 463480 [details, diff] lxd.init.patch Hi, init scripts should be POSIX compatible, see bug 609070. However lxd init scripts are not: they use [[ ]] instead of [ ]. Proposed patch fixes this. It is quite simple, so I'll apply in two weeks if there are no objections.
I changed this for the latest 2.11 and subsequent versions. I did not change existing versions, but they will fall off over time.
With the current lxd-2.11.initd, I see the following message on service start: $ sudo /etc/init.d/lxd restart /etc/init.d/lxd: line 30: [: =: unary operator expected /etc/init.d/lxd: line 30: [: =: unary operator expected Current line 30 is: if [ $RC_GOINGDOWN = YES ] || [ $RC_REBOOT = YES ]; then
Changing line 30 to quote the arguments of the equality comparison avoids the warning: if [ "$RC_GOINGDOWN" = "YES" ] || [ "$RC_REBOOT" = "YES" ]; then I haven't stepped through to check the conditions where one of the $RC_ are true, but if they are blank, as in the case of a service restart, I think the test fails.
Yes, double quotes are mandatory and are present in the original patch. Erik, please fix this.
(In reply to Andrew Savchenko from comment #4) > Yes, double quotes are mandatory and are present in the original patch. > Erik, please fix this. I've included then in the lxd-2.14 version bump: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7c15f08e00643b789f3ab4fcf80250b982bc5f2c