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

PS4



Hi Vagrant,

In all Bourne compliant shells, the PS4 environment variable
is the line prefix used before emitting a traced command.
By default, it is "+ " so that when you've ``set -x'', each
line is prefixed with "+ " at the base level and, for each
level of nesting, the first character is duplicated.  So,
when you source a file ${file} but before this you:

   PS4=">$(basename ${file})> "

the command trace is tagged with the source file. e.g.

>>os> uname -s
>>os> tr '[:upper:]' '[:lower:]'
>os> os=linux

In this snippit, you can pretty well guess that the original
code looked like this:

   os=$(uname -s | tr '[:upper:]' '[:lower:]')

and "PS4" was set to ">os> ".  Note the doubled ">" in the
nested execution environment.

Anyway, to the real point:

>> === modified file 'tools/build/debian-cd'
>> --- tools/build/debian-cd 2007-03-30 22:21:46 +0000
>> +++ tools/build/debian-cd 2007-10-25 22:34:38 +0000
>> @@ -34,12 +32,19 @@
>>  
>>  isolinuxcfg="$TDIR/$CODENAME/boot1/isolinux/isolinux.cfg"
>>  if [ -f "$isolinuxcfg" ]; then
>> +    : configure isolinux.cfg
>>      if [ "true" = "$use_serial_console" ] && [ -n "$serial_console_speed" ]; then
>>          echo "SERIAL 0 $serial_console_speed 0" >> $isolinuxcfg
>>      fi
>> +
>>      if [ -n "$BOOT_TIMEOUT" ]; then
>>          sed -ie "s,TIMEOUT.*,TIMEOUT $BOOT_TIMEOUT,g" $isolinuxcfg
>>      fi
>> +
>> +    case $(type edit_isolinuxcfg 2>/dev/null) in
>> +    'edit_isolinuxcfg is a function'* )
>> +       edit_isolinuxcfg ${isolinuxcfg} ;;
>> +    esac
>>  fi
>>  
>>  for dir in etc install ; do
> 
> that's the part that didn't apply cleanly, what's it good for?

The ":" command shows up in the command trace.  It is not crucial.
The case statement I added checks to see if "edit_isolinuxcfg" is
a known shell function.  If it is, it is invoked with the name of
the config file.  Presumably, if someone provides such a function
they know what they are doing.  Here's mine:

        edit_isolinuxcfg() {
            exec 3> LxCfg$$
            cat >&3 <<- EOF

                DEFAULT   install
                SERIAL    0 38400
                APPEND    console=ttyS0
                ONTIMEOUT harddisk
                CONSOLE   0

                LABEL harddisk
                  localboot   0x80
                  root        (hd0,0)
                  kernel      /boot/vmlinuz
                EOF

            egrep -v -i '^default ' ${1} >&3
            exec 3>&-

            mv -f LxCfg$$ ${1}
        }

and, no, I don't know exactly what I'm doing.  :)  I'm trying to get
the thing to boot off of the hard disk if the CD were left in the
drive after an install, and nobody is paying attention.  (i.e. after
several minutes of waiting for an answer to, "do you really want to install?")

Thanks for your help!!  Cheers - Bruce

P.S. please CC me because, despite being subscribed, I get no debian-custom
list emails.  Thanks!



Reply to: