#!/bin/bash
#
-# Copyright (C) 2010 Google Inc.
+# Copyright (C) 2010, 2011 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
filename=$1
+execasroot() {
+ local fname=$1
+ shift
+ if [[ -z "$FAKEROOT" ]]; then
+ echo "WARNING: FAKEROOT variable not set, skipping $fname" >&2
+ else
+ exec "$FAKEROOT" "$@"
+ fi
+}
+
case "$filename" in
+ *-runasroot.py) execasroot $filename $PYTHON "$@" ;;
*.py) exec $PYTHON "$@" ;;
+ *-runasroot) execasroot $filename "$@" ;;
*) exec "$@" ;;
esac