Skip to content

Commit

Permalink
shellcheck fixes, and add PHP 8.2 to more places
Browse files Browse the repository at this point in the history
  • Loading branch information
tomjn committed Feb 22, 2023
1 parent 7e83103 commit 743625b
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 33 deletions.
2 changes: 1 addition & 1 deletion memcached-admin/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
echo " * Checking for memcached-admin"
if [[ ! -d "/srv/www/default/memcached-admin" ]]; then
echo -e " * Downloading phpMemcachedAdmin, see https://github.com/elijaa/phpmemcachedadmin"
cd /srv/www/default
cd /srv/www/default || return 1
wget -q -O phpmemcachedadmin.tar.gz "https://github.com/wp-cloud/phpmemcacheadmin/archive/1.2.4-vvv.tar.gz"
tar -xf phpmemcachedadmin.tar.gz
mv phpmemcacheadmin* memcached-admin
Expand Down
2 changes: 1 addition & 1 deletion mongodb/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export DEBIAN_FRONTEND=noninteractive
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

install_mongodb_php() {
for version in "7.0" "7.1" "7.2" "7.3" "7.4" "8.0" "8.1"
for version in "7.0" "7.1" "7.2" "7.3" "7.4" "8.0" "8.1" "8.2"
do
if [[ $(command -v php$version) ]]; then
echo " * Checking MongoDB for PHP ${version}"
Expand Down
2 changes: 1 addition & 1 deletion opcache-gui/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

noroot mkdir -p /srv/www/default/opcache-gui
echo -e " * Provisioning Opcache GUI"
cd /srv/www/default/opcache-gui
cd /srv/www/default/opcache-gui || return 1
noroot composer require amnuts/opcache-gui

echo " * symlinking index.php"
Expand Down
4 changes: 2 additions & 2 deletions opcache-status/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ echo -e " ! Opcache Status is abandoned, please switch to the new VVV utility op

if [[ ! -d "/srv/www/default/opcache-status" ]]; then
echo -e " * Downloading Opcache Status, see https://github.com/rlerdorf/opcache-status/"
cd /srv/www/default
cd /srv/www/default || return 1
noroot git clone "https://github.com/rlerdorf/opcache-status.git" opcache-status
else
echo -e " * Updating Opcache Status"
cd /srv/www/default/opcache-status
cd /srv/www/default/opcache-status || return 1
noroot git pull --rebase origin master
fi
23 changes: 9 additions & 14 deletions tideways/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
DEFAULTPHP=$(php -r "echo substr(phpversion(),0,3);")

configs=(
/srv/vvv/config.yml
/vagrant/config.yml
/vagrant/vvv-config.yml
)
VVV_CONFIG=/srv/vvv/config.yml
for item in ${configs[*]}; do
for item in "/srv/vvv/config.yml" "/vagrant/config.yml" "/vagrant/vvv-config.yml"; do
if [[ -f $item ]]; then
VVV_CONFIG=$item
break
Expand Down Expand Up @@ -42,7 +37,7 @@ function install_tideways_for_php_version() {
if [[ ! -f "${php_modules_path}/tideways_xhprof.so" ]] || [[ $(stat -c %Y "${php_modules_path}/tideways_xhprof.so") -lt $(stat -c %Y "/var/local/tideways-php/.git/info/") ]]; then
echo " * Compiling Tideways for PHP ${version}"
cp -rf /var/local/tideways-php "/var/local/tideways-php${version}"
cd "/var/local/tideways-php${version}"
cd "/var/local/tideways-php${version}" || return 1

# switch to PHP version we're building for
update-alternatives --set php "/usr/bin/php${version}"
Expand All @@ -56,7 +51,7 @@ function install_tideways_for_php_version() {
make install

# perform cleanup
cd "${DIR}"
cd "${DIR}" || return 1
rm -rf "/var/local/tideways-php${version}"
fi
phpenmod -v "$version" tideways_xhprof
Expand All @@ -66,7 +61,7 @@ function install_tideways_for_php_version() {
function check_tideways_php() {
cp -f "${DIR}/tideways-header.php" "/srv/tideways-header.php"
# Tideways is only for php =>7.0
for version in "7.0" "7.1" "7.2" "7.3" "7.4" "8.0" "8.1"
for version in "7.0" "7.1" "7.2" "7.3" "7.4" "8.0" "8.1" "8.2"
do
if [[ $(command -v php-fpm$version) ]]; then
install_tideways_for_php_version "${version}"
Expand All @@ -76,7 +71,7 @@ function check_tideways_php() {

function restart_php() {
echo " * Restarting PHP-FPM server"
for version in "7.0" "7.1" "7.2" "7.3" "7.4" "8.0" "8.1"
for version in "7.0" "7.1" "7.2" "7.3" "7.4" "8.0" "8.1" "8.2"
do
if [[ $(command -v php-fpm$version) ]]; then
service "php${version}-fpm" restart
Expand All @@ -88,7 +83,7 @@ function restart_php() {

function install_php_sqlite() {
declare -a packages=()
for version in "7.0" "7.1" "7.2" "7.3" "7.4" "8.0" "8.1"; do
for version in "7.0" "7.1" "7.2" "7.3" "7.4" "8.0" "8.1" "8.2"; do
if [[ $(command -v php$version) ]]; then
packages+=("php${version}-sqlite3")
fi
Expand All @@ -103,7 +98,7 @@ function install_xhgui_frontend() {
noroot git clone "https://github.com/perftools/xhgui.git" /srv/www/default/xhgui
fi

cd /srv/www/default/xhgui
cd /srv/www/default/xhgui || return 1
noroot git fetch origin
noroot git checkout "0.20.4"
# Xhgui install.php will execute composer without noroot and this generate git issues
Expand All @@ -117,13 +112,13 @@ function install_xhgui_frontend() {
if [[ ! -d "/srv/www/default/php-profiler" ]]; then
echo -e " * Installing php-profiler for XHGui"
noroot mkdir -p /srv/www/default/php-profiler
cd /srv/www/default/php-profiler
cd /srv/www/default/php-profiler || return 1
noroot composer require --no-update perftools/php-profiler
noroot composer require --no-update perftools/xhgui-collector
noroot composer install
else
echo " * Updating php-profile for XHGui"
cd /srv/www/default/php-profiler
cd /srv/www/default/php-profiler || return 1
noroot composer update
fi
noroot cp -f "${DIR}/config.php-profiler.php" "/srv/www/default/php-profiler/config.php"
Expand Down
24 changes: 11 additions & 13 deletions tls-ca/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
IFS=$(echo -en "\n\b")

configs=(
/srv/vvv/config.yml
/vagrant/config.yml
/vagrant/vvv-config.yml
)
VVV_CONFIG=/srv/vvv/config.yml
for item in ${configs[*]}; do
if [[ -f $item ]]; then
VVV_CONFIG=$item
break
fi
for item in "/srv/vvv/config.yml" "/vagrant/config.yml" "/vagrant/vvv-config.yml"; do
if [[ -f $item ]]; then
VVV_CONFIG=$item
break
fi
done

codename=$(lsb_release --codename | cut -f2)
Expand All @@ -34,17 +29,20 @@ if [[ ! -e ~/.rnd ]]; then
fi

get_sites() {
local value=$(shyaml keys sites 2> /dev/null < "${VVV_CONFIG}" )
local value=""
value=$(shyaml keys sites 2> /dev/null < "${VVV_CONFIG}" )
echo "${value:-$@}"
}

get_host() {
local value=$(shyaml get-value "sites.${1}.hosts.0" 2> /dev/null < "${VVV_CONFIG}" )
local value=""
value=$(shyaml get-value "sites.${1}.hosts.0" 2> /dev/null < "${VVV_CONFIG}" )
echo "${value:-$@}"
}

get_hosts() {
local value=$(shyaml get-values "sites.${1}.hosts" 2> /dev/null < "${VVV_CONFIG}" )
local value=""
value=$(shyaml get-values "sites.${1}.hosts" 2> /dev/null < "${VVV_CONFIG}" )
echo "${value:-$@}"
}

Expand Down
2 changes: 1 addition & 1 deletion webgrind/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fi

# phpMyAdmin
echo " * Installing/Updating webgrind, see https://github.com/jokkedk/webgrind ..."
cd "${DIR}"
cd "${DIR}" || return 1
noroot composer update --no-autoloader

echo " * Finished webgrind provisioner"

0 comments on commit 743625b

Please sign in to comment.