mirror of
https://github.com/tuna/tunasync.git
synced 2025-04-20 20:22:46 +00:00
apt-download update: more robust
This commit is contained in:
parent
a3b0fcf2eb
commit
f9805dbc48
@ -21,6 +21,10 @@ function apt-download-binary() {
|
|||||||
repo=$3
|
repo=$3
|
||||||
arch=$4
|
arch=$4
|
||||||
dest_base_dir=$5
|
dest_base_dir=$5
|
||||||
|
if [ -z $dest_base_dir ]; then
|
||||||
|
echo "Destination directory is empty, cannot continue"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
dest_dir="${dest_base_dir}/dists/${dist}"
|
dest_dir="${dest_base_dir}/dists/${dist}"
|
||||||
[ ! -d "$dest_dir" ] && mkdir -p "$dest_dir"
|
[ ! -d "$dest_dir" ] && mkdir -p "$dest_dir"
|
||||||
@ -57,6 +61,8 @@ function apt-download-binary() {
|
|||||||
if [[ "$filename" =~ ${repo}/binary-${arch} ]]; then
|
if [[ "$filename" =~ ${repo}/binary-${arch} ]]; then
|
||||||
# Load package list from Packages file
|
# Load package list from Packages file
|
||||||
pkgidx_file="${dest_base_dir}/dists/${dist}/${filename}"
|
pkgidx_file="${dest_base_dir}/dists/${dist}/${filename}"
|
||||||
|
dest_dir=`dirname ${pkgidx_file}`
|
||||||
|
[ ! -d "$dest_dir" ] && mkdir -p "$dest_dir"
|
||||||
pkglist_url="${base_url}/dists/${dist}/${filename}"
|
pkglist_url="${base_url}/dists/${dist}/${filename}"
|
||||||
check-and-download "${pkglist_url}" ${pkgidx_file} || true
|
check-and-download "${pkglist_url}" ${pkgidx_file} || true
|
||||||
echo "${checksum} ${pkgidx_file}" | ${checksum_cmd} -c -
|
echo "${checksum} ${pkgidx_file}" | ${checksum_cmd} -c -
|
||||||
@ -119,6 +125,8 @@ function apt-download-binary() {
|
|||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo "Mirroring ${base_url} ${dist}, ${repo}, ${arch} done!"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# vim: ts=4 sts=4 sw=4
|
# vim: ts=4 sts=4 sw=4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user