Setting variables and notiying the user - How?

Thomas Kloepfer thomas.kloepfer at iwr.uni-heidelberg.de
Wed Sep 27 12:21:15 CEST 2023


Hello

I use FAI to set up new machines so that users have a good starting 
point for their new ubuntu machine. In this configuration I managed to
- partition the disk
- set up kerberus
- set up AD authentication
- set up some nfs-mounts
- set up admin users with pub-key
- ...
and many more things. So far so good.

But want to do this:

Generate a password during the installation process.
Notify the the user what the generated password is.
Install a sudo user that has this password.

Problem 1: How do I display a message to the User?

I can configure scripts in [ 
config/scripts/<classname>/30-my-pw-display-script ].
But simple echo is not displayed. Any output I echo out I will find in 
the List of FAI-classes and messes up my configuration.

I found a workaround to this problem by setting up my own script
[ config/class/45-message-local-admin-pw,sh ]
and using [dialog] for the output.

I got the hint to do so by looking at [ config/class/40-parse-profiles.sh ].

But how can I output a message to the user from a script that lies in
[ config/scripts/<classname>/ ] ?

Problem 2:

Scripts in [ config/scripts/<classname>/ ] have access to environment 
variables such as HOST, FAI_ROOT, KEYMAP ... . But how can I set up my 
own environment variable in one script and later on read this variable 
in an other script.

For my task I need to set up the password for the sudo user. I want to 
store this generated password in an environment variable. An I want to 
read this environment variable later in my script.

The documentation of FAI says, that variables that have been set up in 
hooks get sourced. So I tried to set up my own hook ( [ 
config/hooks/myvar.<classname> ] ) and set a variable. But the variable 
I set up (and I exported) was not accessible later.

I found a workaround for this task, but I am not happy with it:
I tweaked [ config/hooks/setup.DEFAULT.sh ] added my variable this 
worked. I could access this variable later in my scripts.

But this solution is quiet ugly because I do not want to change the 
original FAI scripts.
I want to add my own hook.

Can anyone help me?

Regards
Thomas Kloepfer





More information about the linux-fai mailing list