download your favourite iso
http://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/
wget http://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/10.2.0-live+nonfree/amd64/iso-hybrid/debian-live-10.2.0-amd64-standard+nonfree.iso
mount iso
mount -o loop debian-live-10.2.0-amd64-standard+nonfree.iso /mnt/
copy to local workdir
mkdir -p debian-live-custom/workdir
cp -av /mnt/live/filesystem.squashfs debian-live-custom/
unpack squashfs
cd debian-live-custom/workdir
unsquashfs ../filesystem.squashfs
mount binds
mount --bind /dev squashfs-root/dev
mount --bind /sys squashfs-root/sys
mount --bind /proc squashfs-root/proc
chroot
chroot squashfs-root
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
install packages
nano /etc/apt/sources.list
echo "nameserver 8.8.8.8" > /etc/resolv.conf
apt update
dpkg-reconfigure locales
apt install --no-install-recommends vim screen rsync bwm-ng iotop iftop mdadm gddrescue memtester stress openssh-server netrw tcpdump console-data quota ntfs-3g chntpw smbclient testdisk cryptsetup
systemctl disable mdadm
dpkg-reconfigure keyboard-configuration
dpkg-reconfigure console-setup
apt-get clean
sed config files
sed -i /etc/ssh/sshd_config -e s/#PermitRootLogin\ prohibit-password/PermitRootLogin\ yes/
sed -i /etc/ssh/sshd_config -e s/#PasswordAuthentication\ yes/PasswordAuthentication\ yes/
sed -i /etc/vim/vimrc -e s/\"syntax\ on/syntax\ on/
sed -i /root/.bashrc -e s/\#\ export\ LS_OPTIONS=\'--color=auto\'/export\ LS_OPTIONS=\'--color=auto\'/
sed -i /root/.bashrc -e s/\#\ eval\ \"\`dircolors\`\"/eval\ \"\`dircolors\`\"/
sed -i /root/.bashrc -e s/\#\ alias\ ls=\'ls\ \$LS_OPTIONS\'/alias\ ls=\'ls\ \$LS_OPTIONS\'/
sed -i /root/.bashrc -e s/\#\ alias\ ll=\'ls\ \$LS_OPTIONS\ -l\'/alias\ ll=\'ls\ \$LS_OPTIONS\ -l\'/
sed -i /root/.bashrc -e s/\#\ alias\ l=\'ls\ \$LS_OPTIONS\ -lA\'/alias\ l=\'ls\ \$LS_OPTIONS\ -lA\'/
set root password
passwd
exit
umount squashfs-root/dev
umount squashfs-root/sys
umount squashfs-root/proc
create squashfs
mksquashfs squashfs-root/ filesystem.squashfs -comp xz
prepare live iso
copy to local workdir
mkdir debian-live-iso-custom
cp -av /mnt/* debian-live-iso-custom/
cp -av /mnt/.disk debian-live-iso-custom/
cd debian-live-iso-custom
edit disk info corresponding to xorriso -V option
vim .disk/info
Debian 10.1 amd64 custom nonfree
copy custom squashfs
cp ../filesystem.squashfs live/filesystem.squashfs
create iso
xorriso -as mkisofs -V 'Debian 10.1 amd64 custom nonfree' -o ../debian-live-10.1-custom-amd64-nonfree.iso -J -J -joliet-long -cache-inodes -isohybrid-mbr /usr/lib/syslinux/bios/isohdpfx.bin -b isolinux/isolinux.bin -c isolinux/boot.cat -boot-load-size 4 -boot-info-table -no-emul-boot -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot -isohybrid-gpt-basdat -isohybrid-apm-hfsplus .