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

2003-08-02 Thread Pierre THIERRY
 How do I configure your script to restart apache when the power button
 is pushed?

Because it has nothing to do with shutdown, you just change
/etc/acpi/events/powerbtn, and modify it to action=invoke-rc.d apache
restart

Quickly,
le Moine Fou
-- 
[EMAIL PROTECTED]
OpenPGP 0xD9D50D8A


pgpffTsYCoLt2.pgp
Description: PGP signature


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

2003-08-01 Thread Cajus Pollmeier
On Donnerstag, 31. Juli 2003 07:24, Pierre THIERRY wrote:
 Package: acpid
 Version: N/A; reported 2003-07-31
 Severity: serious
 Justification: Policy 9.1.1

 The shell script /etc/acpi/powerbtn.sh should be installed in something
 else, like /usr/share/acpid/ or /usr/sbin/.

 -- System Information
 Debian Release: 3.0
 Architecture: i386
 Kernel: Linux imperatrice.arcanes 2.4.18-686 #1 Sun Apr 14 11:32:47 EST
 2002 i686 Locale: [EMAIL PROTECTED], [EMAIL PROTECTED]

I've no problem with that, but:

These scripts used by acpid should be treated as some kind of user
configuration, like i.e. cron keeps skripts installed by someone in 
/etc/cron.daily,
acpid keeps skripts that take actions when some events happened.

I've no idea about the exact handling of this issue. Should I move these
scripts to /usr/share/acpid or /usr/sbin?

Thanks for any hints,
Cajus




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

2003-08-01 Thread Colin Watson
On Fri, Aug 01, 2003 at 02:09:36PM +0200, Cajus Pollmeier wrote:
 On Donnerstag, 31. Juli 2003 07:24, Pierre THIERRY wrote:
  Package: acpid
  Version: N/A; reported 2003-07-31
  Severity: serious
  Justification: Policy 9.1.1
 
  The shell script /etc/acpi/powerbtn.sh should be installed in something
  else, like /usr/share/acpid/ or /usr/sbin/.
 
 I've no problem with that, but:
 
 These scripts used by acpid should be treated as some kind of user
 configuration, like i.e. cron keeps skripts installed by someone in
 /etc/cron.daily, acpid keeps skripts that take actions when some
 events happened.
 
 I've no idea about the exact handling of this issue. Should I move
 these scripts to /usr/share/acpid or /usr/sbin?

I think at least the RCness of this bug is rather dubious, frankly. If
the script is configuration (i.e. is human-editable and is expected to
be edited by a reasonable number of people to configure acpid in some
different way without having to hack acpid's source) then it should stay
in /etc. The FHS doesn't forbid that, and if people really are editing
it then it should definitely not be in /usr.

Cheers,

-- 
Colin Watson  [EMAIL PROTECTED]




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

2003-08-01 Thread David Z Maze
Cajus Pollmeier [EMAIL PROTECTED] writes:

 On Donnerstag, 31. Juli 2003 07:24, Pierre THIERRY wrote:
 Severity: serious
 Justification: Policy 9.1.1

(Debian should obey the FHS; I don't claim to be an FHS expert, but
all it seems to say about /etc is no binaries, which this doesn't
violate.)

 The shell script /etc/acpi/powerbtn.sh should be installed in something
 else, like /usr/share/acpid/ or /usr/sbin/.

 I've no problem with that, but:

 These scripts used by acpid should be treated as some kind of user
 configuration, like i.e. cron keeps skripts installed by someone in
 /etc/cron.daily, acpid keeps skripts that take actions when some
 events happened.

Is this script that gets run when the console user presses the power
button, and is it obvious that the user could potentially want to
configure it?  If so, then it makes sense that it should be a
configuration file, and so by policy 10.7.2 it should live in /etc.
(And as you point out, it's not like there aren't other admin-editable
scripts in /etc already, say, all of /etc/init.d.)  My reading is that
what you're doing now is fine and the bug is wrong.

-- 
David Maze [EMAIL PROTECTED]  http://people.debian.org/~dmaze/
Theoretical politics is interesting.  Politicking should be illegal.
-- Abra Mitchell




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

2003-08-01 Thread Pierre THIERRY
 I think at least the RCness of this bug is rather dubious, frankly. If
 the script is configuration

I don't think the script is meant to be edited... So it should be in
/usr/sbin.

Quickly,
le Moine Fou
-- 
[EMAIL PROTECTED]
OpenPGP 0xD9D50D8A


pgpjHl0gN4jh5.pgp
Description: PGP signature


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

2003-08-01 Thread Cajus Pollmeier
On Freitag, 1. August 2003 15:31, David Z Maze wrote:
 Cajus Pollmeier [EMAIL PROTECTED] writes:
  On Donnerstag, 31. Juli 2003 07:24, Pierre THIERRY wrote:
  Severity: serious
  Justification: Policy 9.1.1

 (Debian should obey the FHS; I don't claim to be an FHS expert, but
 all it seems to say about /etc is no binaries, which this doesn't
 violate.)

  The shell script /etc/acpi/powerbtn.sh should be installed in something
  else, like /usr/share/acpid/ or /usr/sbin/.
 
  I've no problem with that, but:
 
  These scripts used by acpid should be treated as some kind of user
  configuration, like i.e. cron keeps skripts installed by someone in
  /etc/cron.daily, acpid keeps skripts that take actions when some
  events happened.

 Is this script that gets run when the console user presses the power
 button, and is it obvious that the user could potentially want to
 configure it?  If so, then it makes sense that it should be a
 configuration file, and so by policy 10.7.2 it should live in /etc.
 (And as you point out, it's not like there aren't other admin-editable
 scripts in /etc already, say, all of /etc/init.d.)  My reading is that
 what you're doing now is fine and the bug is wrong.

So in case of a power down script, this may be somewhat fixed in its
task. This would be true. But this script must not be the only one. Maybe
the user wants to place a script for i.e. closing the LID or do special
reactions on suspend events etc.

In my understanding /etc/acpid is the correct place for that. So, I changed
the serevity of the bug. I'm just off to vacations tomorrow - will look into 
this
when I'm back.

Thanks,
Cajus




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

2003-08-01 Thread Matthew Garrett
Pierre THIERRY wrote:

I don't think the script is meant to be edited... So it should be in
/usr/sbin.

You think wrong. The user should be able to choose whether the power
button triggers shutdown or suspend to disk, for instance.

-- 
Matthew Garrett | [EMAIL PROTECTED]




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

2003-08-01 Thread Pierre THIERRY
 You think wrong. The user should be able to choose whether the power
 button triggers shutdown or suspend to disk, for instance.

But one shouldn't have to edit a shell script to do it. It should just
be necessary to edit a configuration file. Like modifying the action
value to something like /usr/sbin/poweroff or /usr/sbin/suspend-to-disk

Surely,
le Moine Fou
-- 
[EMAIL PROTECTED]
OpenPGP 0xD9D50D8A


pgpgqzVk71oL5.pgp
Description: PGP signature


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

2003-08-01 Thread Gunnar Wolf
Pierre THIERRY dijo [Fri, Aug 01, 2003 at 03:58:23PM +0200]:
  I think at least the RCness of this bug is rather dubious, frankly. If
  the script is configuration
 
 I don't think the script is meant to be edited... So it should be in
 /usr/sbin.

There are many scripts in /etc that are not meant to be edited unless a
special need arises - The first packages that comes to my mind are
pcmcia-cs and linux-wlan-ng. They have many different scripts in
/etc/pcmcia, and almost always they work perfectly - I had to fiddle
with them once.

In my system I have 113 executable files under /etc, they belong to the
most varied programs... And they are (or at least, they seem to be)
perfectly valid configurable files. (most of them - see my next message)

Greetings,

-- 
Gunnar Wolf - [EMAIL PROTECTED] - (+52-55)5630-9700 ext. 1366
PGP key 1024D/8BB527AF 2001-10-23
Fingerprint: 0C79 D2D1 2C4E 9CE4 5973  F800 D80E F35A 8BB5 27AF


pgpwnZq7O92MR.pgp
Description: PGP signature


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

2003-08-01 Thread Gunnar Wolf
David Z Maze dijo [Fri, Aug 01, 2003 at 09:31:40AM -0400]:
 Cajus Pollmeier [EMAIL PROTECTED] writes:
 
  On Donnerstag, 31. Juli 2003 07:24, Pierre THIERRY wrote:
  Severity: serious
  Justification: Policy 9.1.1
 
 (Debian should obey the FHS; I don't claim to be an FHS expert, but
 all it seems to say about /etc is no binaries, which this doesn't
 violate.)

Ummm... I *did* find something strange, maybe you can give some more
insight on this:

[EMAIL PROTECTED]:/$ find /etc -type f -perm -755|xargs file|grep ELF
etc/X11/rstart/rstartd.real:ELF 32-bit LSB executable, 
Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.0, dynamically linked (uses 
shared libs), stripped
[EMAIL PROTECTED]:/$ dpkg -S rstartd.real
xutils: /etc/X11/rstart/rstartd.real

This is clearly a binary, it is clearly not user-modifiable. Should it
be in /etc? Should it just be a symlink to /usr/lib/xutils or something
like it?

Greetings,

-- 
Gunnar Wolf - [EMAIL PROTECTED] - (+52-55)5630-9700 ext. 1366
PGP key 1024D/8BB527AF 2001-10-23
Fingerprint: 0C79 D2D1 2C4E 9CE4 5973  F800 D80E F35A 8BB5 27AF




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

2003-08-01 Thread Josip Rodin
On Fri, Aug 01, 2003 at 10:32:47AM -0500, Gunnar Wolf wrote:
 Ummm... I *did* find something strange, maybe you can give some more
 insight on this:
 
 [EMAIL PROTECTED]:/$ find /etc -type f -perm -755|xargs file|grep ELF
 etc/X11/rstart/rstartd.real:ELF 32-bit LSB 
 executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.0, dynamically 
 linked (uses shared libs), stripped
 [EMAIL PROTECTED]:/$ dpkg -S rstartd.real
 xutils: /etc/X11/rstart/rstartd.real
 
 This is clearly a binary, it is clearly not user-modifiable. Should it
 be in /etc? Should it just be a symlink to /usr/lib/xutils or something
 like it?

Yes, it's a known bug, it'll be fixed.

-- 
 2. That which causes joy or happiness.




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

2003-08-01 Thread Matthias Urlichs
Hi, Matthew Garrett wrote:

 The user should be able to choose whether the power
 button triggers shutdown or suspend to disk, for instance.

While I do agree that this kind of script is best placed in /etc, this
kind of choice can be configured by a normal /etc/acpid.conf that's read
by the script.

-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  [EMAIL PROTECTED]
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
-- 
A pretty woman is a welcome guest.
-- Byron




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

2003-08-01 Thread Marco d'Itri
On Aug 01, David Z Maze [EMAIL PROTECTED] wrote:

 Is this script that gets run when the console user presses the power
 button, and is it obvious that the user could potentially want to
 configure it?  If so, then it makes sense that it should be a
 configuration file, and so by policy 10.7.2 it should live in /etc.
The user may want to configure it, but OTOH the script name is
referenced in /etc/acpid/events/powerbtn, and it would probably be
cleaner to make it point to a local script.

-- 
ciao, |
Marco | [1063 afeJFGjAxPvAk]




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

2003-08-01 Thread Scott James Remnant
On Fri, 2003-08-01 at 14:58, Pierre THIERRY wrote:

  I think at least the RCness of this bug is rather dubious, frankly. If
  the script is configuration
 
 I don't think the script is meant to be edited... So it should be in
 /usr/sbin.
 
I've edited it, and I'd bet I'm not the only one who has a
dog/cat/turtle/etc who keeps knocking the power button, resulting in a
change to scheduling a shutdown in 1 minutes time :)

Stuff like this is no different to /etc/cron.d, /etc/init.d,
/etc/apm/event.d -- it's configurable.

I say close the bug.

Scott


signature.asc
Description: This is a digitally signed message part


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

2003-08-01 Thread Pierre THIERRY
Tags: patch

 I've edited it, and I'd bet I'm not the only one who has a
 dog/cat/turtle/etc who keeps knocking the power button, resulting in a
 change to scheduling a shutdown in 1 minutes time :)

I think a very good coded script should use a config file in /etc. But
maybe it's a purist opinion... What do you think of the patch I
porvideĀ ? (I did not touch the dcop thing, as I don't understand it
very well)

And this script could even not be part of acpid, but maybe sysvinit, as
it could be useful even without ACPI, just in replacement for halt, with
more functionnalities. One could add something for Gnome, as IIRC, DCOP
is part of KDE or Qt...

Narrow-mindedly, ;-)
le Moine Fou
-- 
[EMAIL PROTECTED]
OpenPGP 0xD9D50D8A


pgpEQ6WsEoxBn.pgp
Description: PGP signature


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

2003-08-01 Thread Scott James Remnant
On Sat, 2003-08-02 at 03:05, Pierre THIERRY wrote:

 Tags: patch
 
You forgot to attach it :-)

  I've edited it, and I'd bet I'm not the only one who has a
  dog/cat/turtle/etc who keeps knocking the power button, resulting in a
  change to scheduling a shutdown in 1 minutes time :)
 
 I think a very good coded script should use a config file in /etc. But
 maybe it's a purist opinion... What do you think of the patch I
 porvide ? (I did not touch the dcop thing, as I don't understand it
 very well)
 
Ah, more configuration...

Sit back and ask yourself, who's interested in what this script does?

Is it the average user?  Nope ... they're probably quite content with
the script exactly as it is.

It's the person who specially doesn't want their machine going down when
the power button is pushed.  You could add a configuration file, and
make this script all fancy reading it, but you're only going to ever
think of the needs of the average user who doesn't even care.

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

And precisely because it's power users doing the customisation, rather
than trying to second-guess what magic they want to do on the event, the
simplest and best form of configuration is a shell script -- that way
they can do whatever they want!

 And this script could even not be part of acpid, but maybe sysvinit, as
 it could be useful even without ACPI, just in replacement for halt, with
 more functionnalities. One could add something for Gnome, as IIRC, DCOP
 is part of KDE or Qt...
 
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.

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

Scott


signature.asc
Description: This is a digitally signed message part


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

2003-08-01 Thread Pierre THIERRY
 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
-- 
[EMAIL PROTECTED]
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.0 +0100
+++ acpid-1.0.2/debian/powerbtn.cfg 2003-08-02 03:34:53.0 +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.0 +0200
+++ acpid-1.0.2/debian/powerbtn.sh  2003-08-02 03:40:27.0 +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/rules2003-08-02 02:09:02.0 +0200
+++ acpid-1.0.2/debian/rules2003-08-02 03:31:20.0 +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


pgpBPLAGKaghM.pgp
Description: PGP signature


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

2003-08-01 Thread Scott James Remnant
On Sat, 2003-08-02 at 03:38, Pierre THIERRY wrote:

  Tags: patch
  You forgot to attach it :-)
 
 Shit. And the BTS doesn't seem to have noticed the patch tag...
 
You meant to put tags 203588 patch, thanks and Bcc
[EMAIL PROTECTED], didn't you? :-)

  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.
 
Then you're not what I'd consider a UNIX power user :-)

 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...
 
Then they probably don't care what happens when the power button is
pushed!

  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...
 
How do I configure your script to restart apache when the power button
is pushed?

  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.
 
It's not an RC bug.  If shell scripts weren't allowed in /etc -- init.d
would be a bit of a problem :-)

Scott


signature.asc
Description: This is a digitally signed message part