Tuesday, 31 December 2019

New features in 'isorespin.sh'


Canonical publishing new releases of Ubuntu means new release code names, version numbers and updated EOL schedules for existing releases. In turn this drives new versions of 'isorespin.sh' which include support for these latest releases together with any idiosyncrasies of the resultant ISOs that need specific coding work arounds. Inevitably new versions are also required for bug fixes and also as opportunities arise for general improvements.

One such opportunity came as a result of users wanting to respin Ubuntu-Studio ISOs which earlier were not supported as this distro used 'lowlatency' kernels rather than the standard 'generic' kernel. Although adding support for Ubuntu-Studio was relatively easy it did require a change to how kernel packages were handled in general.

In turn this prompted a complete rewrite of how 'rolling' kernels were processed and included important efficiency improvements together with support for the installation of meta kernel packages where appropriate rather than specific kernel versions facilitating easier ongoing upgrades post ISO installation.

Finally three new options ('--debug', '--interactive' and '--dist-upgrade') have been added which improve the overall functionality of 'isorespin.sh'. These have resulted in a rework of the 'usage' text:

linuxium@LINUXIUM:~$ isorespin.sh --help
Usage: /usr/local/bin/isorespin.sh [ -h | -v | --check | --rolling-list ]
       /usr/local/bin/isorespin.sh -i <ISO> [ [ -u | -k <kernel> ] | [ --dist-upgrade | --upgrade ] | ...
       /usr/local/bin/isorespin.sh ... [ --rolling-release | --rolling-release-hwe | --rolling-release-hwe-edge | --rolling-proposed | --rolling-proposed-hwe | --rolling-proposed-hwe-edge | ...
       /usr/local/bin/isorespin.sh ... --rolling-testing | --rolling-testing-hwe | --rolling-testing-hwe-edge | --rolling-unstable | --rolling-unstable-hwe | --rolling-unstable-hwe-edge ] | ...
       /usr/local/bin/isorespin.sh ... -b [ GRUB | GRUB-32 | GRUB-64 | rEFInd | Linuxium ] | -g [ "" | "<kernel boot parameter> ... " ] | -s [ <size>MB | <size>GB ] | -w <directory> | ...
       /usr/local/bin/isorespin.sh ... --key "<repo> ... " | -r "<repo> ... " | -p "<pkg> ... " | -l "<pkg.deb> ... " | -e "<pkg> ... " | -d "<pkg> ... " | -f [ "<file> | <directory> ... " ] | ...
       /usr/local/bin/isorespin.sh ... -c "<cmd> ... " | -o [ "<file> | <directory> ... " ] | -t <template configuration file> | --apollo | --atom | --interactive | --debug ]
linuxium@LINUXIUM:~$ 

The first new option is '--debug'. Most of the options don't include their interaction with the ISO when being executed either on the screen or in the log file. For example when adding the package 'ethtool' the log merely includes a line stating that the package has been added:


The '--debug' option redirects the output from executing the commands behind an option to the log file. Using the same example the complete output from installing the package is now included in the log file:


While including the output from successful option execution may be interesting the key benefit of using '--debug' is when a command run as part of an option fails. Having the full output including the actual error messages in the log file is invaluable for debugging respinning issues.

The second new option has been included as sometimes trying to respin an ISO using complex option combinations fails as typically the consequences of running certain commands or their effect on the ISO are not fully known or easily predictable. In these circumstances respinning interactively would be easier and hence the new option '--interactive'. This option simply drops you into a 'root' shell where you can manually enter commands to modify the ISO:


Simply press 'control-D' when finished to return to respinning the ISO. This option uses the 'script' command to record the interactive session so that it can be included in the log file in full if the '--debug' option is used in conjunction or manipulated to just show a summary of the commands entered for inclusion into the default log file. This command summary is also included in the 'README.isorespin' file that is added to the respun ISO. As a result 'isorespin.sh' now depends on the package 'bsdutils' being installed which should already be the case in most situations. Because 'script' makes a typescript of everything displayed on the terminal it also includes temporary progress text together with cursor movement control codes and colour control codes which may become visible depending on how the log file is viewed. This may not be ideal in every circumstance however it is a compromise believed to be worthwhile considering the functionality gained.

Using the same example as earlier but this time installing the 'ethtool' package interactively having first performed an ''apt update':


the 'cat' command displays the log file created using the '--debug' option without distractions:


Because when performing the 'apt update' command various 'source' files are needed to be downloaded which result in progress text temporarily being displayed on the screen, when the command 'more' is used to display the log file it interprets the 'script' text in the log file differently and shows this colour-highlighted progress text:


Using the command 'view' to examine the log file shows all the text and all the control characters so consequently may not be the best way to view the log file:


For this particular example the summary of the '--interactive' commands that is also included in README.isorespin:


is similar to how this '--interactive' option is documented in the default log file without an additional '--debug' option:


The final new option is '--dist-upgrade'. This is similar to the '--upgrade' option and is best described by the 'man' entry for the commands used by the two options:

upgrade
upgrade is used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list. Packages currently installed with new versions available are retrieved and upgraded; under no circumstances are currently installed packages removed, or packages not already installed retrieved and installed. New versions of currently installed packages that cannot be upgraded without changing the install status of another package will be left at their current version. ...

dist-upgrade
dist-upgrade in addition to performing the function of upgrade, also intelligently handles changing dependencies with new versions of packages; apt-get has a "smart" conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less important ones if necessary. The dist-upgrade command may therefore remove some packages. The /etc/apt/sources.list file contains a list of locations from which to retrieve desired package files. ...
To illustrate the difference we can look at respinning an ISO (Ubuntu 18.04.3) first with the '--upgrade' option together with the '--debug' option which shows that the kernel meta packages are held back:


However using the '--dist-upgrade' option with the '--debug' options shows that new kernel packages will be installed as a result of upgrading the kernel meta packages:


This example again highlights the usefulness of the '--debug' option in understanding what happens as part of respinning an ISO.

Please donate if you find the script useful using the following link http://goo.gl/nXWSGf.

No comments:

Post a Comment

All comments now moderated so that spam can be deleted.