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

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



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.
Does debian\rules sets different environment for shell commands?

In order to track down the problem I have created rules and script.sh that 
have only the problematic sed command.

[02:25:31 TkMan]$ cat -A rules 
#!/usr/bin/make -f$
# -*- makefile -*-$
$
# This is the rules file for the t$
$
$
install: $
^I# Adjusting the executable for users without MANPATH set$
^I# by patching it with conditional exec /usr/bin/manpth.$
^Iset -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:25:47 TkMan]$ cat -A 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:26:04 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 \ \/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 \nv(MANPATH)] 
""]} {\
set env(MANPATH) [ exec /usr/bin/manpath ];}\
' tkman.bak > tkman
+ sed -e '/\exec \/usr\/bin\/wish8.3 \ \/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 \nv(MANPATH)] ""]} { set env(MANPATH) [ exec /usr/bin/manpath ];} 
' tkman.bak
sed: -e expression #1, char 118: Unknown command: ``L''
make: *** [install] Error 1
[02:27:14 TkMan]$ he 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:27:39 TkMan]$ 


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

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




Reply to: