|
Line
Link Here
|
| 0 |
-- functions.stock |
0 |
++ functions.my |
|
Lines 452-459
Link Here
|
| 452 |
echo $$ >"$pidfile" |
452 |
echo $$ >"$pidfile" |
| 453 |
} |
453 |
} |
| 454 |
|
454 |
|
|
|
455 |
#get_packages() |
| 456 |
print_uris() |
| 457 |
{ |
| 458 |
[ -n "$APT_CONFIG" ] || Fatal "APT_CONFIG undefined." |
| 459 |
local out |
| 460 |
if ! out="$("$prog_apt_get" -q=2 -y --print-uris install -- "$@" 2>&1)"; then |
| 461 |
printf %s\\n "$out" >&2 |
| 462 |
Fatal "failed to calculate package file list." |
| 463 |
fi |
| 464 |
local grep_pattern="^'\\(file\\|copy\\):" |
| 465 |
local filenames |
| 466 |
if ! filenames="$(printf %s "$out" | grep -v "$grep_pattern" | cut -d' ' -f2)"; then |
| 467 |
printf %s\\n "$out" >&2 |
| 468 |
Fatal "failed to filter package file list." |
| 469 |
fi |
| 470 |
for f in $filenames; do |
| 471 |
[ -r "/var/cache/apt/archives/$f" ] && |
| 472 |
cp -- "/var/cache/apt/archives/$f" \ |
| 473 |
"$aptbox/var/cache/apt/archives/" && |
| 474 |
continue |
| 475 |
[ -r "$aptbox/../cache/archives/$f" ] && |
| 476 |
cp -- "$aptbox/../cache/archives/$f" \ |
| 477 |
"$aptbox/var/cache/apt/archives/" && |
| 478 |
continue |
| 479 |
done |
| 480 |
if ! "$prog_apt_get" -y -d install -- "$@" >&2; then |
| 481 |
printf %s\\n "$out" >&2 |
| 482 |
Fatal "failed to download packages." |
| 483 |
fi |
| 484 |
mkdir -p $aptbox/../cache/archives |
| 485 |
|
| 486 |
local local_uris |
| 487 |
local sed_pattern="'\\(file\\|copy\\):\\([^']\\+\\)' .*" |
| 488 |
if ! local_uris="$(printf %s "$out" |sed -ne "s/^$sed_pattern/\\2/pg")"; then |
| 489 |
printf %s\\n "$out" >&2 |
| 490 |
Fatal "failed to filter package file list." |
| 491 |
fi |
| 492 |
|
| 493 |
printf %s\\n "$local_uris" && |
| 494 |
for f in $filenames; do |
| 495 |
local ff="$aptbox/var/cache/apt/archives/$f" |
| 496 |
cp -- $ff "$aptbox/../cache/archives/" |
| 497 |
printf %s\\n "$ff" |
| 498 |
done && Verbose "packages are ready to install." |
| 499 |
} |
| 500 |
|
| 455 |
# assumed: defined APT_CONFIG, prog_apt_get |
501 |
# assumed: defined APT_CONFIG, prog_apt_get |
| 456 |
print_uris() |
502 |
old_print_uris() |
| 457 |
{ |
503 |
{ |
| 458 |
[ -n "$APT_CONFIG" ] || Fatal "APT_CONFIG undefined." |
504 |
[ -n "$APT_CONFIG" ] || Fatal "APT_CONFIG undefined." |
| 459 |
local out |
505 |
local out |