#!/bin/sh
set -ex

# Run $1 as a normal user. This isn't currently quoted properly, but it does
# run the command in a login shell, which I think is as close as I can get and
# all I need right now. It also preserves the current working directory so that
# dep8 test resources can still be located. There was some discussion of this
# approach at: http://irclogs.ubuntu.com/2014/06/06/%23ubuntu-devel.html#t09:35

# Author: Robie Basak <robie.basak@canonical.com>

adduser --disabled-password --gecos '' testuser

sudo -iu testuser sh <<EOT
cd "$PWD"
$@
EOT
