mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-13 06:45:24 +01:00
add download cache
overload 'wget' with a function, so all wget downloads are cached in ether 'sources' or ENV defined using $CACHEDIR. directory 'sources' is already in .gitignore checksum store is in root-dir of repo and can be manually checked with: ( cd sources && sha256sum -c ../SHA256SUMS.sources ) introducing '$GITDIR' and enforce run in this dir.
This commit is contained in:
parent
b88fbd1a2d
commit
c0d2c232ac
2 changed files with 49 additions and 0 deletions
35
rootfs.sh
35
rootfs.sh
|
|
@ -4,6 +4,12 @@ set -ex
|
|||
QEMU_CMD="${1:-qemu-system-x86_64}" # or 'chroot' or 'minikernel'
|
||||
QEMU_RAM="${2:-8G}"
|
||||
|
||||
GITDIR="$PWD/$(dirname "$0")"
|
||||
if [ ! -f 'rootfs.sh' ]; then
|
||||
echo 'must be run from base of repo'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pushd sysa
|
||||
|
||||
# SYSTEM A
|
||||
|
|
@ -14,6 +20,35 @@ sudo mount -t tmpfs -o size=8G tmpfs tmp
|
|||
|
||||
LOGFILE="$PWD/tmp/bootstrap.log"
|
||||
|
||||
wget()
|
||||
{
|
||||
local url="$1"
|
||||
local dir="${CACHEDIR:-$GITDIR/sources}"
|
||||
local file
|
||||
|
||||
file=$(basename "$url")
|
||||
mkdir -p "$dir"
|
||||
|
||||
test -s "$dir/$file" || command wget -O "$dir/$file" "$url"
|
||||
cp -v "$dir/$file" .
|
||||
checksum_do "$dir" "$file"
|
||||
}
|
||||
|
||||
checksum_do()
|
||||
{
|
||||
local dir="$1"
|
||||
local file="$2"
|
||||
local line
|
||||
local store="$GITDIR/SHA256SUMS.sources"
|
||||
|
||||
if line=$(grep "[[:space:]][[:space:]]$file"$ "$store"); then
|
||||
(cd "$dir" && echo "$line" | sha256sum -c)
|
||||
else
|
||||
echo 'Checksum mismatch or not found!'
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# base: mescc-tools-seed
|
||||
# copy in all the mescc-tools-seed stuff
|
||||
cp -r mescc-tools-seed/src/mescc-tools-seed/x86/* tmp
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue