-
Notifications
You must be signed in to change notification settings - Fork 428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support halt/poweroff/reboot binaries for System_Shutdown() #235
Comments
Thanks for your input. I don't quite understand what you mean with
Can you elaborate? What do you mean with "USERWORLD binaries"? |
Thanks for your fast answer. I talking about this function: lib/system/systemLinux.c#L379 System_Shutdown() I can switch to the
|
Oh, I understand. I agree with @ravindravmw , defining USERWORLD is a very bad idea. I filed an internal bug for this. I think a good solution would be to make this configurable. Right now you would need to patch the code here:
|
Is there any further information about the current status? |
Hello @Hackebein , we do have this issue in our queue, but I am sorry, it's probably not going to be addressed any time. soon. There are no other requests to change this. So my suggestion is to work around this for now, either by patching as suggested above, or provide a script called /sbin/shutdown that does the desired action. |
Btw, if you want you can also provide a patch via a pull request to fix this, for example by making this configurable. |
It should be a fairly easy switch to excute |
Something like this? diff --git a/open-vm-tools/configure.ac b/open-vm-tools/configure.ac
index dba033b1..3aa6a87f 100644
--- a/open-vm-tools/configure.ac
+++ b/open-vm-tools/configure.ac
@@ -1460,6 +1460,15 @@ else
UDEVRULESDIR=""
fi
+AC_ARG_WITH([shutdown-command],
+ [AS_HELP_STRING([--with-shutdown-command=COMMAND],
+ [command to perform shutdown])],
+ [AC_DEFINE_UNQUOTED([SHUTDOWN_COMMAND], ["$withval"], [])])
+AC_ARG_WITH([reboot-command],
+ [AS_HELP_STRING([--with-reboot-command=COMMAND],
+ [command to perform reboot])],
+ [AC_DEFINE_UNQUOTED([REBOOT_COMMAND], ["$withval"], [])])
+
if test "x$enable_resolutionkms" = "xauto"; then
enable_resolutionkms="no"
fi
diff --git a/open-vm-tools/lib/system/systemLinux.c b/open-vm-tools/lib/system/systemLinux.c
index a688ab25..67100a1a 100644
--- a/open-vm-tools/lib/system/systemLinux.c
+++ b/open-vm-tools/lib/system/systemLinux.c
@@ -307,7 +307,9 @@ System_Shutdown(Bool reboot) // IN: "reboot or shutdown" flag
char *cmd;
if (reboot) {
-#if defined(sun)
+#if defined(REBOOT_COMMAND)
+ cmd = REBOOT_COMMAND;
+#elif defined(sun)
cmd = "/usr/sbin/shutdown -g 0 -i 6 -y";
#elif defined(USERWORLD)
cmd = "/bin/reboot";
@@ -315,7 +317,9 @@ System_Shutdown(Bool reboot) // IN: "reboot or shutdown" flag
cmd = "/sbin/shutdown -r now";
#endif
} else {
-#if __FreeBSD__
+#if defined(SHUTDOWN_COMMAND)
+ cmd = SHUTDOWN_COMMAND;
+#elif __FreeBSD__
cmd = "/sbin/shutdown -p now";
#elif defined(sun)
cmd = "/usr/sbin/shutdown -g 0 -i 5 -y"; |
Some systems, like Alpine Linux, may not use /sbin/shutdown to power off or reboot. Add configure option so user can set the correct commands. Fixes vmware#235 Signed-off-by: Natanael Copa <[email protected]>
Some systems based on buildroot (ex. RancherOS) and alpine linux have no binary like
/sbin/shutdown
, instead they use/sbin/halt
(shutdown),/sbin/poweroff
(shutdown with ACPI) and/sbin/reboot
(reboot).I prefere to add a case to switch to the
USERWORLD
binaries without add the completeUSERWORLD
cases.The text was updated successfully, but these errors were encountered: