#!/bin/bash function install_deps_raspbian { local PHP_BINARY="$(which php)" local PACKAGES="" if [ -z $PHP_BINARY ]; then debug "PHP Version: None" PACKAGES="php5-cli $PACKAGES" else debug "PHP Version: $(php --version | head -n1 | cut -d' ' -f2)" MAJOR=$(php -r 'echo substr(PHP_VERSION_ID,0,1);') if [ "$MAJOR" != "5" ]; then error "The Raspbian dependency installer only support PHP 5" exit fi fi local PHPDEV_STATE="$(dpkg --get-selections | grep php5-dev | awk '{ print $2 }')" if [ "$PHPDEV_STATE" != "install" ]; then PACKAGES="php5-dev $PACKAGES" fi local PHPPEAR_STATE="$(dpkg --get-selections | grep php-pear | awk '{ print $2 }')" if [ "$PHPPEAR_STATE" != "install" ]; then PACKAGES="php-pear $PACKAGES" fi local GPGME_STATE="$(dpkg --get-selections | grep libgpgme11-dev | awk '{ print $2 }')" if [ "$GPGME_STATE" != "install" ]; then PACKAGES="libgpgme11-dev $PACKAGES" fi if [ -z "$PACKAGES" ]; then debug "All required packages are already installed" else exec "sudo apt -qq -y install $PACKAGES" fi } install_deps_raspbian