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

Re: sed command is fine from within a shell script but not from within debian/rules?



> On Wed, 6 Sep 2000, Shaul Karl wrote:
> 
> > I am trying to adjust a tcl program to the Debian policy by running a sed 
> > command from within debian\rules. However this command seems to do what I want 
> > from within a shell script but not from within debian\rules.
> 
> > sed -e '/\exec \/usr\/bin\/wish8.3 \$0 \${1+"\$@"}/a\$
> 
> You need to escape the dollar signs as "$$" and probably the backslashes
> too.
> 


Eventually I modified the Makefile in the build dir because it works and was 
easier.
Yet I am sending this message because I want to know how I could have do what 
I wanted to and I also believe that a nicer solution is a one that does not 
require modifying the Makefile.
The $$ works.
As for the backslashes, it seems to me more complicated because the makefile 
seems to grab it for itself as a continuation signs.

[02:12:59 TkMan]$ ./rules 
# Adjusting the executable for users without MANPATH set
# by patching it with conditional exec /usr/bin/manpth.
set -x; sed -e '/\exec \/usr\/bin\/wish8.3 \$0 \${1+"\$@"}/a\
\
# the next setting for the MANPATH environment variable was Added for\
# Debian GNU/Linux version by the Debian maintainer due to the fact\
# that the Debian policy forbids programms to be dependant "on\
# environment variables to get reasonable defaults" (Section 3.9 of the\
# Debian policy).\
if {![info exists env(MANPATH)] || [string equal [string trim \$env(MANPATH)] 
""]} {\
set env(MANPATH) [ exec /usr/bin/manpath ];}\
' tkman.bak > tkman
+ sed -e '/\exec \/usr\/bin\/wish8.3 \$0 \${1+"\$@"}/a  # the next setting for 
the MANPATH environment variable was Added for # Debian GNU/Linux version by 
the Debian maintainer due to the fact # that the Debian policy forbids 
programms to be dependant "on # environment variables to get reasonable 
defaults" (Section 3.9 of the # Debian policy). if {![info exists 
env(MANPATH)] || [string equal [string trim \$env(MANPATH)] ""]} { set 
env(MANPATH) [ exec /usr/bin/manpath ];} ' tkman.bak
sed: -e expression #1, char 47: Extra characters after command
make: *** [install] Error 1
[02:13:02 TkMan]$ ./script.sh 
+ echo Adjusting the executable for users without MANPATH set
Adjusting the executable for users without MANPATH set
+ echo by patching it with conditional exec /usr/bin/manpth.
by patching it with conditional exec /usr/bin/manpth.
+ sed -e '/\exec \/usr\/bin\/wish8.3 \$0 \${1+"\$@"}/a\
\
# the next setting for the MANPATH environment variable was Added for\
# Debian GNU/Linux version by the Debian maintainer due to the fact\
# that the Debian policy forbids programms to be dependant "on\
# environment variables to get reasonable defaults" (Section 3.9 of the\
# Debian policy).\
if {![info exists env(MANPATH)] || [string equal [string trim \$env(MANPATH)] 
""]} {\
set env(MANPATH) [ exec /usr/bin/manpath ];}\
' tkman.bak
[02:13:07 TkMan]$ 

[02:15:11 TkMan]$ cat rules 
#!/usr/bin/make -f
# -*- makefile -*-

# This is the rules file for the t


install: 
        # Adjusting the executable for users without MANPATH set
        # by patching it with conditional exec /usr/bin/manpth.
        set -x; sed -e '/\exec \/usr\/bin\/wish8.3 \$$0 \$${1+"\$$@"}/a\
\
# the next setting for the MANPATH environment variable was Added for\
# Debian GNU/Linux version by the Debian maintainer due to the fact\
# that the Debian policy forbids programms to be dependant "on\
# environment variables to get reasonable defaults" (Section 3.9 of the\
# Debian policy).\
if {![info exists env(MANPATH)] || [string equal [string trim \$$env(MANPATH)] 
"
"]} {\
set env(MANPATH) [ exec /usr/bin/manpath ];}\
' tkman.bak > tkman

[02:15:30 TkMan]$ cat script.sh 
#! /bin/sh
set -x

# This is the rules file for the tkman package.

echo Adjusting the executable for users without MANPATH set
echo by patching it with conditional exec /usr/bin/manpth.
sed -e '/\exec \/usr\/bin\/wish8.3 \$0 \${1+"\$@"}/a\
\
# the next setting for the MANPATH environment variable was Added for\
# Debian GNU/Linux version by the Debian maintainer due to the fact\
# that the Debian policy forbids programms to be dependant "on\
# environment variables to get reasonable defaults" (Section 3.9 of the\
# Debian policy).\
if {![info exists env(MANPATH)] || [string equal [string trim \$env(MANPATH)] 
""]} {\
set env(MANPATH) [ exec /usr/bin/manpath ];}\
' tkman.bak > tkman
[02:15:36 TkMan]$ 


>    Simon
> 
> -- 
> PGP public key available from http://phobos.fs.tum.de/pgp/Simon.Richter.asc
>  Fingerprint: 10 62 F6 F5 C0 5D 9E D8  47 05 1B 8A 22 E5 4E C1
> Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!

-- 
	
	--  Shaul Karl <shaulk@israsrv.net.il>

	Donate free food to the world's hungry: see http://www.thehungersite.com




Reply to: