From b507b8c9b67841495619bd8cdf56c0abaaf155f2 Mon Sep 17 00:00:00 2001 From: Michael Janczyk Date: Tue, 14 Sep 2010 18:45:32 +0200 Subject: changed check for options...e.g. ubuntu sends string when power button pressed --- os-plugins/plugins/sysrqshutdown/files/shutdown | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/os-plugins/plugins/sysrqshutdown/files/shutdown b/os-plugins/plugins/sysrqshutdown/files/shutdown index 7f4e9a1f..a27481d7 100644 --- a/os-plugins/plugins/sysrqshutdown/files/shutdown +++ b/os-plugins/plugins/sysrqshutdown/files/shutdown @@ -32,20 +32,17 @@ fi if [ ${sysrqshutdown_active} -eq 1 ]; then # check if reboot or halt - case "$@" in - '-r now') - for i in $(echo s u b); do + if echo "$@" | grep -qe '-r now'; then + for i in $(echo s u b); do echo $i > /proc/sysrq-trigger & - done - exit 0 - ;; - '-h now') - for i in $(echo s u o); do - echo $i > /proc/sysrq-trigger & - done - exit 0 - ;; - esac + done + exit 0 + elif echo "$@" | grep -qe '-h now'; then + for i in $(echo s u o); do + echo $i > /proc/sysrq-trigger & + done + exit 0 + fi fi # else use orig shutdown shutdown.slxorig $@ -- cgit v1.2.3-55-g7522 From 6e3a223921fefafe1cef8534b59db749a12a4d16 Mon Sep 17 00:00:00 2001 From: Michael Janczyk Date: Tue, 14 Sep 2010 19:51:33 +0200 Subject: enable reinstall of plugin if sth gets changed in shutdown script --- .../OpenSLX/OSPlugin/sysrqshutdown.pm | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/os-plugins/plugins/sysrqshutdown/OpenSLX/OSPlugin/sysrqshutdown.pm b/os-plugins/plugins/sysrqshutdown/OpenSLX/OSPlugin/sysrqshutdown.pm index 9800c203..bfc274d4 100644 --- a/os-plugins/plugins/sysrqshutdown/OpenSLX/OSPlugin/sysrqshutdown.pm +++ b/os-plugins/plugins/sysrqshutdown/OpenSLX/OSPlugin/sysrqshutdown.pm @@ -68,20 +68,24 @@ sub getAttrInfo sub installationPhase { - my $self = shift; - my $info = shift; + my $self = shift; + my $info = shift; + my $openslxBasePath = $info->{'openslx-base-path'}; + my $pluginName = $self->{'name'}; + my $pluginBasePath = "$openslxBasePath/lib/plugins/$pluginName/files"; + # copy files if (! -e "/sbin/shutdown.slxorig") { - # copy files - my $openslxBasePath = $info->{'openslx-base-path'}; - my $pluginName = $self->{'name'}; - my $pluginBasePath - = "$openslxBasePath/lib/plugins/$pluginName/files"; - system("mv /sbin/shutdown /sbin/shutdown.slxorig"); - system("cp -p $pluginBasePath/shutdown /sbin/"); + system("cp -p $pluginBasePath/shutdown /sbin/; + cp -p $pluginBasePath/shutdown /opt/openslx/plugin-repo/$pluginName"); chmod 0755, "/sbin/shutdown"; } + # else assume reinstall + elsif (-e "/sbin/shutdown.slxorig") { + system("cp -p $pluginBasePath/shutdown /sbin/"); + chmod 0755, "/sbin/shutdown"; + } return; } -- cgit v1.2.3-55-g7522