_ _ (_) ___ | |_ ____ | |/ _ \| __|_ / | | (_) | |_ / / _/ |\___/ \__/___| |__/
As a starting point, I adapted the examples provided here:
First, boot the PC into Debian 11 (Bullseye) using the standard USB live image (or an existing custom live image, which is what I use).
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 MyDebLive
cd MyDebLive/
The following command creates a configuration for the build process.
lb config -d bullseye --archive-areas "main contrib non-free" --parent-archive-areas "main contrib non-free" --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 exfat-utils live-build vim-gtk geany gedit tilde micro hexedit inkscape gimp imagemagick ristretto feh gphoto2 ffmpeg mplayer vlc mpg123 audacity blender kdenlive obs-studio screenkey gromit-mpx chromium falkon 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 julia tmux xterm stterm kitty pv xclip htop bpytop fzf gdu ncdu bat ranger mc trash-cli neofetch wmctrl xdotool testdisk cmatrix hollywood pandoc pandoc-citeproc texlive texlive-xetex fonts-ibm-plex fonts-ebgaramond-extra fonts-ebgaramond fonts-adf-universalis fonts-beteckna fonts-linuxlibertine gpxviewer gpsbabel" > config/package-lists/my.list.chroot
Changes in next version:
Changes in 13-Jan-2023 version:
Changes in 13-Dec-2022 version:
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
Note: The default terminal type in tmux is "screen", which seems to be causing a problem with the micro editor. Specifically, using the shift key and e.g. arrow keys to select text is not working. There are a few workarounds that seem to get it working. One is to start micro (within tmux) as follows...
TERM=tmux micro main.c
or like this...
TERM=tmux-256color micro main.c
The alternative is to set it in ".tmux.conf" as shown above.
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
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/sdb
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`