Revision 53a5929f snf-image-host/common.sh.in

b/snf-image-host/common.sh.in
292 292

  
293 293
do_debootstrap() {
294 294
    local target="$1"
295
    local cache="$2"
296
    local pkgs="$3"
295 297

  
296 298
    echo "Debootstraping to create a new root filesystem:"
297 299

  
......
308 310
        "$HELPER_MIRROR" 2>&1 | sed -e 's/^/DEBOOTSTRAP: /g'
309 311

  
310 312
    # Save the package list
311
    chroot "$target" dpkg-query -W -f "\${Package}\n" > "$HELPER_CACHE_PKGS"
313
    chroot "$target" dpkg-query -W -f "\${Package}\n" > "$pkgs"
312 314

  
313 315
    rm "$target/usr/sbin/policy-rc.d"
314 316

  
......
316 318
    find "$target/var/cache/apt/archives" -type f -name '*.deb' -print0 | \
317 319
        xargs -r0 rm -f
318 320

  
319
    local tmp_cache=$(mktemp "$CACHE_FILE.XXXXXX")
321
    local tmp_cache=$(mktemp "$cache.XXXXXX")
320 322
    tar cf "$tmp_cache" --one-file-system -C "$target" . || \
321 323
        { rm "$tmp_cache"; false; }
322 324
    # Overwrite the default cache file. Not the user specified if present.
323
    mv -f "$tmp_cache" "$HELPER_CACHE_FILE"
325
    mv -f "$tmp_cache" "$cache"
324 326
}
325 327

  
326 328
do_multistrap() {
327 329
   local target="$1"
330
   local cache="$2"
331
   local pkgs="$3"
328 332

  
329 333
    # Create a policy-rc.d file to deny init script execution
330 334
    mkdir -p "$target/usr/sbin"
......
338 342
        -f "$MULTISTRAP_CONFIG" 2>&1 | sed -u -e 's/^/MULTISTRAP: /g'
339 343

  
340 344
   # Save the package list
341
   chroot "$target" dpkg-query -W -f "\${Package}\n" > "$HELPER_CACHE_PKGS"
345
   chroot "$target" dpkg-query -W -f "\${Package}\n" > "$pkgs"
342 346

  
343 347
   rm "$target/usr/sbin/policy-rc.d"
344 348

  
345
   local tmp_cache=$(mktemp "$CACHE_FILE.XXXXXX")
349
   local tmp_cache=$(mktemp "$cache.XXXXXX")
346 350
   tar cf "$tmp_cache" --one-file-system -C "$target" . || \
347 351
        { rm "$tmp_cache"; false; }
348 352
   # Overwrite the default cache file. Not the user specified if present.
349
   mv -f "$tmp_cache" "$HELPER_CACHE_FILE"
353
   mv -f "$tmp_cache" "$cache"
350 354
}
351 355

  
352 356
report_and_cleanup(){
......
401 405
: ${IMAGE_DIR:="@localstatedir@/lib/snf-image"}
402 406
: ${IMAGE_DEBUG:="no"}
403 407
: ${HELPER_DIR:="@HELPER_DIR@"}
408
: ${HELPER_CACHE_DIR:="@HELPER_CACHE_DIR@"}
404 409
: ${HELPER_IMG:="@HELPER_IMG@"}
405 410
: ${HELPER_KERNEL:="@HELPER_KERNEL@"}
406 411
: ${HELPER_INITRD:="@HELPER_INITRD@"}
......
408 413
: ${HELPER_SOFT_TIMEOUT:=20}
409 414
: ${HELPER_HARD_TIMEOUT:=5}
410 415
: ${HELPER_USER:="nobody"}
411
: ${HELPER_CACHE_FILE:="@HELPER_DIR@/cache.tar"}
412
: ${HELPER_CACHE_PKGS:="@HELPER_DIR@/packages"}
413 416
: ${HELPER_EXTRA_PKGS:="linux-image-amd64,e2fsprogs,ntfs-3g,ntfsprogs,xmlstarlet,python,parted,reglookup,chntpw,util-linux"}
414 417
: ${HELPER_MIRROR:=""}
415 418
: ${PITHOS_DB:="sqlite:////@localstatedir@/lib/pithos/backend.db"}

Also available in: Unified diff