Skip to content

Instantly share code, notes, and snippets.

@leggiero
Last active May 30, 2020 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leggiero/80baf7dba858dcac203b147b2c4dac7c to your computer and use it in GitHub Desktop.
Save leggiero/80baf7dba858dcac203b147b2c4dac7c to your computer and use it in GitHub Desktop.
Install or upgrade compose; ideal to run via cron, e.g. /etc/cron.weekly/composer-upgrade
#!/bin/sh
set -e
if [ ! -f /usr/local/bin/composer ]; then
setup_file=$(mktemp /tmp/$(basename "$0").XXXXXX)
trap "{ rm -f $setup_file; }" EXIT
php -r "copy('https://getcomposer.org/installer', '$setup_file');"
eval "php $setup_file --quiet --install-dir=/usr/local/bin --filename=composer"
else
composer --quiet self-update
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment