Add function to download source files.

This commit is contained in:
Andrius Štikonas 2021-01-11 22:34:37 +00:00
parent c4528a0dac
commit 1f0d7d2f78
2 changed files with 20 additions and 18 deletions

View File

@ -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

View File

@ -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