lxc-alpine.in revision 691ac4a3397a652dc163e4014720f3c6f4836052
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yookey_sha256sums="9c102bcc376af1498d549b77bdbfa815ae86faa1d2d82f040e616b18ef2df2d4 alpine-devel@lists.alpinelinux.org-4a6a0840.rsa.pub
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo2adcf7ce224f476330b5360ca5edb92fd0bf91c92d83292ed028d7c4e26333ab alpine-devel@lists.alpinelinux.org-4d07755e.rsa.pub"
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo echo "Using static apk from $repository/$apk_arch"
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo BEGIN { split(pkglist,pkg) }
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo $0 != "" { f[$1] = $2 }
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo $0 == "" { for (i in pkg)
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo if (pkg[i] == f["P"])
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo keyname=$(echo $rootfs/sbin/apk.static.*.pub | sed 's/.*\.SIGN\.RSA\.//')
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo checksum=$(echo "$key_sha256sums" | grep -w "$keyname")
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo (cd $rootfs/etc/apk/keys && echo "$checksum" | sha256sum -c -) || return 1
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo openssl dgst -verify $rootfs/etc/apk/keys/$keyname \
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo -signature "$APK.SIGN.RSA.$keyname" "$APK" || return 1
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo mirror_list=$rootfs/usr/share/alpine-mirrors/MIRRORS.txt
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo mirror_count=$(wc -l $mirror_list | cut -d " " -f 1)
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo repository=$(sed $(expr $RANDOM % $mirror_count + 1)\!d \
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo if ! [ -d "$rootfs"/etc/apk/keys ] && [ -d "$keys_dir" ]; then
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo echo "$repository" > "$rootfs"/etc/apk/repositories
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo cp /etc/apk/repositories "$rootfs"/etc/apk/repositories || return 1
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo sed -i -e "s:/[^/]\+/\([^/]\+\)$:/$release/\1:" \
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo $APK add -U --initdb --root $rootfs $opt_arch "$@" alpine-base
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo::sysinit:/sbin/rc sysinit
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo::wait:/sbin/rc default
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yootty1:12345:respawn:/sbin/getty 38400 tty1
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yootty2:12345:respawn:/sbin/getty 38400 tty2
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yootty3:12345:respawn:/sbin/getty 38400 tty3
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yootty4:12345:respawn:/sbin/getty 38400 tty4
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo::ctrlaltdel:/sbin/reboot
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo::shutdown:/sbin/rc shutdown
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo if [ -f /etc/TZ ]; then
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo grep nameserver /etc/resolv.conf > "$rootfs/etc/resolv.conf"
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yooiface lo inet loopback
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yooiface eth0 inet dhcp
2aeb28ec17b8973de3b0d52463f661985a6332d6Sungbae Yoo# mknod -m 600 "$rootfs/dev/initctl" p
2aeb28ec17b8973de3b0d52463f661985a6332d6Sungbae Yoo ln -s /etc/init.d/bootmisc "$rootfs"/etc/runlevels/boot/bootmisc
2aeb28ec17b8973de3b0d52463f661985a6332d6Sungbae Yoo ln -s /etc/init.d/syslog "$rootfs"/etc/runlevels/boot/syslog
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo grep -q "^lxc.rootfs" $path/config 2>/dev/null \
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo lxc_network_link_line="# lxc.network.link = br0"
2b371b262f7272266ff18cc2aff65176a2c16383Sungbae Yoo if [ -d /sys/class/net/$br/bridge ]; then
cat >&2 <<EOF
-h|--help)
-n|--name)
--rootfs)
-p|--path)
-r|--repository)
-R|--release)
-a|--arch)
if [ -z "$rootfs" ]; then
if [ -z "$rootfs" ]; then
x86)