This commit is contained in:
Shivam Mathur 2020-07-02 21:17:46 +05:30
parent d01ec214f2
commit 10608f5908
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A

View File

@ -18,6 +18,7 @@ add_log() {
# Function to read env inputs. # Function to read env inputs.
read_env() { read_env() {
. /etc/lsb-release
[[ -z "${update}" ]] && update='false' && UPDATE='false' || update="${update}" [[ -z "${update}" ]] && update='false' && UPDATE='false' || update="${update}"
[ "$update" = false ] && [[ -n ${UPDATE} ]] && update="${UPDATE}" [ "$update" = false ] && [[ -n ${UPDATE} ]] && update="${UPDATE}"
[[ -z "${runner}" ]] && runner='github' && RUNNER='github' || runner="${runner}" [[ -z "${runner}" ]] && runner='github' && RUNNER='github' || runner="${runner}"
@ -32,19 +33,24 @@ update_lists() {
fi fi
} }
# Function to add ppa:ondrej/php.
add_ppa() {
if ! apt-cache policy | grep -q ondrej/php; then
LC_ALL=C.UTF-8 sudo apt-add-repository ppa:ondrej/php -y
if [ "$DISTRIB_RELEASE" = "16.04" ]; then
sudo "$debconf_fix" apt-get update
fi
fi
}
# Function to setup environment for self-hosted runners. # Function to setup environment for self-hosted runners.
self_hosted_setup() { self_hosted_setup() {
echo "Set disable_coredump false" | sudo tee -a /etc/sudo.conf echo "Set disable_coredump false" | sudo tee -a /etc/sudo.conf
if ! command -v apt-fast >/dev/null; then if ! command -v apt-fast >/dev/null; then
sudo ln -sf /usr/bin/apt-get /usr/bin/apt-fast sudo ln -sf /usr/bin/apt-get /usr/bin/apt-fast
fi fi
update_lists && $apt_install curl make lsb-release software-properties-common unzip update_lists && $apt_install curl make software-properties-common unzip
if ! apt-cache policy | grep -q ondrej/php; then add_ppa
LC_ALL=C.UTF-8 sudo apt-add-repository ppa:ondrej/php -y
if [ "$(lsb_release -r -s)" = "16.04" ]; then
sudo "$debconf_fix" apt-get update
fi
fi
} }
# Function to configure PECL. # Function to configure PECL.
@ -393,6 +399,8 @@ if [ "$runner" = "self-hosted" ]; then
else else
self_hosted_setup >/dev/null 2>&1 self_hosted_setup >/dev/null 2>&1
fi fi
elif [ "$DISTRIB_RELEASE" = "20.04" ]; then
add_ppa >/dev/null 2>&1
fi fi
# Setup PHP # Setup PHP