diff options
Diffstat (limited to 'build.sh')
-rwxr-xr-x | build.sh | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..93ad201 --- /dev/null +++ b/build.sh @@ -0,0 +1,48 @@ +#!/bin/sh + +set -e + +arch=x86_64 +arch_dash=`echo $arch | tr _ -` +ver=17.01.4 +image=openwrt +name=openwrt + +generic_rootfs=lede-${ver}-${arch_dash}-generic-rootfs.tar.gz +lxc_rootfs=lede-${ver}-${arch_dash}-lxc-rootfs.tar.gz + +build_rootfs() { + fakeroot ./build_rootfs.sh $generic_rootfs $lxc_rootfs +} + +build_metadata() { + stat=`stat -c %Y $lxc_rootfs` + date=`date -R -d "@${stat}"` + + cat > metadata.yaml <<EOF +architecture: "$arch" +creation_date: $(date +%s) +properties: + architecture: "$arch" + description: "OpenWrt $ver $arch ($date)" + os: "OpenWrt" + release: "$ver" +templates: +EOF +} + +build_image() { + tar czf metadata.tar.gz metadata.yaml + lxc image import metadata.tar.gz $lxc_rootfs --alias $image +} + +build_rootfs +build_metadata +build_image + +echo \# start +echo lxc launch --config "raw.lxc=lxc.aa_profile=lxc-container-default-without-dev-mounting" --profile openwrt $image $name +#lxc config +echo \# set root password +echo lxc exec $name passwd root +#echo 'echo "148.251.78.235 downloads.openwrt.org" |