php + composer pack and fixes

This commit is contained in:
Anthony Axenov 2022-07-12 23:20:11 +08:00
parent bdcd8e6bec
commit d3263e6da5
Signed by: anthony
GPG Key ID: EA9EC32FF7CCD4EC
3 changed files with 21 additions and 15 deletions

View File

@ -1,4 +1,7 @@
# Autogenerated at 05.07.2022 10:52 using ./gen-makefile # Autogenerated at 12.07.2022 23:14 using ./gen-makefile
##composer: [PACK] php + composer
composer: php composer-clean
##flameshot: [TODO] [PACK] qt5 + flameshot from source ##flameshot: [TODO] [PACK] qt5 + flameshot from source
flameshot: qt5 flameshot-build flameshot: qt5 flameshot-build
@ -21,9 +24,9 @@ apt:
chrome: chrome:
./install/chrome ./install/chrome
##composer: Install composer (latest) ##composer-clean: Install composer (latest)
composer: composer-clean:
./install/composer ./install/composer-clean
##docker: Install docker (latest) + docker-compose (latest) + ppa ##docker: Install docker (latest) + docker-compose (latest) + ppa
docker: docker:

View File

@ -1,12 +1,13 @@
#!/bin/bash #!/bin/bash
##makedesc: Install composer (latest) ##makedesc: Install composer (latest)
echo echo
echo "===============================================" echo "==============================================="
echo "Installing composer (latest)..." echo "Installing composer (latest)..."
echo "===============================================" echo "==============================================="
echo echo
# https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
installed() { installed() {
command -v "$1" >/dev/null 2>&1 command -v "$1" >/dev/null 2>&1
} }
@ -16,18 +17,19 @@ installed() {
if installed "composer"; then if installed "composer"; then
echo "WARNING: Removing current composer to install its actual version" echo "WARNING: Removing current composer to install its actual version"
sudo apt remove -y --autoremove composer sudo apt remove -y --autoremove composer
sudo rm -f /bin/composer sudo rm /bin/composer
sudo rm -f /usr/bin/composer sudo rm /usr/bin/composer
sudo rm -f /usr/local/bin/composer sudo rm /usr/local/bin/composer
sudo rm -rf /usr/src/composer sudo rm /usr/src/composer
rm $HOME/.local/bin/composer
fi fi
sudo mkdir -m 0777 -p /usr/src/composer mkdir -p $HOME/install && cd $HOME/install
cd /usr/src/composer # mkdir -p $HOME/.local/bin
# https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')" EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" # php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
wget https://getcomposer.org/installer -O composer-setup.php
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then
>&2 echo 'ERROR: Invalid installer checksum' >&2 echo 'ERROR: Invalid installer checksum'
@ -35,7 +37,6 @@ if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then
exit 1 exit 1
fi fi
php composer-setup.php --quiet php composer-setup.php --quiet
sudo cp /usr/src/composer/composer.phar /usr/local/bin/composer cp $HOME/install/composer.phar $HOME/.local/bin/composer
cd - >/dev/null cd - >/dev/null
sudo rm -rf /usr/src/composer/
installed "composer" && composer --version installed "composer" && composer --version

2
packs/composer Normal file
View File

@ -0,0 +1,2 @@
##composer: [PACK] php + composer
composer: php composer-clean