Skip to content

Instantly share code, notes, and snippets.

@ryanwoodsmall
Last active May 2, 2019 18:16
Show Gist options
  • Save ryanwoodsmall/33968dae347543aab94ebb7f6e3fddac to your computer and use it in GitHub Desktop.
Save ryanwoodsmall/33968dae347543aab94ebb7f6e3fddac to your computer and use it in GitHub Desktop.
busybox_lxc_files
#!/bin/sh
/bin/test -e /etc/fstab && /bin/mount -a
/bin/test -e /dev/urandom || /bin/mknod -m 666 /dev/urandom c 1 9
/bin/test -e /dev/zero || /bin/mknod -m 666 /dev/zero c 1 5
/bin/test -e /dev/null || /bin/mknod -m 666 /dev/null c 1 3
/bin/syslogd
/bin/ifconfig eth0 0.0.0.0 up
/bin/udhcpc -b -v
# default
# ::sysinit:/etc/init.d/rcS
# ::askfirst:/bin/sh
# ::ctrlaltdel:/sbin/reboot
# ::shutdown:/sbin/swapoff -a
# ::shutdown:/bin/umount -a -r
# ::restart:/sbin/init
# tty2::askfirst:/bin/sh
# tty3::askfirst:/bin/sh
# tty4::askfirst:/bin/sh
#tty1::respawn:/bin/getty -L tty1 115200 vt100
#console::askfirst:/bin/sh
#::askfirst:/bin/sh
::sysinit:/etc/init.d/rcS
console::askfirst:/bin/cttyhack /bin/ash -il
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
/bin/sh
/bin/ash
#!/bin/sh
#
# via https://github.com/lxc/lxc/blob/master/templates/lxc-busybox.in
#
case "$1" in
deconfig)
ip addr flush dev $interface
;;
renew|bound)
# flush all the routes
if [ -n "$router" ]; then
ip route del default 2> /dev/null
fi
# check broadcast
if [ -n "$broadcast" ]; then
broadcast="broadcast $broadcast"
fi
# add a new ip address
ip addr add $ip/$mask $broadcast dev $interface
if [ -n "$router" ]; then
ip route add default via $router dev $interface
fi
[ -n "$domain" ] && echo search $domain > /etc/resolv.conf
for i in $dns ; do
grep "nameserver $i" /etc/resolv.conf > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo nameserver $i >> /etc/resolv.conf
fi
done
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment