X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=febootstrap-run.sh;h=6c5e9b90e51020595d7d9eba7e53c298c63739c4;hb=9acbbf00f0cba3d4fcfea7e4261ccc4e113a1673;hp=d3a7603b84761a8acb64315a4c433cfc6a0fc4f8;hpb=b900dfdd10cab92a5c6978bc0f4db8f167ae82a9;p=febootstrap.git diff --git a/febootstrap-run.sh b/febootstrap-run.sh index d3a7603..6c5e9b9 100755 --- a/febootstrap-run.sh +++ b/febootstrap-run.sh @@ -21,7 +21,7 @@ unset CDPATH TEMP=`getopt \ - -o g:i: \ + -o '' \ --long help,ro \ -n febootstrap-run -- "$@"` if [ $? != 0 ]; then @@ -63,15 +63,24 @@ fi target="$1" shift -if [ ! -f "$target"/fakeroot.log ]; then +if [ $(id -u) -eq 0 ]; then + chroot "$target" "$@" + exit 0 +fi + +if [ $(id -u) -ne 0 -a ! -f "$target"/fakeroot.log ]; then echo "febootstrap-run: $target: not a root filesystem" exit 1 fi if [ "$readonly" = "no" ]; then - fakeroot -i "$target"/fakeroot.log -s "$target"/fakeroot.log \ - fakechroot -s \ + if [ $(id -u) -ne 0 ]; then + fakeroot -i "$target"/fakeroot.log -s "$target"/fakeroot.log \ + fakechroot -s \ + chroot "$target" "$@" + else chroot "$target" "$@" + fi else fakeroot -i "$target"/fakeroot.log \ fakechroot -s \