Skip to content

Commit

Permalink
Merge pull request #539 from OPUS4/install
Browse files Browse the repository at this point in the history
Fix Composer usage in install script
  • Loading branch information
j3nsch authored Mar 24, 2022
2 parents 0ae74a7 + d1176e6 commit b073009
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
21 changes: 19 additions & 2 deletions bin/install-composer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ set -e
SCRIPT_NAME_FULL="`readlink -f "$0"`"
SCRIPT_PATH="`dirname "$SCRIPT_NAME_FULL"`"


BASEDIR="`dirname "$SCRIPT_PATH"`"

# Don't run Composer as root - Composer itself warns against that
Expand All @@ -28,8 +27,19 @@ if [[ $EUID -eq 0 ]]; then
exit 1
fi

if [ -e composer ] ;
# get BASEDIR from first argument if present
if [ $# -ge 1 ] ;
then
INSTALL_PACKAGES=1
fi

if [ -e bin/composer ] ;
then
if [[ "$INSTALL_PACKAGES" == 1 ]] ;
then
cd $BASEDIR
php bin/composer install
fi
exit 1
fi

Expand All @@ -47,4 +57,11 @@ fi
php composer-setup.php --quiet --install-dir="$BASEDIR/bin" --filename=composer
RESULT=$?
rm composer-setup.php

if [[ "$INSTALL_PACKAGES" == 1 ]] ;
then
cd $BASEDIR
php bin/composer install
fi

exit $RESULT
4 changes: 2 additions & 2 deletions bin/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ echo

if [[ $SUDO_ENABLED -eq 0 ]] ;
then
"$SCRIPT_PATH/install-composer.sh" "$BASEDIR"
"$SCRIPT_PATH/install-composer.sh" install
else
sudo -u "$SUDO_USER" "$SCRIPT_PATH/install-composer.sh" "$BASEDIR"
sudo -u "$SUDO_USER" "$SCRIPT_PATH/install-composer.sh" install
fi

#
Expand Down

0 comments on commit b073009

Please sign in to comment.