Is there a command line argument that allows you to install PHP Pear without user prompt? I'd like to automate the following execution:
wget http://pear.php.net/go-pear.phar
php go-pear.phar
pear config-set preferred_state beta
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
pear install --alldeps phpunit/PHPUnit
rm go-pear.phar
php go-pear.phar prompts the user for install/configuration information.
Turns out expect did the trick. Here is what I ended up with:
install-pear.sh
#!/usr/bin/expect
spawn wget -O /tmp/go-pear.phar http://pear.php.net/go-pear.phar
expect eof
spawn php /tmp/go-pear.phar
expect "1-11, 'all' or Enter to continue:"
send "\r"
expect eof
spawn rm /tmp/go-pear.phar
install-phpunit.sh
#!/bin/bash
./install-pear.sh
pear config-set preferred_state beta
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
pear install --alldeps phpunit/PHPUnit
To run:
sudo apt-get install expect
chmod 744 ./install-pear.sh
chmod 744 ./install-phpunit.sh
sudo ./install-phpunit.sh
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With