From 8331c5c3bc01f3e1337b443df5b7d09c4881b3ec Mon Sep 17 00:00:00 2001 From: gau1991 Date: Wed, 4 Jun 2014 12:41:20 +0530 Subject: [PATCH] Install Script for postfix pma adminer wp-cli --- src/lib/ee_lib_variables.sh | 2 ++ .../system/install/ee_mod_install_postfix.sh | 12 +++++++++ src/vendor/ee_ven_install_adminer.sh | 16 ++++++++++++ src/vendor/ee_ven_install_pma.sh | 25 +++++++++++++++++++ src/vendor/ee_ven_install_wp_cli.sh | 21 ++++++++++++++++ 5 files changed, 76 insertions(+) create mode 100644 src/modules/system/install/ee_mod_install_postfix.sh create mode 100644 src/vendor/ee_ven_install_adminer.sh create mode 100644 src/vendor/ee_ven_install_pma.sh create mode 100644 src/vendor/ee_ven_install_wp_cli.sh diff --git a/src/lib/ee_lib_variables.sh b/src/lib/ee_lib_variables.sh index f00b47ed..d889bb81 100644 --- a/src/lib/ee_lib_variables.sh +++ b/src/lib/ee_lib_variables.sh @@ -8,6 +8,8 @@ readonly EE_CONFIG_GET=$(echo "git config --file /etc/easyengine/ee.conf") readonly EE_CONFIG_SET=$(echo "git config --file /etc/easyengine/ee.conf" --replace-all) readonly EE_IP_ADDRESS=$($EE_CONFIG_GET system.ip-address | cut -d'=' -f2 | sed 's/ //g' | tr ',' '\n') readonly EE_APT_GET=$($EE_CONFIG_GET system.apt-get-assume-yes | grep -i true &> /dev/null && echo apt-get -y || echo apt-get) +readonly EE_WPCLI_VERSION='0.15.1' +readonly EE_ADMINER_VERSION='4.1.0' # Distribution specific variable if [ "$EE_LINUX_DISTRO" == "Ubuntu" ]; then diff --git a/src/modules/system/install/ee_mod_install_postfix.sh b/src/modules/system/install/ee_mod_install_postfix.sh new file mode 100644 index 00000000..9b3ad93e --- /dev/null +++ b/src/modules/system/install/ee_mod_install_postfix.sh @@ -0,0 +1,12 @@ +# Install Postfix + +function ee_mod_install_postfix() +{ + # Setup Postfix + debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'" + debconf-set-selections <<< "postfix postfix/mailname string $(hostname -f)" + + # Install Postfix + ee_lib_echo "Installing Postfix, Please Wait..." + $EE_APT_GET install postfix || ee_lib_error "Unable to install postfix, exit status = " $? +} diff --git a/src/vendor/ee_ven_install_adminer.sh b/src/vendor/ee_ven_install_adminer.sh new file mode 100644 index 00000000..a96ad8d9 --- /dev/null +++ b/src/vendor/ee_ven_install_adminer.sh @@ -0,0 +1,16 @@ +# Install Adminer + +function ee_ven_install_adminer() +{ + if [ ! -d /var/www/22222/htdocs/db/adminer ]; then + + # Setup Adminer + mkdir -p /var/www/22222/htdocs/db/adminer/ \ + || ee_lib_error "Unable to create Adminer directory: /var/www/22222/htdocs/db/adminer/, exit status = " $? + + # Download Adminer + ee_lib_echo "Downloading Adminer, please wait..." + wget --no-check-certificate -cqO /var/www/22222/htdocs/db/adminer/index.php http://downloads.sourceforge.net/adminer/adminer-${EE_ADMINER_VERSION}.php \ + || ee_lib_error "Unable to download Adminer, exit status = " $? + fi +} diff --git a/src/vendor/ee_ven_install_pma.sh b/src/vendor/ee_ven_install_pma.sh new file mode 100644 index 00000000..d261d68f --- /dev/null +++ b/src/vendor/ee_ven_install_pma.sh @@ -0,0 +1,25 @@ +# Install phpMyAdmin + +function ee_ven_install_pma() +{ + if [ ! -d /var/www/22222/htdocs/db/pma ] + then + + # Setup phpMyAdmin + mkdir -p /var/www/22222/htdocs/db/pma/ \ + || ee_lib_error "Unable to create phpMyAdmin directory: /var/www/22222/htdocs/db/pma/, exit status = " $? + + # Download phpMyAdmin + ee_lib_echo "Downloading phpMyAdmin, please wait..." + wget --no-check-certificate -cqO /var/www/22222/htdocs/db/pma/pma.tar.gz https://github.com/phpmyadmin/phpmyadmin/archive/STABLE.tar.gz \ + || ee_lib_error "Unable to download phpMyAdmin, exit status = " $? + + # Extract phpMyAdmin + tar --strip-components=1 -zxf /var/www/22222/htdocs/db/pma/pma.tar.gz -C /var/www/22222/htdocs/db/pma/ \ + || ee_lib_error "Unable to extract phpMyAdmin, exit status = " $? + + # Remove unwanted files + rm -f /var/www/22222/htdocs/db/pma/pma.tar.gz + + fi +} diff --git a/src/vendor/ee_ven_install_wp_cli.sh b/src/vendor/ee_ven_install_wp_cli.sh new file mode 100644 index 00000000..1700fbb9 --- /dev/null +++ b/src/vendor/ee_ven_install_wp_cli.sh @@ -0,0 +1,21 @@ +# Install wp-cli + +function ee_ven_install_wp_cli() +{ + if [ ! -d /usr/share/wp-cli ] + then + ee_lib_echo "Installing WP-CLI, please wait..." + curl -sL https://raw.github.com/wp-cli/wp-cli.github.com/master/installer.sh | INSTALL_DIR='/usr/share/wp-cli' VERSION=$EE_WPCLI_VERSION bash &>> $EE_COMMAND_LOG \ + || ee_lib_error "Unable to install WP-CLI, exit status = " $? + + # Add WP-CLI command in $PATH variable + if [ ! -L /usr/bin/wp ]; then + ln -s /usr/share/wp-cli/bin/wp /usr/bin/wp \ + || ee_lib_error "Unable to create symbolic link for WP-CLI command, exit status = " $? + fi + + # Auto completion for WP-CLI + cp /usr/share/wp-cli/vendor/wp-cli/wp-cli/utils/wp-completion.bash /etc/bash_completion.d/ + source /etc/bash_completion.d/wp-completion.bash + fi +}