lxc-busybox.in revision f02ce27d4b1a9d01b88d0ffaf626e5bafa671bf0
342N/A# lxc: linux Container library 342N/A# Daniel Lezcano <daniel.lezcano@free.fr> 342N/A# This library is free software; you can redistribute it and/or 342N/A# modify it under the terms of the GNU Lesser General Public 342N/A# License as published by the Free Software Foundation; either 342N/A# version 2.1 of the License, or (at your option) any later version. 342N/A# This library is distributed in the hope that it will be useful, 342N/A# but WITHOUT ANY WARRANTY; without even the implied warranty of 342N/A# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 342N/A# Lesser General Public License for more details. 342N/A# You should have received a copy of the GNU Lesser General Public 342N/A# License along with this library; if not, write to the Free Software 342N/A# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 342N/A # minimal devices needed for busybox 342N/Aroot:x:0:0:root:/root:/bin/sh 342N/Aproc /proc proc defaults 0 0 342N/Ashm /dev/shm tmpfs defaults 0 0 342N/A # writable and readable for other 342N/A # launch rcS first then make a console available 342N/A # and propose a shell on the tty, the last one is 342N/A::sysinit:/etc/init.d/rcS 342N/Atty1::respawn:/bin/getty -L tty1 115200 vt100 342N/A # writable and readable for other 342N/A cat <<EOF >> $rootfs/usr/share/udhcpc/default.script 342N/A ip addr flush dev \$interface 342N/A if [ -n "\$router" ]; then 342N/A ip route del default 2> /dev/null 342N/A if [ -n "\$broadcast" ]; then 342N/A broadcast="broadcast \$broadcast" 342N/A ip addr add \$ip/\$mask \$broadcast dev \$interface 342N/A if [ -n "\$router" ]; then 1111N/A ip route add default via \$router dev \$interface 1111N/A [ -n "\$domain" ] && echo search \$domain > /etc/resolv.conf 1111N/A echo nameserver \$i >> /etc/resolv.conf 1111N/A [ [[ addgroup adduser adjtimex ar arp arping ash awk basename \ 1111N/A brctl bunzip2 bzcat bzip2 cal cat catv chattr chgrp chmod \ 1111N/A chown chpasswd chpst chroot chrt chvt cksum clear cmp comm \ 1111N/A cp cpio crond crontab cryptpw cut date dc dd deallocvt \ 1111N/A delgroup deluser df dhcprelay diff dirname dmesg dnsd dos2unix \ 1111N/A du dumpkmap dumpleases echo ed egrep eject env envdir envuidgid \ 1111N/A ether-wake expand expr fakeidentd false fbset fdformat fdisk \ 1111N/A fetchmail fgrep find findfs fold free freeramdisk fsck \ 1111N/A halt hdparm head hexdump hostid hostname httpd hwclock id \ 1111N/A ifconfig ifdown ifenslave ifup inetd init insmod install ip \ 1111N/A ipaddr ipcalc ipcrm ipcs iplink iproute iprule iptunnel \ 1111N/A kbd_mode kill killall killall5 klogd last length less linux32 \ 1111N/A linux64 linuxrc ln loadfont loadkmap logger login logname \ 1111N/A logread losetup lpd lpq lpr ls lsattr lsmod lzmacat makedevs \ 1111N/A mktemp modprobe more mount mountpoint msh mt mv nameif nc \ 1111N/A netstat nice nmeter nohup nslookup od openvt passwd patch \ 1111N/A pgrep pidof ping ping6 pipe_progress pivot_root pkill poweroff \ 1111N/A printenv printf ps pscan pwd raidautorun rdate readahead \ 342N/A readlink readprofile realpath reboot renice reset resize rm \ 342N/A rmdir rmmod route rpm rpm2cpio run-parts runlevel runsv \ 342N/A runsvdir rx script sed sendmail seq setarch setconsole \ 342N/A setkeycodes setlogcons setsid setuidgid sh sha1sum slattach \ 549N/A sleep softlimit sort split start-stop-daemon stat strings \ 342N/A stty su sulogin sum sv svlogd swapoff swapon switch_root \ 342N/A sync sysctl syslogd tac tail tar taskset tcpsvd tee telnet \ 1111N/A telnetd test tftp tftpd time top touch tr traceroute \ 1111N/A true tty ttysize udhcpc udhcpd udpsvd umount uname uncompress \ 1111N/A unexpand uniq unix2dos unlzma unzip uptime usleep uudecode \ 1111N/A uuencode vconfig vi vlock watch watchdog wc wget which \ 342N/A who whoami xargs yes zcat zcip" 1111N/A echo "busybox executable is not accessible" 342N/A echo "warning : busybox is not statically linked." 342N/A echo "warning : The template script may not correctly" 342N/A echo "warning : setup the container environment." 342N/A # copy busybox in the rootfs 342N/A echo "failed to copy busybox in the rootfs" 342N/A # do hardlink to busybox for the different commands 342N/A # passwd exec must be setuid 342N/A echo "No password for 'root', please change !" 616N/A# When using LXC with apparmor, uncomment the next line to run unconfined: 616N/A#lxc.aa_profile = unconfined 342N/Alxc.mount.entry=/lib $rootfs/lib none ro,bind 0 0 342N/Alxc.mount.entry=/usr/lib $rootfs/usr/lib none ro,bind 0 0 1111N/Alxc.mount.entry=/lib64 $rootfs/lib64 none ro,bind 0 0 342N/Alxc.mount.entry=/usr/lib64 $rootfs/usr/lib64 none ro,bind 0 0 342N/A$1 -h|--help -p|--path=<path> 1111N/A echo "This script should be run as 'root'" echo "'path' parameter is required" echo "failed to install busybox's rootfs" echo "failed to configure busybox template" echo "failed to write configuration file"