Revision 5a31f7ef

b/snf-image-host/common.sh.in
286 286
: ${HELPER_USER:="nobody"}
287 287
: ${HELPER_CACHE_FILE:="@HELPER_DIR@/cache.tar"}
288 288
: ${HELPER_EXTRA_PKGS:="linux-image-amd64,e2fsprogs,ntfs-3g,ntfsprogs,xmlstarlet,python"}
289
: ${HELPER_MIRROR:=""}
289 290

  
290 291

  
291 292
SCRIPT_NAME=$(basename $0)
b/snf-image-host/defaults
53 53
# to debootstrap to make the resulting helper image workable
54 54
# HELPER_EXTRA_PKGS="linux-image-amd64,e2fsprogs,ntfs-3g,ntfsprogs,xmlstarlet,python"
55 55

  
56
# HELPER_MIRROR: Debian mirror to use with debootstrap. Using a mirror close to
57
# you will speed up the whole debootstraping process. By default we do not
58
# define a mirror. Debootstrap will use it's default debian URL.
59
# HELPER_MIRROR="http://ftp.debian.org/debian"
60

  
56 61
# Paths for needed programs. Uncommend and change the variables below, if you
57 62
# don't want to use the default one.
58 63
# LOSETUP="losetup"
b/snf-image-host/snf-image-update-helper.in
65 65
else
66 66
    echo "not found"
67 67
    echo "Debootstraping to create a new root filesystem:"
68

  
69
    # Create a policy-rc.d file to deny init script execution
70
    mkdir -p "$target/usr/sbin"
71
    cat > "$target/usr/sbin/policy-rc.d" <<EOF
72
#!/bin/sh
73
exit 101
74
EOF
75
    chmod +x "$target/usr/sbin/policy-rc.d"
76

  
68 77
    debootstrap --arch amd64 --include "$HELPER_EXTRA_PKGS" \
69
        --variant=minbase stable "$target" 2>&1 | sed -e 's/^/DEBOOTSTRAP: /g'
78
        --variant=minbase stable "$target" "$HELPER_MIRROR" 2>&1 | sed -e 's/^/DEBOOTSTRAP: /g'
70 79

  
80
    rm "$target/usr/sbin/policy-rc.d"
81
    
71 82
    # remove the downloaded debs, as they are no longer needed
72 83
    find "$target/var/cache/apt/archives" -type f -name '*.deb' -print0 | \
73 84
        xargs -r0 rm -f
74 85

  
75 86
    tmp_cache=$(mktemp "$HELPER_CACHE_FILE.XXXXXX")
76
    tar cf "$tmp_cache" -C "$target" . || { rm "$tmp_cache"; false; }
87
    tar cf "$tmp_cache" --one-file-system -C "$target" . || { rm "$tmp_cache"; false; }
77 88
    mv -f "$tmp_cache" "$HELPER_CACHE_FILE"
78 89
fi
79 90

  

Also available in: Unified diff