Skip to content

Instantly share code, notes, and snippets.

@mrlesmithjr
Created December 3, 2019 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrlesmithjr/1d18e373b3915359f706889ff2fd0551 to your computer and use it in GitHub Desktop.
Save mrlesmithjr/1d18e373b3915359f706889ff2fd0551 to your computer and use it in GitHub Desktop.
### Late commands
ubiquity ubiquity/success_command string cp /target/etc/rc.local /target/etc/rc.local.orig; \
nic=$(nmcli d | grep -v lo | awk 'NR>1 { print $1 }'); \
echo "#!/bin/bash" > /target/etc/rc.local; \
echo "connected=\$(nmcli d | grep $nic | awk '{print \$3}')" >> /target/etc/rc.local; \
echo "while [ \"\${connected}\" != 'connected' ]; do" >> /target/etc/rc.local; \
echo "sleep 2" >> /target/etc/rc.local; \
echo "connected=\$(nmcli d | grep $nic | awk '{print \$3}')" >> /target/etc/rc.local; \
echo "done" >> /target/etc/rc.local; \
echo "sleep 2m" >> /target/etc/rc.local; \
echo "apt-get update -y > /var/log/rclog.txt 2>&1" >> /target/etc/rc.local; \
echo "echo \"libc6:amd64 libraries/restart-without-asking boolean true\" | sudo debconf-set-selections" >> /target/etc/rc.local; \
echo "echo \"libssl1.1:amd64 libssl1.1/restart-services string\" | sudo debconf-set-selections" >> /target/etc/rc.local; \
echo "apt-get install -y bc curl lsb-release openssh-server ntp wget >> /var/log/rclog.txt 2>&1" >> /target/etc/rc.local; \
echo "exit 0" >> /target/etc/rc.local; \
chmod +x /target/etc/rc.local; \
sed -i 's/^%sudo.*/%sudo ALL=(ALL:ALL) NOPASSWD:ALL/g' /target/etc/sudoers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment