ifclass syntax within if statement

Thomas Neumann blacky+fai at fluffbunny.de
Thu Oct 17 14:45:11 CEST 2013


On Thursday 17 October 2013 07:31:33 Thomas Lange wrote:
> >>>>> On Wed, 16 Oct 2013 16:12:04 -0700, Bob Apodaca said:
>> When installing AMD64 systems, I have created a small script:
>> #!/bin/sh
>> 
>> if ifclass AMD64 ; then
>> 
>>      # https://wiki.debian.org/Multiarch/Implementation
>>      $ROOTCMD dpkg --add-architecture i386
>> 
>> fi
 
> Did you put those lines into hooks/updatebase.DEBIAN?
> That works for me.

Both answers point to the same issue. 'ifclass' is a bash function / 
subroutine. If one uses a different interpreter then bash, one will not be 
able to use any of the fai-specific functions.

Hooks are automatically parsed in a bash context, scripts use whatever 
interpreter you choose.

'/bin/sh' is likely to be provided by dash on recent debian releases and 
bash on older ones, but it ~could~ be something completely different. It's 
been a long time since I saw a system which provided /bin/sh by an actual 
'Bourne shell'.

bye
thomas


More information about the linux-fai mailing list