From 1f0d7d2f78cae4d96e29787746e8cf3215b5008e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Mon, 11 Jan 2021 22:34:37 +0000 Subject: [PATCH] Add function to download source files. --- rootfs.sh | 34 ++++++++++++++++++---------------- sysa/diffutils-2.7.kaem | 4 ++-- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/rootfs.sh b/rootfs.sh index 3af6e29..5045c9c 100755 --- a/rootfs.sh +++ b/rootfs.sh @@ -87,22 +87,24 @@ popd cp "$(basename $url .tar.gz).kaem" tmp/after tar -C tmp/after -xf "../sources/$(basename $url)" -# gzip 1.2.4 -url=https://ftp.gnu.org/gnu/gzip/gzip-1.2.4.tar -pushd ../sources -wget --continue "$url" -popd -cp "$(basename $url .tar).kaem" tmp/after -cp "../sources/$(basename $url)" tmp/after - -# diffutils 2.7 -url=https://ftp.gnu.org/gnu/diffutils/diffutils-2.7.tar.gz -pushd ../sources -wget --continue "$url" -popd -cp "$(basename $url .tar.gz).kaem" tmp/after -cp "../sources/$(basename $url)" tmp/after +get_file() { + url=$1 + pushd ../sources + wget --continue "$url" + popd + ext="${url##*.}" + if [ "$ext" = "tar" ]; then + bname=$(basename "$url" .tar) + else + bname=$(basename "$url" ".tar.${ext}") + fi + cp "${bname}.kaem" tmp/after + cp "../sources/$(basename "$url")" tmp/after +} +# Download remaining sources +get_file https://ftp.gnu.org/gnu/gzip/gzip-1.2.4.tar +get_file https://ftp.gnu.org/gnu/diffutils/diffutils-2.7.tar.gz # General cleanup find tmp -name .git -exec rm -rf \; @@ -113,7 +115,7 @@ find . | cpio -H newc -o | gzip > initramfs.igz # Run ${QEMU_CMD:-qemu-system-x86_64} -enable-kvm \ - -m ${RAM:-8G} \ + -m "${RAM:-8G}" \ -nographic \ -no-reboot \ -kernel ../../kernel -initrd initramfs.igz -append console=ttyS0 diff --git a/sysa/diffutils-2.7.kaem b/sysa/diffutils-2.7.kaem index 2af1039..ed8ac10 100755 --- a/sysa/diffutils-2.7.kaem +++ b/sysa/diffutils-2.7.kaem @@ -30,5 +30,5 @@ tcc -c -I. fnmatch.c tcc -c -I. regex.c # Link -tcc -o ${bindir}/cmp cmp.o cmpbuf.o error.o getopt.o getopt1.o xmalloc.o version.o -tcc -o ${bindir}/diff diff.o analyze.o cmpbuf.o dir.o io.o util.o context.o ed.o ifdef.o normal.o side.o fnmatch.o getopt.o getopt1.o regex.o version.o +tcc -static -o ${bindir}/cmp cmp.o cmpbuf.o error.o getopt.o getopt1.o xmalloc.o version.o +tcc -static -o ${bindir}/diff diff.o analyze.o cmpbuf.o dir.o io.o util.o context.o ed.o ifdef.o normal.o side.o fnmatch.o getopt.o getopt1.o regex.o version.o