Skip to content

Commit

Permalink
Allows userdefined classes
Browse files Browse the repository at this point in the history
With this commit the user can add his own classes by:
- adding the class in the user_classes.conf file
- dealing with a numbered script in usercustomization/class/ folder (for example usercustomization/class/99-custom, chmod 755) to use the class
- adding all the files related to the classes in the usercustomization hierarchy

Signed-off-by: Florent CARLI <[email protected]>
  • Loading branch information
insatomcat committed Jun 27, 2024
1 parent 0eeea1c commit 21efdee
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ usercustomization/scripts/*
build_tmp/*
!build_tmp/.gitkeep
grub.cfg
user_classes.conf
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,18 @@ Both folders "build_debian_iso/usercustomization and build_debian_iso/srv_fai_co

### Mandatory
**change the authorized_keys files (user and root) with your own**
* update the file `srv_fai_config/class/SEAPATH_COMMON.var` and replace "myrootkey", "myuserkey" and "ansiblekey" by yours
* update the file `build_debian_iso/usercustomization/class/USERCUSTOMIZATION.var` and replace "myrootkey", "myuserkey" and "ansiblekey" by yours

### Optional
**changes in the the unprivileged user name and passwd, as well as the root passwd for the deployed server**
* update the file `srv_fai_config/class/SEAPATH_COMMON.var` (right now all passwords are "toto")
* update the file `build_debian_iso/usercustomization/class/USERCUSTOMIZATION.var` (right now all passwords are "toto")
more information about password hash : https://linuxconfig.org/how-to-hash-passwords-on-linux

**keyboard Layout:**
* HOST: create a grub item without the FRENCH flag (see "Classes Customization")
* VM: update the list of classes (CLASSES variable) in build_qcow2.sh script to remove the FRENCH class if you prefer an english keyboard layout ;)
* you can create your own class for debconf customization if you want
* HOST: by default the keyboard will be US. You can use the FRENCH of GERMAN classes to change this. For any other layout, you can create your own debconf in build_debian_iso/usercustomization/debconf/USERCUSTOMIZATION (or create your own class, see "User-defined classes" below)
* VM: by default the build_qcow2 script will import the FRENCH class, you can override the keyboard layout by creating your own debco nf in build_debian_iso/usercustomization/debconf/USERCUSTOMIZATION.

**other changes in `srv_fai_config/class/SEAPATH_COMMON.var`**
**other changes in `build_debian_iso/usercustomization/class/USERCUSTOMIZATION.var`**
* TIMEZONE, KEYMAP, apt_cdn: feel free to set you regionalized settings, it's all too french by default :)
* APTPROXY: in case your deployed host will need some proxy to access the debian mirror
* REMOTENIC, REMOTEADDR, REMOTEGW: if you want networking to be available right after deployement set ip/gateway to a specified niv (ie: ens0, enp0s1...)
Expand Down Expand Up @@ -80,6 +79,15 @@ The possibles flags to create a grub menu item are:

If you want an "english, no debug, no raid, no cockpit, no kerberos, standalone" installation, then you need to uncheck everything, which will result in a fake "noflag" grub menu item being added. This is normal.

**User-defined classes:**

The user can manage his own classes by:
- copying the template file user_classes.conf.example to user_classes.conf
- adding the class in the user_classes.conf file (this is for the mirror creation)
- dealing with a numbered script in usercustomization/class/ folder (for example usercustomization/class/99-custom, chmod 755) to use the class (see srv_fai_config/class/99-seapath script for reference)
- adding all the files related to the classes in the usercustomization hierarchy (for example usercustomization/package_config/USERCLASS1)


## Build a Virtual Machine image

To build a basic VM for the SEAPATH project, simply launch the script `build_qcow2.sh` from the directory where you want the .qcow2 file to be stored (the build host must use UEFI).
Expand Down
5 changes: 4 additions & 1 deletion build_iso.sh
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,11 @@ docker cp "$wd"/build_tmp/. fai-setup:/ext/srv/fai/config/
# Stopping the container after having added stuff in it
$COMPOSECMD -f "$wd"/docker-compose.yml down

# List user defined Classes
userClasses=$(grep -Ev "^#|^$" "$wd"/user_classes.conf | tr '\n' ',' | sed -e "s/,$//")

# Creating the mirror
CLASSES="FAIBASE,DEBIAN,GRUB_EFI,SEAPATH_COMMON,${finalClasses}USERCUSTOMIZATION,LAST"
CLASSES="FAIBASE,DEBIAN,GRUB_EFI,SEAPATH_COMMON,${finalClasses}USERCUSTOMIZATION,${userClasses},LAST"
$COMPOSECMD -f "$wd"/docker-compose.yml run --rm fai-setup bash -c "\
cp /etc/fai/apt/keys/* /etc/apt/trusted.gpg.d/ &&\
fai-mirror -c $CLASSES /ext/mirror"
Expand Down
2 changes: 1 addition & 1 deletion srv_fai_config/class/98-seapath
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/bash
#!/bin/bash

# do not use this if a menu will be presented
[ "$flag_menu" ] && exit 0
Expand Down
4 changes: 4 additions & 0 deletions user_classes.conf.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# list user defined classes, one class per line
# example :
# USERCLASS1
# USERCLASS2

0 comments on commit 21efdee

Please sign in to comment.