1.1 --- a/user-setup Tue Jul 12 00:47:20 2011 +0200
1.2 +++ b/user-setup Wed Jul 13 00:43:11 2011 +0200
1.3 @@ -1,5 +1,4 @@
1.4 #!/bin/sh
1.5 -# Usage: user-setup [ --root ] [ <mirror> ]
1.6
1.7 # Configuration:
1.8 if [ -e userinstall-defaults ]; then
1.9 @@ -7,37 +6,43 @@
1.10 elif [ -e /etc/default/userinstall ]; then
1.11 . /etc/default/userinstall
1.12 else
1.13 - echo "No defaults found for userinstall."
1.14 + echo "No defaults found for userinstall." 1>&2
1.15 exit 1
1.16 fi
1.17
1.18 if [ "$1" = "--help" ]; then
1.19 - echo "Usage: user-setup [ --root ] [ <mirror> ]"
1.20 - echo
1.21 - echo "Examples:"
1.22 - echo
1.23 - echo "user-setup"
1.24 - echo "user-setup file:///tmp/$USERINSTALL_CODENAME/"
1.25 - echo "user-setup http://ftp.xx.debian.org/debian/"
1.26 - echo "user-setup --root http://ftp.xx.debian.org/debian/"
1.27 + echo 1>&2 <<EOF
1.28 +Usage: `basename $0` [ --root ] [ <mirror> ]
1.29 +
1.30 +Examples:
1.31 +
1.32 +user-setup
1.33 +user-setup file:///tmp/$USERINSTALL_CODENAME/
1.34 +user-setup http://ftp.xx.debian.org/debian/
1.35 +user-setup --root http://ftp.xx.debian.org/debian/
1.36 +EOF
1.37 exit 1
1.38 +elif [ "$1" = '--root' ]; then
1.39 + AS_ROOT="$1"
1.40 + shift 1
1.41 fi
1.42
1.43 -if [[ "$1" && "$1" = '--root' ]]; then
1.44 - export AS_ROOT=' --root'
1.45 - export MIRROR="$2"
1.46 -else
1.47 - export MIRROR="$1"
1.48 +if [ ! "$PACKAGEROOT" ] || [ "$PACKAGEROOT" = '/' ]; then
1.49 + echo "The package root must be specified and not be set to / (the system root)." 1>&2
1.50 + exit 1
1.51 fi
1.52
1.53 +MIRROR="$1"
1.54 +
1.55 if [ "$AS_ROOT" ]; then
1.56 - debootstrap --include="gnupg,$KEYRING" "$USERINSTALL_CODENAME" "$PACKAGEROOT" "$MIRROR"
1.57 + sudo debootstrap --include="gnupg,$KEYRING" "$USERINSTALL_CODENAME" "$PACKAGEROOT" "$MIRROR"
1.58 else
1.59 fakeroot fakechroot $FAKECHROOT_OPTIONS debootstrap --variant=fakechroot --include="gnupg,$KEYRING" \
1.60 "$USERINSTALL_CODENAME" "$PACKAGEROOT" "$MIRROR"
1.61 fi
1.62
1.63 -echo
1.64 -echo "Don't forget to run the following before installing packages:"
1.65 -echo
1.66 -echo "user-postsetup$AS_ROOT [ <country> ]"
1.67 +echo 1>&2 <<EOF
1.68 +Don't forget to run the following before installing packages:
1.69 +
1.70 +user-postsetup $AS_ROOT [ <country> ]
1.71 +EOF