1 #!/bin/sh 2 3 # Configuration: 4 if [ -e userinstall-defaults ]; then 5 . "$PWD/userinstall-defaults" 6 elif [ -e /etc/default/userinstall ]; then 7 . /etc/default/userinstall 8 else 9 echo "No defaults found for userinstall." 1>&2 10 exit 1 11 fi 12 13 if [ "$1" = "--help" ]; then 14 cat 1>&2 <<EOF 15 Usage: `basename $0` [ --root ] [ <mirror> ] 16 17 Examples: 18 19 user-setup 20 user-setup file:///tmp/$USERINSTALL_CODENAME/ 21 user-setup http://ftp.xx.debian.org/debian/ 22 user-setup --root http://ftp.xx.debian.org/debian/ 23 EOF 24 exit 1 25 elif [ "$1" = '--root' ]; then 26 AS_ROOT="$1" 27 shift 1 28 fi 29 30 if [ ! "$PACKAGEROOT" ] || [ "$PACKAGEROOT" = '/' ]; then 31 echo "The package root must be specified and not be set to / (the system root)." 1>&2 32 exit 1 33 fi 34 35 MIRROR="$1" 36 PATH=$PATH${PATH:+:}/usr/sbin:/sbin 37 38 if [ "$AS_ROOT" ]; then 39 if ! sudo debootstrap --include="gnupg,$KEYRING" "$USERINSTALL_CODENAME" "$PACKAGEROOT" "$MIRROR" ; then 40 cat 1>&2 <<EOF 41 Failed to complete an installation of the chosen distribution. 42 See the error messages above for more information. 43 EOF 44 exit 1 45 fi 46 else 47 if ! fakeroot fakechroot $FAKECHROOT_OPTIONS debootstrap --variant=fakechroot --include="gnupg,$KEYRING" \ 48 "$USERINSTALL_CODENAME" "$PACKAGEROOT" "$MIRROR" ; then 49 cat 1>&2 <<EOF 50 Failed to complete an installation of the chosen distribution. 51 See the error messages above for more information. 52 EOF 53 exit 1 54 fi 55 fi 56 57 cat 1>&2 <<EOF 58 Don't forget to run the following before installing packages: 59 60 user-postsetup $AS_ROOT [ <country> ] 61 EOF