#!/usr/bin/with-contenv bash # check for lock file to only run git operations once if [ ! -e /lock.file ]; then # give abc a sudo shell for development chsh abc -s /bin/bash sed -e 's/%sudo ALL=(ALL:ALL) ALL/%sudo ALL=(ALL:ALL) NOPASSWD: ALL/g' \ -i /etc/sudoers sed -e 's/^wheel:\(.*\)/wheel:\1,abc/g' -i /etc/group # create directory for project mkdir -p /code # make sure URL is set and folder is empty to clone code if [ ${GITURL+x} ] && [ ! "$(/bin/ls -A /code 2>/dev/null)" ] ; then \ # clone the url the user passed to this directory git clone "${GITURL}" /code fi else # lock exists not importing project this is a restart echo "Lock exists just starting cloud9" fi # create lock file after first run touch /lock.file # permissions mkdir -p /c9sdk/build/standalone echo "[cont-init.d] Setting permissions this may take some time" chown -R abc:abc \ /c9sdk/build/standalone \ /code \ /c9bins