[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#203588: acpid: Shell script has nothing to do in /etc



>> Tags: patch
> You forgot to attach it :-)

Shit. And the BTS doesn't seem to have noticed the patch tag...

> Event-handling from cardmgr, hotplug, usbmgr, acpid, apmd etc. are
> really useful to be able to be customised by power users.

I think I'm something like a power user, and I hate having to read and
understand a script (being shell, perl or anything else) to customize a
package to my needs.

And I love a well-documented configuration file, where I just have to
change some paramters, without having to understand everything behing
it. The power user might want to focus on its work, not on the
custimozation of every signle package he installs...

> You've assumed they want the power button to *be* a power button, it's
> entirely likely that they might want it to (for example) switch the
> user into single user mode instead.

I didn't assume anything, and my version of the script just need th
change ACTION=halt to ACTION=single to achieve this. And if the script
is rewritten or modified to be just better, an apt-get upgrade won't
erase all the customizations made by the sysadmin, because it is in a
configuration file that have little reasons to change...

> Shell scripts run by event daemons are the power-user's configuration
> files. Leave them be.

They are a very bad manner to provide configuration files to the
power-user, IMHO... And I still think this bug is an RC one.

Technically,
le Moine Fou
-- 
pierre.thierry@moine-fou.org
OpenPGP 0xD9D50D8A
diff -Nru acpid-1.0.2.old/debian/powerbtn.cfg acpid-1.0.2/debian/powerbtn.cfg
--- acpid-1.0.2.old/debian/powerbtn.cfg	1970-01-01 01:00:00.000000000 +0100
+++ acpid-1.0.2/debian/powerbtn.cfg	2003-08-02 03:34:53.000000000 +0200
@@ -0,0 +1,11 @@
+# Can be halt, reboot or single
+ACTION=halt
+
+# Time between SIGTERM and SIGKILL, see shutdown(8)
+INIT_WAIT=
+
+# When to shutdown.
+TIME=now
+
+# Message to send to all users.
+MESSAGE=
diff -Nru acpid-1.0.2.old/debian/powerbtn.sh acpid-1.0.2/debian/powerbtn.sh
--- acpid-1.0.2.old/debian/powerbtn.sh	2003-08-02 02:09:02.000000000 +0200
+++ acpid-1.0.2/debian/powerbtn.sh	2003-08-02 03:40:27.000000000 +0200
@@ -3,9 +3,40 @@
 # Initiates a shutdown when the power putton has been
 # pressed.
 
+CONFIG=/etc/acpi/powerbtn.cfg
+SDPID=/var/run/shutdown.pid
+SHUTDOWN=/sbin/shutdown
+
+if [ -f $SDPID ];then
+	$SHUTDOWN -c
+	exit;
+fi
+
+. $CONFIG
+
 if ps -Af | grep -q '[k]desktop' && test -f /usr/bin/dcop
 then
     dcop --all-users ksmserver ksmserver logout 0 2 0 && exit 0
 fi
 
-/sbin/init 0
+
+COMMAND=$SHUTDOWN
+
+case $ACTION in
+halt)
+	COMMAND="$COMMAND -h";;
+reboot)
+	COMMAND="$COMMAND -r";;
+single)
+	;;
+esac
+
+case $INIT_WAIT in
+"")
+	COMMAND="$COMMAND -t $INIT_WAIT";;
+*)
+	;;
+esac
+
+COMMAND="$COMMAND $TIME $MESSAGE"
+$COMMAND
diff -Nru acpid-1.0.2.old/debian/rules acpid-1.0.2/debian/rules
--- acpid-1.0.2.old/debian/rules	2003-08-02 02:09:02.000000000 +0200
+++ acpid-1.0.2/debian/rules	2003-08-02 03:31:20.000000000 +0200
@@ -39,8 +39,11 @@
 	install -p -o root -g root -m 644 debian/powerbtn \
 		debian/tmp/etc/acpi/events/powerbtn
 	
+	install -p -o root -g root -m 644 debian/powerbtn.cfg \
+		debian/tmp/etc/acpi/powerbtn.cfg
+	
 	install -p -o root -g root -m 755 debian/powerbtn.sh \
-		debian/tmp/etc/acpi/powerbtn.sh
+		debian/tmp/usr/sbin/powerbtn.sh
 
 	install -p -o root -g root -m 644 acpid.8.gz \
 		debian/tmp/usr/share/man/man8

Attachment: pgpi7WP_zpUXW.pgp
Description: PGP signature


Reply to: