Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
### 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