paul@31 | 1 | #!/bin/sh |
paul@22 | 2 | |
paul@63 | 3 | # Copyright (C) 2010, 2011, 2012, 2013 Paul Boddie <paul@boddie.org.uk> |
paul@63 | 4 | # |
paul@63 | 5 | # This program is free software; you can redistribute it and/or modify it under |
paul@63 | 6 | # the terms of the GNU General Public License as published by the Free Software |
paul@63 | 7 | # Foundation; either version 3 of the License, or (at your option) any later |
paul@63 | 8 | # version. |
paul@63 | 9 | # |
paul@63 | 10 | # This program is distributed in the hope that it will be useful, but WITHOUT |
paul@63 | 11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
paul@63 | 12 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
paul@63 | 13 | # details. |
paul@63 | 14 | # |
paul@63 | 15 | # You should have received a copy of the GNU General Public License along with |
paul@63 | 16 | # this program. If not, see <http://www.gnu.org/licenses/>. |
paul@63 | 17 | |
paul@22 | 18 | # Configuration: |
paul@22 | 19 | if [ -e userinstall-defaults ]; then |
paul@31 | 20 | . "$PWD/userinstall-defaults" |
paul@22 | 21 | elif [ -e /etc/default/userinstall ]; then |
paul@31 | 22 | . /etc/default/userinstall |
paul@22 | 23 | else |
paul@34 | 24 | echo "No defaults found for userinstall." 1>&2 |
paul@22 | 25 | exit 1 |
paul@22 | 26 | fi |
paul@22 | 27 | |
paul@34 | 28 | THISDIR=`dirname "$0"` |
paul@34 | 29 | |
paul@34 | 30 | if [ "$1" = '--help' ]; then |
paul@34 | 31 | echo "Usage: `basename $0` [ --root [ --dev ] ] [ <command and options> ]" |
paul@34 | 32 | exit 1 |
paul@34 | 33 | elif [ "$1" = '--root' ]; then |
paul@25 | 34 | shift 1 |
paul@34 | 35 | sudo "$THISDIR/user-do-root" $* |
paul@24 | 36 | else |
paul@58 | 37 | fakeroot fakechroot $FAKECHROOT_OPTIONS /usr/sbin/chroot "$PACKAGEROOT" $* |
paul@24 | 38 | fi |