_ _ | |_ ___ __| |____ ___ _ _ | __/ _ \/ _` |_ / / _ \ | | | | || __/ (_| |/ / | __/ |_| | \__\___|\__,_/___(_)___|\__,_|
As a starting point, I adapted the examples provided here:
First, boot the PC into Debian 12.1 (Bookworm) using the standard USB live image.
sudo apt update
sudo apt install live-build
If you're going to build the custom image on a removable drive, you may need to remount it with the appropriate flags set, as shown below (replace the path shown with the one for your device).
sudo mount -o remount,exec,dev /media/user/[YOUR DEVICE NAME GOES HERE]
mkdir JotzLive
cd JotzLive/
The following command creates a configuration for the build process.
lb config -d bookworm --archive-areas "main contrib non-free-firmware" --parent-archive-areas "main contrib non-free-firmware" --bootappend-live "boot=live locales=en_GB.UTF-8 keyboard-layouts=gb timezone=Europe/Dublin user-default-groups=user,cdrom,floppy,sudo,audio,dip,video,plugdev,netdev,scanner,dialout"
Notes:
Create a file my.list.chroot containing the list of packages to be included in the custom build.
echo "task-xfce-desktop firmware-linux build-essential printer-driver-all v4l2loopback-dkms exfatprogs live-build vim-gtk3 geany gedit hexedit inkscape gimp imagemagick feh ristretto gphoto2 ffmpeg mplayer vlc mpg123 audacity blender kdenlive obs-studio screenkey gromit-mpx chromium lynx w3m elinks wget curl filezilla freerdp2-x11 gcc clang git gdb freeglut3-dev gcc-arm-none-eabi gdb-multiarch openocd python3-matplotlib python3-scipy python3-serial php octave tmux figlet xterm stterm kitty pv xclip htop bpytop fzf gdu ncdu bat ranger mc trash-cli neofetch wmctrl xdotool testdisk cmatrix hollywood pandoc texlive texlive-xetex fonts-ibm-plex fonts-ebgaramond-extra fonts-ebgaramond fonts-adf-universalis fonts-beteckna fonts-linuxlibertine gpxviewer gpsbabel wine fontforge" > config/package-lists/my.list.chroot
Notes:
Add some additional commands to a setup script, "setup.sh", that will be placed in the default user's home directory. This can be used to make some final tweaks to the desktop (e.g. set number of workspaces, remove desktop icon) at login time:
mkdir -p config/includes.chroot/etc/skel
cat > config/includes.chroot/etc/skel/setup.sh << 'EOF'
#!/bin/sh
# Set number of workspaces to two
xfconf-query -c xfwm4 -p /general/workspace_count -s 2
# Hide desktop icons
xfconf-query -c xfce4-desktop --create -t bool -p /desktop-icons/file-icons/show-filesystem -s false
xfconf-query -c xfce4-desktop --create -t bool -p /desktop-icons/file-icons/show-home -s false
xfconf-query -c xfce4-desktop --create -t bool -p /desktop-icons/file-icons/show-removable -s false
xfconf-query -c xfce4-desktop --create -t bool -p /desktop-icons/file-icons/show-trash -s false
# Identify connected monitor and store name in shell variable
monitor=`xrandr -q | sed -n '0,\|[[:space:]]connected[[:space:]]| s/^\([^[:space:]]*\)[[:space:]]\+connected[[:space:]].*$/monitor\1/ p'`
# Disable wallpaper on connected monitor (probably sufficient to set workspace0 only)
xfconf-query -c xfce4-desktop -pn /backdrop/screen0/$monitor/workspace0/image-style -t 'int' -s 0
xfconf-query -c xfce4-desktop -pn /backdrop/screen0/$monitor/workspace1/image-style -t 'int' -s 0
# Disable wallpaper (NB this version not working)
#for property in $(xfconf-query -c xfce4-desktop -l | grep image-style); do xfconf-query -c xfce4-desktop -p $property -s 0 ; done
#xfconf-query -c xfce4-desktop -pn /backdrop/screen0/monitor0/image-style -t 'int' -s 0
#xfconf-query -c xfce4-desktop -pn /backdrop/screen0/monitor1/image-style -t 'int' -s 0
# Enable touchpad tap to click
xfconf-query -c pointers -pn /SynPS2_Synaptics_TouchPad/Properties/libinput_Tapping_Enabled -t 'int' -s 1
xfconf-query -c pointers -pn /DELL0A2000_06CBCE65_Touchpad/Properties/libinput_Tapping_Enabled -t 'int' -s 1
# Create browser profiles one and two
firefox -CreateProfile one
firefox -CreateProfile two
# Set up shortcuts
echo "firefox -P one -private-window about:profiles &" > ~/one
echo "firefox -P two -private-window about:profiles &" > ~/two
chmod 755 ~/one ~/two
EOF
Set the mode of "setup.sh" so that it's executable:
chmod +x config/includes.chroot/etc/skel/setup.sh
To run the above setup script automatically at login, autostart it by creating the file MyDebLive.setup.desktop, as follows:
mkdir -p config/includes.chroot/etc/skel/.config/autostart
cat > config/includes.chroot/etc/skel/.config/autostart/MyDebLive.setup.desktop << 'EOF'
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=MyDebLive.setup
Comment=
Exec=/home/user/setup.sh
OnlyShowIn=XFCE;
RunHook=0
StartupNotify=false
Terminal=false
Hidden=false
EOF
Create ".vimrc":
cat > config/includes.chroot/etc/skel/.vimrc << 'EOF'
" Disable compatibility with vi
set nocompatible
" Filetype detection and configuration
filetype on
filetype plugin on
filetype indent on
" Syntax highlighting
syntax on
" Remap up and down arrow keys to move cursor
" one screen line in normal and visual modes
:noremap <Up> gk
:noremap <Down> gj
" Remap up and down arrow keys to move cursor
" one screen line in insert mode
:inoremap <Up> <C-o>gk
:inoremap <Down> <C-o>gj
" Enable line numbers
set number
"set nonumber
" Set tab width
set shiftwidth=4
set tabstop=4
set expandtab
" Set colour scheme
colorscheme ron
" Disable Vim mouse interaction, which re-enables
" regular terminal highlighting with mouse
set mouse=
EOF
Create ".tmux.conf":
cat > config/includes.chroot/etc/skel/.tmux.conf << 'EOF'
set-option -g escape-time 10
set-option default-terminal tmux-256color
EOF
Use a heredoc to create a file "/lib/systemd/system-sleep/post-suspend.sh" in the live system that will reload the usbhid module every time the system resumes after suspend. The file permissions are also changed to make the file executable.
mkdir -p config/includes.chroot/lib/systemd/system-sleep
cat > config/includes.chroot/lib/systemd/system-sleep/post-suspend.sh << 'EOF'
#!/bin/bash
if [ "${1}" == "post" ]; then
modprobe -r usbhid && modprobe usbhid
fi
EOF
chmod +x config/includes.chroot/lib/systemd/system-sleep/post-suspend.sh
As root, build the bootable live image. This may take several minutes.
sudo lb build
NB The following can be used instead to log the output during the build process:
sudo lb build 2>&1 | tee build.log
N.B. It is extremely important to identify the correct device filename of your USB drive (e.g. /dev/sdb, /dev/sdc, etc.) before writing the image to it. Writing the image to the wrong device using the command provided below will destroy the data on that device.
Still as root, copy the completed image to a USB drive. This may take several minutes to complete. The sync command ensures that all data has been written to the USB drive before it is removed.
sudo cp live-image-amd64.hybrid.iso /dev/[USB DRIVE DEVICE FILE NAME GOES HERE]
sudo sync
The USB key can now be unplugged and should be ready to use.
Create a backup copy of the iso with today's date added to the filename:
mv live-image-amd64.hybrid.iso `date +%Y.%m.%d_live-image-amd64.hybrid.iso`
Changes in next version:
Changes in 15-Aug-2023 version:
Changes in 13-Jan-2023 version:
Changes in 13-Dec-2022 version: