Last active
August 29, 2015 14:00
-
-
Save amercier/11366318 to your computer and use it in GitHub Desktop.
bash <(curl -# -L https://gist.github.com/amercier/11366318/raw) <user> <directory>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [ "`whoami`" != "root" ]; then | |
echo "You must execute this script as root" >&2 | |
exit 1 | |
fi | |
if [ "$1" == "" ]; then | |
echo "Syntax: $0 USER DIRECTORY" >&2 | |
exit 1 | |
fi | |
if [ "$2" == "" ]; then | |
echo "Syntax: $0 USER DIRECTORY" >&2 | |
exit 1 | |
fi | |
npm cache clean \ | |
&& sudo -u $1 -i npm cache clean \ | |
&& for g in $(ls "$2" | egrep ^generator- | grep -v playground); do \ | |
echo ===== $g ===== \ | |
&& cd $2/$g \ | |
&& sudo -u $1 -H npm install \ | |
&& npm link \ | |
|| exit 1; \ | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment