Tips and tricks: Difference between revisions

From FAIWiki
Jump to navigation Jump to search
No edit summary
(fix typo)
 
(18 intermediate revisions by 7 users not shown)
Line 1: Line 1:
If the pre-defined FAI soubroutines don't fit or you need additional soubroutines, <i>place a file called 'soubroutines' in your <b>'$FAI/hooks'</b></i> and it will be sourced by any installation.
maybe you will find other very helpful infos in [[Helper scripts]]!


To enable class specific soubroutines, create a hook <b><i>'defvar.DEFAULT.source'</i></b> with following content:
== better debugging of FAI scripts ==
* "set -vx" in a shellscript makes outpur very verbose and see command's exit status.
 
== some more example classes ==
* [[example class HWCD|shiney plastic disc drive detection]]
* [[example class BUS|USB/PCMCIA/CARDBUS bus interface detection]]
 
== User defined subroutines ==
 
If the pre-defined FAI subroutines don't fit or you need additional subroutines, <i>place a file called 'subroutines' in your <b>'$FAI/hooks'</b></i> and it will be sourced by any installation.
 
To enable class specific subroutines, create a hook <b><i>'defvar.DEFAULT.source'</i></b> with following content:
<pre>
<pre>
#! /bin/bash
#! /bin/bash
Line 10: Line 21:
done
done
return 0</pre>
return 0</pre>
<i>[jan 16:53, 24 Aug 2005 (CEST)]</i>
-----
== Fallback to local boot if no install needed ==
Rather than forcing a netboot when you want to install, you can run '''fai-chboot -o default''' once on the install server. If you have netboot as your first boot option, and local boot as second, your new server will check the fai server, if no install is required, it will boot up normally.
- Greenman (Thanks to MrFai on irc)
----
== Exim4 Ignores Debconf Settings ==
Exim4 maintains a kind of debconf cache in /etc/exim4/update-exim4.conf.conf.
When you use fai-debconf to set exim4 config settings that are held in this file, they will be ignored.
The simplest way around this issue is to remove this cache file before you install the debconf updates.
<i> [Oct 18 2005] Greenman (Thanks to juri on IRC ) </i>
== Debian wheezy and MultiArch ==
To add MultiArch support in wheezy, here i386 to an amd64 installation, you can add easily a new architecture via a new file <code>config/hooks/updatebase.AMD64 </code> with this content:
  #!/bin/bash
 
  echo Adding i386 multi-arch
  $ROOTCMD dpkg --add-architecture i386
After this, it is possilbe to install an i386 package by simply adding <code>:i386</code> to the package name, e.g. like
<code>acroread:i386</code>
But note, not all packages are prepared (now) for MultiArch, so even if the package might be for <code>all</code> architectures it might not work for <code>i386</code> architectures in an <code>amd64</code> environment.
== Setting hostname with FAI 4.x ==
Normally the hostname is given per DHCP, but if not, one has a problem to determine the hostname. One solution to solve this problem is to append a <code>hostname=</code> with the hostname of the system to the file in <code>pxelinux.cfg</code> directory. But with the simple example scripts of FAI 4.x this name is not set as hostname in the installed system, which makes it difficult to find the correct class after reboot in the new installation.
One solution is to add a line to <code>config/scripts/FAIBASE/10-misc</code> (or somewhere else, but here the hostname was set with FAI-3.x):
  if [ -n $HOSTNAME ]
  then
      echo $HOSTNAME    > $target/etc/hostname
  fi
[[Category:Development]]
[[Category:Howto]]
[[Category:Tutorial]]

Latest revision as of 10:48, 21 February 2014

maybe you will find other very helpful infos in Helper scripts!

better debugging of FAI scripts

  • "set -vx" in a shellscript makes outpur very verbose and see command's exit status.

some more example classes

User defined subroutines

If the pre-defined FAI subroutines don't fit or you need additional subroutines, place a file called 'subroutines' in your '$FAI/hooks' and it will be sourced by any installation.

To enable class specific subroutines, create a hook 'defvar.DEFAULT.source' with following content:

#! /bin/bash
for class in ${classes}
do
  [ -r ${FAI}/hooks/subroutines.${class} ] && \
  { echo "Reading subroutines.${class}." ; . ${FAI}/hooks/subroutines.${class} ; }
done
return 0

[jan 16:53, 24 Aug 2005 (CEST)]


Fallback to local boot if no install needed

Rather than forcing a netboot when you want to install, you can run fai-chboot -o default once on the install server. If you have netboot as your first boot option, and local boot as second, your new server will check the fai server, if no install is required, it will boot up normally.

- Greenman (Thanks to MrFai on irc)


Exim4 Ignores Debconf Settings

Exim4 maintains a kind of debconf cache in /etc/exim4/update-exim4.conf.conf. When you use fai-debconf to set exim4 config settings that are held in this file, they will be ignored.

The simplest way around this issue is to remove this cache file before you install the debconf updates.

[Oct 18 2005] Greenman (Thanks to juri on IRC )

Debian wheezy and MultiArch

To add MultiArch support in wheezy, here i386 to an amd64 installation, you can add easily a new architecture via a new file config/hooks/updatebase.AMD64 with this content:


 #!/bin/bash
 
 echo Adding i386 multi-arch
 $ROOTCMD dpkg --add-architecture i386


After this, it is possilbe to install an i386 package by simply adding :i386 to the package name, e.g. like acroread:i386

But note, not all packages are prepared (now) for MultiArch, so even if the package might be for all architectures it might not work for i386 architectures in an amd64 environment.

Setting hostname with FAI 4.x

Normally the hostname is given per DHCP, but if not, one has a problem to determine the hostname. One solution to solve this problem is to append a hostname= with the hostname of the system to the file in pxelinux.cfg directory. But with the simple example scripts of FAI 4.x this name is not set as hostname in the installed system, which makes it difficult to find the correct class after reboot in the new installation.

One solution is to add a line to config/scripts/FAIBASE/10-misc (or somewhere else, but here the hostname was set with FAI-3.x):

  if [ -n $HOSTNAME ]
  then
     echo $HOSTNAME     > $target/etc/hostname
  fi