shell/install/composer

39 lines
996 B
Plaintext
Raw Normal View History

#!/bin/bash
##makedesc: Install composer (latest)
2024-11-24 13:13:37 +00:00
here=$( dirname $(readlink -e -- "${BASH_SOURCE}"))
source "$here/../helpers.sh" || exit 255
2022-01-09 08:56:25 +00:00
2022-07-12 15:20:11 +00:00
# https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
2024-07-31 15:23:55 +00:00
title
2024-07-31 15:23:55 +00:00
require php
2022-07-04 15:24:27 +00:00
2024-11-24 13:13:37 +00:00
if installed composer; then
warn "WARNING: Removing current composer to install latest one"
composer --version
__AAA_NO_TITLE=1 source $here/../uninstall/composer
fi
2024-11-24 13:13:37 +00:00
mkdir -p "$HOME/install/other" "$HOME/.local/bin"
2024-07-31 15:23:55 +00:00
2024-11-24 13:13:37 +00:00
download "https://getcomposer.org/installer" \
"$HOME/install/other/composer-setup.php"
2024-07-31 15:23:55 +00:00
2024-11-24 13:13:37 +00:00
php "$HOME/install/other/composer-setup.php" \
--install-dir="$HOME/.local/bin/" \
--filename="composer"
COMPOSER_GLOBAL_HOME="$($HOME/.local/bin/composer config -g home)"
NEWPATH="export PATH=\"$COMPOSER_GLOBAL_HOME/vendor/bin:\${PATH}\""
cat "$HOME/.profile" | grep -qoh "$NEWPATH" || {
$NEWPATH
echo "$NEWPATH" >> "$HOME/.profile"
2022-12-11 06:48:30 +00:00
}
2024-07-31 15:23:55 +00:00
source "$HOME/.profile"
2024-11-24 13:13:37 +00:00
success "composer installed!"
composer --version