Skip to content

Instantly share code, notes, and snippets.

@guelau
Last active July 11, 2016 21:31
Show Gist options
  • Save guelau/605ef8cfcf9d3b7e5b17 to your computer and use it in GitHub Desktop.
Save guelau/605ef8cfcf9d3b7e5b17 to your computer and use it in GitHub Desktop.
Usefull when I install a new development environment
#!/bin/bash
BIN_DIR="/usr/bin"
DOWNLOAD_SCRIPTS=(
"https://phar.phpunit.de/phpcpd.phar"
"https://phar.phpunit.de/phpunit.phar"
"https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar"
"http://phpdox.de/releases/phpdox.phar"
"http://static.pdepend.org/php/latest/pdepend.phar"
"https://phar.phpunit.de/phploc.phar"
"http://static.phpmd.org/php/latest/phpmd.phar"
"http://get.sensiolabs.org/php-cs-fixer.phar"
)
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
command -v curl >/dev/null 2>&1 || { echo >&2 "Please install curl or set it in your path. Aborting."; exit 1; }
command -v php >/dev/null 2>&1 || { echo >&2 "Please install php5. Aborting."; exit 1; }
JENKINS_PHP_DIR=$BIN_DIR/jenkins-php
mkdir -p $JENKINS_PHP_DIR
for SCRIPTURL in ${DOWNLOAD_SCRIPTS[@]}
do
SCRIPTNAME=${SCRIPTURL##*/}
echo "Installing $SCRIPTNAME to $BIN_DIR directory"
curl -o $JENKINS_PHP_DIR/$SCRIPTNAME $SCRIPTURL > /dev/null 2>&1
chmod +x $JENKINS_PHP_DIR/$SCRIPTNAME
ln -sf $JENKINS_PHP_DIR/$SCRIPTNAME $BIN_DIR/${SCRIPTNAME%.*}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment