From 0085573cf470dab1d7668c6ea44d395886b1e76f Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Sun, 25 Feb 2018 23:41:23 +0100 Subject: Download rootfs --- build.sh | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/build.sh b/build.sh index 43b9200..872d568 100755 --- a/build.sh +++ b/build.sh @@ -2,17 +2,39 @@ set -e -arch=x86_64 -arch_dash=`echo $arch | tr _ -` +arch=x86 +subarch=64 +arch_lxd=${arch}_${subarch} +arch_dash=${arch}-${subarch} ver=17.01.4 image=openwrt name=openwrt dist=lede -generic_rootfs=${dist}-${ver}-${arch_dash}-generic-rootfs.tar.gz +generic_rootfs_url=https://downloads.openwrt.org/releases/${ver}/targets/${arch}/${subarch}/${dist}-${ver}-${arch_dash}-generic-rootfs.tar.gz +generic_rootfs_sum=43886c6b4a555719603286ceb1733ea2386d43b095ab0da9be35816cd2ad8959 +generic_rootfs=dl/$(basename $generic_rootfs_url) + lxc_tar=${dist}-${ver}-${arch_dash}-lxd.tar.gz metadata=metadata.yaml +download_rootfs() { + test -e dl || mkdir dl + + if ! test -e "$generic_rootfs" ; then + echo Downloading $generic_rootfs_url + wget -O $generic_rootfs "$generic_rootfs_url" + fi +} + +check_rootfs() { + sum=$(sha256sum $generic_rootfs| cut -d ' ' -f1) + if test $generic_rootfs_sum != $sum; then + echo Bad checksum $sum of $generic_rootfs + exit 1 + fi +} + build_tarball() { fakeroot ./build_rootfs.sh $generic_rootfs $metadata $lxc_tar } @@ -22,11 +44,11 @@ build_metadata() { date=`date -R -d "@${stat}"` cat > $metadata <