diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2017-11-12 10:53:20 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2017-11-12 10:53:20 -0200 |
commit | 988d93b125129c6f84ba1d1f9490e93437ecdfb1 (patch) | |
tree | 9954d4a9b71d6aa0d062100ad46bc3b343a23a93 | |
parent | 21df1a59e62726b6574de4bcddf7fe89f6254218 (diff) | |
download | trashman-988d93b125129c6f84ba1d1f9490e93437ecdfb1.tar.gz trashman-988d93b125129c6f84ba1d1f9490e93437ecdfb1.tar.bz2 |
Adds composer package
-rw-r--r-- | TODO.md | 1 | ||||
-rw-r--r-- | share/trashman/composer/info | 1 | ||||
-rwxr-xr-x | share/trashman/composer/unix/check | 14 | ||||
-rwxr-xr-x | share/trashman/composer/unix/install | 28 | ||||
-rwxr-xr-x | share/trashman/composer/unix/remove | 7 | ||||
-rwxr-xr-x | share/trashman/composer/unix/test | 28 |
6 files changed, 78 insertions, 1 deletions
@@ -5,6 +5,5 @@ TODO * Support more OSes at `__trashman_distro()`. * Argument passing to distro/action scripts as `--param=value`. * Packages: - * docker, nodejs, composer * https://github.com/Crizstian/cinema-microservice * http://mongotron.io/ diff --git a/share/trashman/composer/info b/share/trashman/composer/info new file mode 100644 index 0000000..18bfc18 --- /dev/null +++ b/share/trashman/composer/info @@ -0,0 +1 @@ +dependency manager for PHP diff --git a/share/trashman/composer/unix/check b/share/trashman/composer/unix/check new file mode 100755 index 0000000..47b0ed5 --- /dev/null +++ b/share/trashman/composer/unix/check @@ -0,0 +1,14 @@ +#!/usr/bin/env sh +# +# Check if composer is installed system-wide. +# + +if [ -x "/usr/local/bin/composer" ]; then + exit 0 +fi + +if [ ! -x "/usr/local/bin/composer" ]; then + exit 1 +fi + +exit 2 diff --git a/share/trashman/composer/unix/install b/share/trashman/composer/unix/install new file mode 100755 index 0000000..81d8b90 --- /dev/null +++ b/share/trashman/composer/unix/install @@ -0,0 +1,28 @@ +#!/usr/bin/env sh +# +# Install composer system-wide. +# +# See https://getcomposer.org/download/ +# https://composer.github.io/pubkeys.html +# + +# Parameters +SHARE="$1" + +# Include basic functions +. $SHARE/trashman/functions || exit 1 + +# Requirements +__trashman_require php wget + +# Download +#php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" +wget https://getcomposer.org/installer -O composer-setup.php || exit 1 + +php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" + +if [ -e "composer-setup.php" ]; then + php composer-setup.php --install-dir=/usr/local/bin --filename=composer + #php -r "unlink('composer-setup.php');" + rm composer-setup.php +fi diff --git a/share/trashman/composer/unix/remove b/share/trashman/composer/unix/remove new file mode 100755 index 0000000..5078bec --- /dev/null +++ b/share/trashman/composer/unix/remove @@ -0,0 +1,7 @@ +#!/usr/bin/env sh +# +# Remove composer system-wide. +# + +# Remove docker +rm -rf /usr/local/bin/composer diff --git a/share/trashman/composer/unix/test b/share/trashman/composer/unix/test new file mode 100755 index 0000000..f84ae60 --- /dev/null +++ b/share/trashman/composer/unix/test @@ -0,0 +1,28 @@ +#!/usr/bin/env sh +# +# Test if composer is running correctly. +# + +# Parameters +SHARE="$1" + +# Include basic functions +. $SHARE/trashman/functions || exit 1 + +# Basic test +if ! which composer > /dev/null 2>&1; then + exit 1 +fi + +# Run hello-world test program +__trashman_echo_keepline "Testing program output... " +composer -V +status="$?" + +# Test exit status +if [ "$status" != "0" ]; then + exit 1 +fi + +# Success +exit 0 |