On Fri, Jun 14, 2002 at 02:59:24PM +1000, James Cameron wrote:
| On Fri, 2002-06-14 at 11:51, Derrick 'dman' Hudson wrote:
| > On Fri, Jun 14, 2002 at 10:39:54AM +1000, James Cameron wrote:
| > | (b) how to make this change to /etc/inittab as a package to be installed
| > | on multiple machines?
| > One character difference.  It doesn't look like inittab is in any
| > package, so I don't know the best way to automatically change it on
| > multiple systems.
| 
| The package I have made (which also adds a graphical shutdown image
| using zgv) does this in the post-installation script ...
| 
| # change control/alt/delete sequence to halt rather than reboot
| sed 's/shutdown -t1 -a -r now/shutdown -t1 -a -h now/' \
| < /etc/inittab > /etc/inittab.dpkg.lenny-shutdown
| mv /etc/inittab /etc/inittab.pre-lenny-shutdown
| mv /etc/inittab.dpkg.lenny-shutdown /etc/inittab
| telinit q
| 
| But I was hoping to find a more elegant solution.  ;-)

That's how you edit files from the shell :-).  If you try this :
    sed '<sed script>' < file > file
you'll end up with either
    1)  an error from the shell, if 'noclobber' is set
    2)  a clobbered file, because the open for writing is done before
        the data is read

Thus a temp file is needed for the redirection to work as intended.

-D

-- 

I tell you the truth, everyone who sins is a slave to sin.  Now a slave
has no permanent place in the family, but a son belongs to it forever.
So if the Son sets you free, you will be free indeed.
        John 8:34-36
 
http://dman.ddts.net/~dman/

Attachment: pgpqi9zdHp2XI.pgp
Description: PGP signature

Reply via email to