diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index 74278241e..8edb34723 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -104,6 +104,9 @@ first a summary, then a detailed log. +June 7, 2004 [winkie]: Normalized sed usage +throughout the book. + June 7, 2004 [winkie]: Use the gcc --print-file specs command to determine the location of the specs file. diff --git a/chapter05/adjusting.xml b/chapter05/adjusting.xml index ae676717e..2cdf60937 100644 --- a/chapter05/adjusting.xml +++ b/chapter05/adjusting.xml @@ -40,7 +40,7 @@ to the new dynamic linker. A simple sed script will accomplish this: SPECFILE=`gcc --print-file specs` && -sed -e 's@ /lib/ld-linux.so.2@ /tools/lib/ld-linux.so.2@g' \ +sed 's@ /lib/ld-linux.so.2@ /tools/lib/ld-linux.so.2@g' \ $SPECFILE > tempspecfile && mv -f tempspecfile $SPECFILE && unset SPECFILE diff --git a/chapter05/udev.xml b/chapter05/udev.xml index 5b38a2baf..35ed76c61 100644 --- a/chapter05/udev.xml +++ b/chapter05/udev.xml @@ -42,12 +42,12 @@ by applying the following patch: which is bad since we install udev in a non-standard location. Fix this by running the following: -sed -i 's:\/sbin\/udev:/tools&:' udevstart.c +sed -i 's@/sbin/udev@/tools/sbin/udev@g' udevstart.c Also assure that udev knows the correct location to look for its configuration files: -sed -i 's:\/etc:/tools&:' etc/udev/udev.conf.in +sed -i 's@/etc@/tools/etc@g' etc/udev/udev.conf.in Now compile Udev: diff --git a/chapter05/util-linux.xml b/chapter05/util-linux.xml index 1f7ab22b1..7561ddd84 100644 --- a/chapter05/util-linux.xml +++ b/chapter05/util-linux.xml @@ -36,7 +36,7 @@ by applying the following patch: from the /tools directory. This is fixed by altering the configure script: -sed -i "s@/usr/include@/tools/include@g" configure +sed -i 's@/usr/include@/tools/include@g' configure Prepare Util-linux for compilation: diff --git a/chapter06/gzip.xml b/chapter06/gzip.xml index 4804b48ad..0cb8f2b57 100644 --- a/chapter06/gzip.xml +++ b/chapter06/gzip.xml @@ -38,7 +38,7 @@ GCC, Glibc, Grep, Make, Sed the location of the binary, the following command ensures that the new location gets placed into the script: -sed -i 's%"BINDIR"%/bin%' gzexe.in +sed -i 's@"BINDIR"@/bin@g' gzexe.in Compile the package: diff --git a/chapter06/man.xml b/chapter06/man.xml index 552d07d21..54f7174a6 100644 --- a/chapter06/man.xml +++ b/chapter06/man.xml @@ -40,13 +40,13 @@ width instead of being limited to 80 characters: switch to the PAGER variable so that escape sequences are properly handled by Less: -sed -i 's/-is/&R/' configure +sed -i 's@-is@&R@g' configure The third is also a sed substitution to comment out the MANPATH /usr/man line in the man.conf file to prevent redundant results when using programs such as whatis: -sed -i 's%MANPATH./usr/man%#&%' src/man.conf.in +sed -i 's@MANPATH./usr/man@#&@g' src/man.conf.in Now prepare Man for compilation: diff --git a/chapter06/readjusting.xml b/chapter06/readjusting.xml index c8c2f4bbd..a81c540f6 100644 --- a/chapter06/readjusting.xml +++ b/chapter06/readjusting.xml @@ -52,11 +52,8 @@ this: -SPECFILE=`gcc --print-file specs` && -sed -e 's@ /tools/lib/ld-linux.so.2@ /lib/ld-linux.so.2@g' \ - $SPECFILE > newspecfile && -mv -f newspecfile $SPECFILE && -unset SPECFILE +sed -i 's@ /tools/lib/ld-linux.so.2@ /lib/ld-linux.so.2@g' \ + `gcc --print-file specs` Again, cutting and pasting the above is recommended. And just like before, it is a good idea to visually inspect the specs file to verify the diff --git a/chapter06/shadow.xml b/chapter06/shadow.xml index 0018929a2..1ce985807 100644 --- a/chapter06/shadow.xml +++ b/chapter06/shadow.xml @@ -66,9 +66,9 @@ both these things by changing the relevant configuration file while copying it to its destination (it's probably better to cut-and-paste this rather than try and type it all in): -sed -e 's%#MD5_CRYPT_ENAB.no%MD5_CRYPT_ENAB yes%' \ - -e 's%/var/spool/mail%/var/mail%' \ - etc/login.defs.linux > /etc/login.defs +cp etc/login.defs.linux /etc/login.defs +sed -i -e 's@#MD5_CRYPT_ENAB.no@MD5_CRYPT_ENAB yes@' \ + -e 's@/var/spool/mail@/var/mail@' /etc/login.defs Move some misplaced symlinks/programs to their proper locations: diff --git a/chapter06/sysvinit.xml b/chapter06/sysvinit.xml index 9f2ad48f8..4f098a0b0 100644 --- a/chapter06/sysvinit.xml +++ b/chapter06/sysvinit.xml @@ -36,9 +36,8 @@ run-level. While doing this, init outputs messages like misinterpretation, you can modify the source so that these messages read like Sending processes started by init the TERM signal instead: -cp src/init.c{,.backup} -sed 's/Sending processes/& started by init/g' \ - src/init.c.backup > src/init.c +sed -i 's@Sending processes@& started by init@g' \ + src/init.c Compile Sysvinit: diff --git a/chapter06/util-linux.xml b/chapter06/util-linux.xml index 64658f402..fbd42374a 100644 --- a/chapter06/util-linux.xml +++ b/chapter06/util-linux.xml @@ -35,9 +35,7 @@ instead of the usual /etc, as the location for the adjtime file. To make the hwclock program FHS-compliant, run the following: -cp hwclock/hwclock.c{,.backup} -sed 's%etc/adjtime%var/lib/hwclock/adjtime%' \ - hwclock/hwclock.c.backup > hwclock/hwclock.c +sed -i 's@etc/adjtime@var/lib/hwclock/adjtime@g' hwclock/hwclock.c mkdir -p /var/lib/hwclock