Sat May 29 13:51:43 2021 UTC

The install-nutyx script

Introduction

The script can be started from an already installed NuTyX or from another distribution.

Make sure you are using Bash interpreter otherwise the script will fail.

Make sure your distribution is running 2.32 glibc version minimum otherwise the script will fail.

It must be executed from the root account.

This script allows the installation of a base NuTyX in a folder.

It's signature can be verified by downloading the http://download.nutyx.org/install-nutyx.md5sum file.

[Important] This script does not allow you to overwrite another distribution or a NuTyX already installed in the target folder (/mnt/hd by default). And so if you have to restart the script it is important to delete the contents of the target folder first.

Let's start with a simple example

The traditionnal example to show how simple it is.

The script can install a Base NuTyX in the /mnt/hd by default. The command is as simple as:

bash install-nutyx

The installation will start immediatly.

Configuration variables

The use of variables allows the adaptation of the script to different scenarios: :
LFS The installation path. Ok in most cases.
CHROOT The list of packages to install prior the chroot of install-nutyx itself. Need to be used when trying from another distribution.
URL The url adress of the mirror where are the binaries located (remote or local). We can use our own server.
VERSION The version to be installed (fixed or rolling). The version is not checked by the script.

We can then install any version as long it exist on the server.

KERNEL As per default they are no kernel installed, up to you to choose one. Available kernel names:

kernel-49, kernel-414, kernel-419, kernel-54, kernel-510, kernel and linux-mainline.

DEPOT The local path of the downloaded binaries. This variable can be used in case you want to mount the depot directory (see the MOUNT variable).
MOUNT The local path of the packages depot to used for installation Allows us to install an NuTyX without the need of a network connection.
ISO If we want to generate an ISO from this installation, we can specify the name of the ISO to generate via this variable. See below.
ARCH The architecture we want to install. The variable will be use if we want to install a 32 bits NuTyX from a 64 bits OS. The otherway around is not possible.

The script will analyse the /etc/install-nutyx.conf file if it exist and used defined variables in it. Here is a summary example of the /etc/install-nutyx.conf file:

URL="http://localhost"
DEPOT="/DEPOT"
LFS="/mnt/lfs"
VERSION="rolling"

Typical example of the script: Install a NuTyX on a partition

Assuming the second partition of my harddisk is free, I'm going to install a NuTyX on the second partition of the first harddisk.
  • Open a temporary root session
    sudo bash
  • Format the second partition in ext4 file system:
    mkfs.ext4 /dev/sda2
  • Download the script and the signature
    wget http://www.nutyx.org/install-nutyx{,.md5sum}
  • Check the signature
    md5sum -c install-nutyx.md5sum
  • Mount the destination partition (here /dev/sda2 for example)
    mkdir -p /mnt/hd
    mount /dev/sda2 /mnt/hd
  • Install the base NuTyX
    bash install-nutyx
  • Once the installation is done, you can re-enter into the freshly installed NuTyX via the command:
    bash install-nutyx -ec
  • Adjust the /etc/fstab file if you choose to use systemD as init system:
    echo "/dev/sda2    /    ext4   defaults    0    0" >> /etc/fstab

The script can be used for both 32 bits and 64 bits architectures. By default, it will be the host architecture of the host machine that will be chosen. It's possible to install a 32 bits NuTyX from a 64 bits host machine but not the other way around. To install a 32 bits NuTyX from a 64 bits host machine, use the ARCH variable:

ARCH="i686" bash install-nutyx

By default, it will be the rolling branch of the NuTyX installed; it's possible to specify another branch. Specify the name of the branch via the VERSION variable. It should exist on the depot server.

VERSION="development" bash install-nutyx

The default URL will be used for downloading and configuration of NuTyX. To instead specify another URL, use the URL variable.

URL="http://192.168.0.254" bash install-nutyx

By default, it will be the /mnt/hd folder used for the installation, the LFS variable can be set to specify a new destination folder:

LFS="/My-NuTyX" bash install-nutyx
The folder will be automatically created if it does not already exist.

You can combine several variables:

LFS="/MINI-ISO" \
VERSION="rolling" \
URL="http://192.168.0.254" \
ARCH="i686" \
CHROOT="acl attr expat" \
bash install-nutyx

If you want to have your own configuration, it's possible to place your configuration files in the /etc/install-nutyx.conf.d/ folder. When you run the script, if files are found there, they will be used instead of the default ones.

Recognised configuration files list:
cards.conf /etc/cards.conf
pkgmk.conf /etc/pkgmk.conf
fstab /etc/fstab
.bashrc /root/.bashrc and /home/<username>/.bashrc
bashrc /etc/bashrc
profile /etc/profile
hosts /etc/hosts
inputrc /etc/inputrc
rc_site /etc/sysconfig/rc_site
.bash_profile /root/.bash_profile and /home/<username>/.bash_profile
.dmrc /etc/skel/.dmrc
shells /etc/shells
dircolors.sh /etc/profile.d/dircolors.sh
extrapaths.sh /etc/profile.d/extrapaths.sh
readline.sh /etc/profile.d/readline.sh
umask.sh /etc/profile.d/umask.sh
modules /etc/sysconfig/modules
createfiles /etc/sysconfig/createfiles
mouse /etc/sysconfig/mouse

As a conclusion:

[Important] Don't forget to remove/check the /etc/install-nutyx.conf file and the contents of the /etc/install-nutyx.d/ directory if necessary. Found files will be read and used by the script and allow a more powerful configuration.

Produce a customised ISO

[Important] Producing an ISO is only possible on NuTyX. Means, it's not possible to use another distribution for building an ISO.

As specified above, the ISO variable allows you to specify the name of the ISO to generate.

For example, the command below:

sudo ISO=gnome bash install-nutyx
will install and produce a gnome NuTyX in the /mnt/hd folder.

Possible ISO names are:

strict, mini, base, cli, gui, xorg, gui_extra, openbox, jwm, lxde, xfce4, mate, gnome and kde5

It is possible to test the command and thus view all the commands that are affected.

ISO=gnome bash install-nutyx -t
List of variables: 

LFS        : /mnt/hd
URL        : http://downloads.nutyx.org
VERSION    : rolling
KERNEL     : 
DEPOT      : /var/lib/pkg/depot
MOUNT      : 
SHELL      : /bin/bash
DEPOT_BASE : http://downloads.nutyx.org/x86_64/rolling/base
CHROOT     : nutyx busybox curl gcc bzip2 glibc zlib lz4 xz zstd \
libarchive openssl cards
CORE       : acl attr bash coreutils readline expat ncurses lzo gmp \
flex file gzip mpc mpfr grep sed findutils binutils inetutils diffutils \
shadow bc less libcap util-linux kmod kbd pam gdbm e2fsprogs libpipeline \
gettext procps-ng psmisc sudo tzdata iproute2 iana-etc groff man-db \
cards.man nutyx.man dialog cpio squashfs lsb-release grub eudev sysklogd \
sysvinit kernel efibootmgr linux-firmware systemd runyx wireless-tools \
wpa-supplicant gpm gpm.service dosfstools make-ca xdg-user-dirs \
sound-theme-freedesktop ntp ntp.service flcards gvfs network-manager-applet \
xorg-xinit xorg-xf86-input-synaptics xorg-xf86-input-wacom \
xorg-xf86-video-ati xorg-xf86-video-fbdev xorg-xf86-video-intel \
xorg-xf86-video-nouveau xorg-xf86-video-vesa xorg-xrandr xorg-setxkbmap \
firefox thunderbird gparted leafpad scrot vlc telegram gnome epiphany \
seahorse-nautilus evolution simple-scan gnome-weather gnome-chess balsa
DEVEL      : 
for k in $(ls /lib/modules/)
do
  mkinitramfs $k -nf
done
sed -i "s@kernel-419@$KERNEL@g" /sbin/setup-nutyx
cards purge
for d in opt bin etc lib lib64 root run sbin usr var home
do
  rm -f /ISO/boot/$d.squashfs
  mksquashfs /$d /ISO/boot/$d.squashfs
done
exit 0
ISO        : GNOME
STRICT     : kernel
MINI       : dhcpcd
BASE       : efibootmgr linux-firmware systemd runyx wireless-tools \
wpa-supplicant
CLI        : gpm gpm.service dosfstools make-ca xdg-user-dirs \
sound-theme-freedesktop ntp ntp.service
GUI        : flcards gvfs network-manager-applet
GUI_EXTRA  : firefox thunderbird gparted leafpad scrot vlc telegram
XORG       : xorg-xinit xorg-xf86-input-synaptics xorg-xf86-input-wacom \
xorg-xf86-video-ati xorg-xf86-video-fbdev xorg-xf86-video-intel \
xorg-xf86-video-nouveau xorg-xf86-video-vesa xorg-xrandr xorg-setxkbmap
GNOME_EXTRA: epiphany seahorse-nautilus evolution simple-scan \
gnome-weather gnome-chess balsa
KDE5_EXTRA : kdenlive k3b
JWM        : lxdm jwm
LXDE       : lxdm lxde
XFCE4      : lxdm xfce4 xfce4-extra
MATE       : lightdm mate
GNOME      : gnome
KDE5       : kde5
ISO Filename /mnt/hd/NuTyX_x86_64-21.03.0-rc4-GNOME.iso

As we can see, new variables are now available. These can also be redefined at your convenience:

STRICT, BASE, CLI, GUI, GUI_EXTRA, XORG, GNOME, GNOME_EXTRA, KDE5, KDE5_EXTRA, OPENBOX, JWM, LXDE, XFCE4, MATE.

Each variable specify a set of packages to be installed. Each ISO name use a set of thoses variables to build up the specified ISO. That means, by specifying your own set of packages for some or all of those variables, you will generate your very own ISO.

The table below shows which combination of each of thoses variables are used for each ISO.

Combinations of available variables for each ISO name:
STRICT STRICT
MINI STRICT + MINI
BASE STRICT + BASE
CLI STRICT + BASE + CLI
GUI STRICT + BASE + CLI + GUI
XORG STRICT + BASE + CLI + GUI + XORG
JWM STRICT + BASE + CLI + GUI + GUI_EXTRA + XORG + JWM
OPENBOX STRICT + BASE + CLI + GUI + GUI_EXTRA + XORG + OPENBOX
LXDE STRICT + BASE + CLI + GUI + GUI_EXTRA + XORG + LXDE
XFCE4 STRICT + BASE + CLI + GUI + GUI_EXTRA + XORG + XFCE4
MATE STRICT + BASE + CLI + GUI + GUI_EXTRA + XORG + MATE
GNOME STRICT + BASE + CLI + GUI + GUI_EXTRA + XORG + GNOME + GNOME_EXTRA
KDE5 STRICT + BASE + CLI + GUI + GUI_EXTRA + XORG + KDE5 + KDE5_EXTRA

A few examples

sudo ISO=KDE5 install-nutyx

install and produce a standard kde5 ISO in the /mnt/hd directory.

sudo \
ISO="lxde" \
XORG="xorg-xf86-input-synaptics" \
BASE="linux-firmware wireless-tools wpa-supplicant" \
GUI="xorg-xrandr" \
GUI_EXTRA="deadbeef geany firefox" \
DEVEL="&& setup-nutyx start && echo 'ready ?' && read a" \
CLI="dhcpcd openssh git cdrtools syslinux libisoburn dosfstools" \
LFS="/MyIso" \
DEPOT="/media/www/x86_64/rolling" \
MOUNT="/media/www/x86_64/rolling" \
install-nutyx

install and produce a customised lxde ISO. The BASE, CLI, GUI, XORG, GUI_EXTRA, DEVEL, LFS, MOUNT and DEPOT variables redefined.