Creating and maintaining a portable Slint

A Overview and instructions

Once fully installed but not yet booted Slint can be made "portable" if
it is installed alone on an USB drive using the script install-portable.
This means that it will be usable on any machine where this drive is
plugged in. Well, many if not any <smile>.

Limitations:
- Some machines can not boot in Legacy mode if the drive has a GPT,
  cf.: http://www.rodsbooks.com/gdisk/bios.html so it may be safer to
  use a DOS partition table if you want to be able to boot in this mode.
  For now the 'auto' script sets up a GPT, so either do not use it in
  this case or convert it to DOS with gdisk before running 'setup'. To
  do that type (the texts after # are comments, do not type them):
  gdisk <device name> # example: gparted /dev/sdc
  p # print the partition table as is. Check that it be the good device! 
  r # recovery and transformation menu
  g # convert the GPT to a DOS (MBR) layout
  w # write the changes and exit 
- If the machine on which you plug in the drive allows it you will be
  able to boot in either Legacy or UEFI mode, but to boot in UEFI mode
  the device should have an EFI System partition of size 100M.

A portable Slint includes an initrd with the needed kernel modules and
a custom configuration file grub.cfg allowing to boot only Slint. 

Please note that to boot Slint off an USB attached device you will need
to make it portable even if you do not intend to use it on another
machine.

The script install-portable was not shipped in Slint64-14.2.1.2.iso, so
to make Slint portable until the release of the next ISO, do this:
- Before installation download it, typing:
wget http://slackware.uk/slint/x86_64/slint-14.2.1/scripts/install-portable
  and put it somewhere on the host machine or a second USB stick.
- Install Slint on the USB drive, but do NOT install GRUB.
- At end of installation, do not reboot yet but mount the partition
  where install-portable is is stored as /floppy, then type:
sh /path/to/install-portable
  For instance if the script is at the root of /floppy, just type:
sh /floppy/install-portable

Whenever a kernel upgrade for Slint is available, type as root:
slapt-get -u
slapt-get --upgrade
upgrade-kernel
This will upgrade the kernel(s), make a new initrd with support for the
new kernel(s) if need be and update GRUB. If run in a portable Slint the
custom configuration file grub.cfg will be updated. 

B. Scripts used to create and maintain portability

This reading is intended for people interested by the details.

1. install-portable

install-portable allows to modify a system just installed on an USB
drive (hard disk or SSD connected through USB) so that it can boot on
on many  different computers. In that aim it will load at boot times all
kernel modules that can be needed to handle many hardware configurations
as well as the root file system. The boot menu will then only include
boot entries for Slint, as the machine on which it will be used is not
known in advance.

install-portable will be included in the installer of the next ISO.
Then, the user will have the option to make the installed system
portable or not:
- if the system should be portable, this script will be executed.
- else, grubconfig will be used.

Features:
- Build and install an initrd including the needed kernel modules,
- Remove the huge kernel if installed
- Install Grub in both EFI and Legacy modes with a custom grub.cfg
 
Please note that if Slint is the only system installed on a machine, it
won't hurt to make it "portable" even though it will stay on the same
machine. Only in case of multi-boot it is preferable to not use this
mode, so that the boot menu includes entries for the other OS.

2. update-portable

This script brings portability to an already installed Slint as if it
was set up this way at time of installation.

If the system is already portable, it is run transparently by the script
upgrade-kernel (see below) to update the initrd and the custom grub
configuration file grub.conf.

If you prefer to switch or go back to a non-portable Slint, just run
the script update-grub.

You can switch between portable and non-portable at libitum.

3. upgrade-kernel

This script applies an upgrade of kernel package provided by Slint:
- upgrading these packages,
- making an initrd with support for all the installed generic kernels,
- and updating the GRUB configuration file grub.cfg, running either
  update-portable or update-grub for a portable or non-portable Slint
  respectively.

Last updated on 24 July 2019
