Changeset 2

Show
Ignore:
Timestamp:
10/05/08 21:56:53 (4 years ago)
Author:
torsten
Message:

Changed command line options from original debootstrap (don't want to
parse that). Limits ways to call debootstrap, but it is used in quite
plain way anyway.
Create a tar.gz from the installed system (otherwise the permissions are
lost after the script terminates). Symlinks of resulting tar.gz are all
wrong (using absolute location of created system) and some files are still
owned by the real user who called fakeroot and fakechroot.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • openvz-template/trunk/make-openvz-template

    r1 r2  
    11#! /bin/sh 
    22 
     3# Simulate that we are running as root if it does not look like that 
     4# already. 
     5 
    36if [ $(id -u) -ne 0 ]; then 
     7    PATH="/usr/local/sbin:/usr/sbin:/sbin:$PATH" 
    48    exec fakechroot fakeroot "$0" "$@" 
    59fi 
    610 
     11 
     12# Parse the options 
     13 
     14# Options to pass to debootstrap 
     15 
     16STRAPOPTS="--variant=fakechroot" 
     17SUITE="sid" 
     18MIRROR="http://ftp.de.debian.org/debian" 
     19 
    720while [ $# -ne 0 ]; do 
    821    case "$1" in 
    9     -x) 
     22    --make-tarball=*) 
     23        STRAPOPTS="$STRAPOPTS $1" 
    1024        shift 
    11         DEBOOTSTRAP_OPTS="$1" 
     25        ;; 
     26    --unpack-tarball=*) 
     27        # Work around http://bugs.debian.org/500759 
     28        STRAPOPTS="$STRAPOPTS --unpack-tarball ${1#--unpack-tarball=}" 
     29        shift 
     30        ;; 
     31    --suite=*) 
     32        SUITE=${1#--suite=} 
    1233        shift 
    1334        ;; 
    1435    *) 
    15         echo >&2 "Usage: ..." 
    16         exit 1 
     36        if [ $# -eq 1 ]; then 
     37            TARGET="$1" 
     38            shift 
     39        else 
     40            echo >&2 "Usage: ..." 
     41            exit 1 
     42        fi 
    1743        ;; 
    1844    esac 
    1945done 
    2046 
    21 debootstrap --variant=fakechroot $DEBOOTSTRAP_OPTS 
     47 
     48debootstrap --variant=fakechroot $STRAPOPTS "$SUITE" "$TARGET" "$MIRROR" 
     49tar -czf "$TARGET".tar.gz -C "$TARGET" .