Debian preseed.cfg formatting

I’m trying to customise a user profile from preseed.cfg and some commands are working and some not. There is much conflicting snippets across the internet so googling actually does more harm than good.

For example these work:

in-target apt install -y --no-install-recommends ...; \
in-target wget http://dx10.co.za/setup/dxt2.zip; \

And these do not:

cd /target/home/$USER; \
sed -i 's/GRUB_TIMEOUT=5/GRUB_TIMEOUT=0/g' /target/etc/default/grub; \
touch /target/etc/apt/apt.conf; \
echo "vm.swappiness = 10" | tee -a /target/etc/sysctl.conf; \

I’ve tried the latter with/without in-target, without specifying /target/ in the location, etc.

Could someone please tell me the correct format for these commands, as the official documentation has 1 line as an example and it doesn’t contain any examples for anything other than apt…

My end goal is: Download theme files, copy to /etc/skel & /home/$USER (not root, the newly created user by setup), edit grub & apt settings, add optimised settings for sysctl.conf, and reboot into newly styled desktop.

Answer

maybe my approach will help in such cases:

d-i preseed/late_command string \
in-target curl tftp://tftp.local/pxe/basic_config/debian10.sh -o /root/init.sh ;\
in-target chmod +x /root/init.sh ;\
in-target /root/init.sh ;

this way I can basically execute a common bash script without the hustle of taking preseed-specials into account.

Attribution
Source : Link , Question Author : dxt2 , Answer Author : muaB

Leave a Comment