commit: 1f0d7d2f78cae4d96e29787746e8cf3215b5008e
parent c4528a0dacfc3dd6a7ff0e744d23edba71362132
Author: Andrius Štikonas <andrius@stikonas.eu>
Date: Mon, 11 Jan 2021 22:34:37 +0000
Add function to download source files.
Diffstat:
2 files changed, 21 insertions(+), 19 deletions(-)
diff --git 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
@@ -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