Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save thejhh/a8862fb9be5bfde6a367eb97fde73c34 to your computer and use it in GitHub Desktop.

Select an option

Save thejhh/a8862fb9be5bfde6a367eb97fde73c34 to your computer and use it in GitHub Desktop.
# Setup swap file
# Setup non-graphical grub terminal
d-i preseed/late_command string \
mkdir /target/var/swap; \
chmod 700 /target/var/swap; \
dd if=/dev/zero of=/target/var/swap/swapfile0 bs=1M count=1024; \
chmod 600 /target/var/swap/swapfile0; \
mkswap /target/var/swap/swapfile0; \
echo "/var/swap/swapfile0 swap swap defaults 0 0" >> /target/etc/fstab ; \
mv /target/etc/rc.local /target/etc/rc.local.orig; \
echo '#!/bin/sh -e' > /target/etc/rc.local; \
echo '/usr/sbin/ufw allow ssh' >> /target/etc/rc.local; \
echo 'mv -f /etc/rc.local.orig /etc/rc.local' >> /target/etc/rc.local; \
echo 'test -x /etc/rc.local && /etc/rc.local' >> /target/etc/rc.local; \
echo 'exit 0' >> /target/etc/rc.local; \
chmod +x /target/etc/rc.local; \
sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0"/g; s/# *GRUB_TERMINAL=console/GRUB_TERMINAL=console/g' /target/etc/default/grub; \
in-target update-grub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment