You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
945 B
37 lines
945 B
#!/bin/sh |
|
set -e |
|
#set -x |
|
#Call me as root from app's postinst |
|
|
|
if [ -n "$1" ]; then |
|
APP=$1 |
|
|
|
if [ -z $WEB_USER ]; then |
|
. /usr/lib/composer-debian/webusergroup |
|
fi |
|
|
|
COMPJSON=/usr/lib/${APP}/composer.json |
|
VENDOR_DIR="/var/lib/composer/$APP" |
|
|
|
jq '.config."vendor-dir" = "'${VENDOR_DIR}'"' $COMPJSON | sponge $COMPJSON |
|
|
|
# TODO: cat /usr/lib/system.spoje.net/composer.json | grep url | awk -F '"' '{print $4}' |
|
# ... |
|
#"repositories": [ |
|
# { |
|
# "url": "/home/vagrant/code/your-library", |
|
# "type": "path", |
|
# "options": { |
|
# "symlink": true |
|
# } |
|
# } |
|
#], |
|
|
|
echo '{}' > /usr/lib/${APP}/composer.lock |
|
chown ${WEB_USER}:${WEB_GROUP} "/usr/lib/${APP}" /var/lib/composer -R |
|
WEB_USER=$(echo $WEB_USER | awk -F: '{print $1}') |
|
su - ${WEB_USER} -s /bin/bash -c "composer-autoload ${COMPJSON}" |
|
chown root "/usr/lib/${APP}" -R |
|
else |
|
echo "please call me with app name (it's directory in /usr/lib) " |
|
fi
|
|
|