OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.5 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../runit/forced_reboot.patch
  5. # Copyright (C) 2006 The T2 SDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. --- runit-1.3.1/package/commands 2005-08-24 22:14:39.000000000 +0200
  17. +++ runit-1.3.1/package/commands 2006-04-09 00:47:27.000000000 +0200
  18. @@ -11,3 +11,4 @@
  19. svwaitdown
  20. svwaitup
  21. utmpset
  22. +forced_reboot
  23. diff -Nudr admin.orig/runit-1.3.1/src/forced.c admin/runit-1.3.1/src/forced.c
  24. --- runit-1.3.1/src/forced_reboot.c 1970-01-01 01:00:00.000000000 +0100
  25. +++ runit-1.3.1/src/forced_reboot.c 2006-04-09 00:45:35.000000000 +0200
  26. @@ -0,0 +1,38 @@
  27. +#include <unistd.h>
  28. +#include "reboot_system.h"
  29. +#include "strerr.h"
  30. +
  31. +#ifndef RB_AUTOBOOT
  32. +#error "RB_AUTOBOOT undefined"
  33. +#endif
  34. +
  35. +int r =0;
  36. +
  37. +int main(int argc, char **argv) {
  38. + char *progname;
  39. + sync();
  40. + if ((progname = strrchr(argv[0], '/')) == NULL)
  41. + progname = argv[0];
  42. + else
  43. + progname++;
  44. +
  45. + if (strcmp(progname,"forced_reboot")==0)
  46. + r =reboot_system(RB_AUTOBOOT);
  47. + else {
  48. +#ifdef RB_POWER_OFF
  49. + r =reboot_system(RB_POWER_OFF);
  50. + if (r) strerr_die2sys(100, *argv, ": fatal: ");
  51. +#endif
  52. +#ifdef RB_HALT_SYSTEM
  53. + r =reboot_system(RB_HALT_SYSTEM);
  54. +#else
  55. +# ifdef RB_HALT
  56. + r =reboot_system(RB_HALT);
  57. +# else
  58. + r =reboot_system(RB_AUTOBOOT);
  59. +# endif
  60. +#endif
  61. + }
  62. + if (r) strerr_die2sys(100, *argv, ": fatal: ");
  63. + _exit(0);
  64. + }
  65. --- runit-1.3.1/src/Makefile 2005-08-24 22:14:39.000000000 +0200
  66. +++ runit-1.3.1/src/Makefile 2006-04-09 00:50:04.000000000 +0200
  67. @@ -1,4 +1,4 @@
  68. -IT=chpst runit runit-init runsv runsvchdir runsvdir sv svlogd utmpset
  69. +IT=chpst runit runit-init runsv runsvchdir runsvdir sv svlogd utmpset forced_reboot
  70. default: sysdeps $(IT)
  71. @@ -466,3 +466,7 @@
  72. wait_pid.o: compile error.h haswaitp.h wait_pid.c
  73. ./compile wait_pid.c
  74. +forced_reboot: load forced_reboot.o unix.a byte.a
  75. + ./load forced_reboot unix.a byte.a -static
  76. +forced_reboot.o: compile forced_reboot.c reboot_system.h
  77. + ./compile forced_reboot.c