]> gitweb.fluxo.info Git - trashman.git/commitdiff
Adds composer package
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 12 Nov 2017 12:53:20 +0000 (10:53 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 12 Nov 2017 12:53:20 +0000 (10:53 -0200)
TODO.md
share/trashman/composer/info [new file with mode: 0644]
share/trashman/composer/unix/check [new file with mode: 0755]
share/trashman/composer/unix/install [new file with mode: 0755]
share/trashman/composer/unix/remove [new file with mode: 0755]
share/trashman/composer/unix/test [new file with mode: 0755]

diff --git a/TODO.md b/TODO.md
index 32424c9c1a9184aca15800008625fc7d3bce4ec2..6603ea6eb446b93c623908331a2fe12d20fb3004 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -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 (file)
index 0000000..18bfc18
--- /dev/null
@@ -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 (executable)
index 0000000..47b0ed5
--- /dev/null
@@ -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 (executable)
index 0000000..81d8b90
--- /dev/null
@@ -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 (executable)
index 0000000..5078bec
--- /dev/null
@@ -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 (executable)
index 0000000..f84ae60
--- /dev/null
@@ -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