If you've followed the building environment setup procedures in How To Build illumos and its related pages, the following script can help you check if the upstream repositories have any newer changesets and pulls them to your local repo. This script can be run as the build user, as well as another one like root (in that non-root case you may need to enter the building user's password to su into his account).


### This script pulls updates from some known repositories, doing the task
### as the designated build user account. Tested in oi_151a4.
### (C) 2012 by Jim Klimov, COS&HT

[ x"$BUILD_USER" = x ] && \

upd() {
        echo "=== Updating illumos-gate from origin..."
        cd /export/home/illumos-dev/code/illumos-gate && \
                hg pull -u
        echo ""

        echo "=== Updating illumos-userland from my fork (is it fresh?)..."
        cd /export/home/illumos-dev/code/illumos-userland && \
                hg pull -u
        echo ""

if [ "`/usr/bin/id -u`" != "`/usr/bin/id -u $BUILD_USER`" ]; then
        echo "=== Changing privileges to '$BUILD_USER'..."
        exec su - $BUILD_USER -c "$0" "$@"


Just save this script into whatever location suits you best, chmod +x and you're ready to go. Modify the paths as your environment needs.

If you use this routinely while working as a different unprivileged user, you might want to set up sudo, password-less SSH keys, or some other method to simplify and automate getting the build user's privileges.