From 81d96b075dc032e0b38ff34d9ceb794bf5172fc8 Mon Sep 17 00:00:00 2001 From: erxspin Date: Sat, 25 Feb 2017 13:43:01 +0600 Subject: [PATCH 01/17] added CentOS, Fedora, RHEL choices with minimal version check (recommited) --- install.sh | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/install.sh b/install.sh index 4e0fdc4..88c8c38 100755 --- a/install.sh +++ b/install.sh @@ -45,6 +45,8 @@ chmod +x $0 #Os/Distro Check os_check=$(lsb_release -is) +[ -z $os_check ] && os_lsb_release_installer +lsb_release -is && os_check=$(lsb_release -is) real_os=$os_check check_major_release=$(lsb_release -rs | cut -d. -f1) check_codename=$(lsb_release -cs) @@ -56,6 +58,23 @@ os_unsupported () { exit 2; } +os_lsb_release_installer () { + if [ -s /etc/centos-release ] || [ -s /etc/fedora-release] || [ -s /etc/redhat-release ] ; then + yum -y install redhat-lsb-core + os_check='CentOS' + elif [ -s /etc/os-release ] && [ .`awk -F'=' '/^ID_LIKE=/ {print $2}' /etc/os-release` = .'debian' ] ; then + apt-get -y install lsb-base lsb-release + os_check='Debian' + fi + + #try to find and use package manager + which yum && { yum -y install redhat-lsb-core ; } + which apt-get && { apt-get -y install lsb-base lsb-release ; } + + #print location and file type + which lsb_release && file $(which lsb_release) +} + os_debian_common () { verbose "Removing the CD image from /etc/apt/sources.list" sed -i '/cdrom:/d' /etc/apt/sources.list @@ -64,6 +83,14 @@ os_debian_common () { verbose "Installing Git" apt-get install -y git } + +os_centos_common () { + verbose "Updating system before starting." + yum -y update + verbose "Installing Git" + yum install -y git +} + os_fetch_installer () { if [ ! -d /usr/src ]; then mkdir -vp /usr/src @@ -86,6 +113,14 @@ if [ .$os_check = .'Ubuntu' ]; then echo "${yellow}Detected Ubuntu, using Debian for compatibility${normal}" os_check="Debian" fi +if [ .$os_check = .'Fedora' ]; then + echo "${yellow}Detected Fedora, using CentOS for compatibility${normal}" + os_check="CentOS" +fi +if [ .$os_check = .'RedHatEnterpriseServer' ]; then + echo "${yellow}Detected RedHatEnterpriseServer, using CentOS for compatibility${normal}" + os_check="CentOS" +fi if [ .$os_check = .'Debian' ]; then if [ .$real_os = .'Debian' ]; then echo "${yellow}Detected Debian${normal}" @@ -112,6 +147,42 @@ if [ .$os_check = .'Debian' ]; then cd /usr/src/fusionpbx-install.sh/debian ./install.sh $@ fi +elif [ .$os_check = .'CentOS' ]; then + if [ .$real_os = .'CentOS' ]; then + echo "${yellow}Detected CentOS{normal}" + if [ $check_major_release -ge 7 ]; then + os_centos_continue='true' + else + os_centos_continue='false' + error "Although you are running $real_os we require version >= 7" + os_unsupported + fi + fi + if [ .$real_os = .'Fedora' ]; then + echo "${yellow}Detected Fedora{normal}" + if [ $check_major_release -ge 19 ]; then + os_centos_continue='true' + else + os_centos_continue='false' + error "Although you are running $real_os we require version >= 19" + os_unsupported + fi + fi + if [ .$real_os = .'RedHatEnterpriseServer' ]; then + if [ $check_major_release -ge 7 ]; then + os_centos_continue='true' + else + os_centos_continue='false' + error "Although you are running $real_os we require version >= 7" + os_unsupported + fi + fi + if [ .$os_centos_continue = .'true' ]; then + os_centos_common + os_fetch_installer + cd /usr/src/fusionpbx-install.sh/centos + ./install.sh $@ + fi else os_unsupported fi From ed25de982bf748bbfee46266e529c36e49bf4503 Mon Sep 17 00:00:00 2001 From: erxspin Date: Sat, 25 Feb 2017 13:55:32 +0600 Subject: [PATCH 02/17] fixed small typos --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 88c8c38..aa071bb 100755 --- a/install.sh +++ b/install.sh @@ -149,7 +149,7 @@ if [ .$os_check = .'Debian' ]; then fi elif [ .$os_check = .'CentOS' ]; then if [ .$real_os = .'CentOS' ]; then - echo "${yellow}Detected CentOS{normal}" + echo "${yellow}Detected CentOS${normal}" if [ $check_major_release -ge 7 ]; then os_centos_continue='true' else @@ -159,7 +159,7 @@ elif [ .$os_check = .'CentOS' ]; then fi fi if [ .$real_os = .'Fedora' ]; then - echo "${yellow}Detected Fedora{normal}" + echo "${yellow}Detected Fedora${normal}" if [ $check_major_release -ge 19 ]; then os_centos_continue='true' else From 6f0eb94cc0b274e05f6f8a57736f46e75e84bb9e Mon Sep 17 00:00:00 2001 From: erxspin Date: Sat, 25 Feb 2017 21:24:21 +0600 Subject: [PATCH 03/17] added special option --use-php5-package --- debian/resources/arguments.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/debian/resources/arguments.sh b/debian/resources/arguments.sh index fbcac06..5740eb6 100755 --- a/debian/resources/arguments.sh +++ b/debian/resources/arguments.sh @@ -3,7 +3,7 @@ #Process command line options only if we haven't been processed once if [ -z "$CPU_CHECK" ]; then export script_name=`basename "$0"` - ARGS=$(getopt -n '$script_name' -o h -l help,use-switch-source,use-switch-package-all,use-switch-master,use-switch-package-unofficial-arm,use-system-master,no-cpu-check -- "$@") + ARGS=$(getopt -n '$script_name' -o h -l help,use-switch-source,use-switch-package-all,use-switch-master,use-switch-package-unofficial-arm,use-php5-package,use-system-master,no-cpu-check -- "$@") if [ $? -ne 0 ]; then error "Failed parsing options." @@ -35,7 +35,8 @@ if [ -z "$CPU_CHECK" ]; then warning "Debian installer script" warning " --use-switch-source will use freeswitch from source rather than ${green}(default:packages)" warning " --use-switch-package-all if using packages use the meta-all package" - warning " --use-switch-package-unofficial-arm if your system is arm and you are using packages, use the unofficial arm repo" + warning " --use-switch-package-unofficial-arm if your system is arm and you are using packages, use the unofficial arm repo and force php5* packages" + warning " --use-php5-package use php5* packages instead of ${green}(default:php7.0)" warning " --use-switch-master will use master branch/packages for the switch instead of ${green}(default:stable)" warning " --use-system-master will use master branch/packages for the system instead of ${green}(default:stable)" warning " --no-cpu-check disable the cpu check ${green}(default:check)" From 8dfe6de71537008db4379b7563c9286b107b6a87 Mon Sep 17 00:00:00 2001 From: erxspin Date: Sun, 26 Feb 2017 00:01:03 +0600 Subject: [PATCH 04/17] parse options and export new environment variable USE_PHP5_PACKAGE --- debian/resources/arguments.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/debian/resources/arguments.sh b/debian/resources/arguments.sh index 5740eb6..a8a2fae 100755 --- a/debian/resources/arguments.sh +++ b/debian/resources/arguments.sh @@ -13,6 +13,7 @@ if [ -z "$CPU_CHECK" ]; then export USE_SWITCH_SOURCE=false export USE_SWITCH_PACKAGE_ALL=false export USE_SWITCH_PACKAGE_UNOFFICIAL_ARM=false + export USE_PHP5_PACKAGE=false export USE_SWITCH_MASTER=false export USE_SYSTEM_MASTER=false export CPU_CHECK=true @@ -24,6 +25,8 @@ if [ -z "$CPU_CHECK" ]; then --use-switch-package-all ) export USE_SWITCH_PACKAGE_ALL=true; shift ;; --use-switch-master ) export USE_SWITCH_MASTER=true; shift ;; --use-system-master ) export USE_SYSTEM_MASTER=true; shift ;; + --use-php5-package ) export USE_PHP5_PACKAGE=true; shift ;; + --use-switch-package-unofficial-arm ) export USE_SWITCH_PACKAGE_UNOFFICIAL_ARM=true; export USE_PHP5_PACKAGE=true; shift ;; --no-cpu-check ) export CPU_CHECK=false; shift ;; -h | --help ) HELP=true; shift ;; -- ) shift; break ;; From 5b9b55fd2c30089b1c697fd63ec8d1ed7f3c6155 Mon Sep 17 00:00:00 2001 From: erxspin Date: Sun, 26 Feb 2017 00:04:53 +0600 Subject: [PATCH 05/17] added choice between php5* or php7.0* packages (recommited) --- debian/resources/nginx.sh | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/debian/resources/nginx.sh b/debian/resources/nginx.sh index 7476acd..387edd0 100755 --- a/debian/resources/nginx.sh +++ b/debian/resources/nginx.sh @@ -12,17 +12,27 @@ verbose "Installing the web server" arch=$(uname -m) real_os=$(lsb_release -is) codename=$(lsb_release -cs) -if [ $real_os = 'Ubuntu' ]; then +if [ .$USE_SWITCH_PACKAGE_UNOFFICIAL_ARM = .true ]; then + #9.x - */stretch/ + #8.x - */jessie/ + if [ .$codename = .'jessie' ]; then + USE_PHP5_PACKAGE = true + fi +fi +if [ .$USE_PHP5_PACKAGE = .true ]; then + #don't add php7.0 repository + verbose "Switching forcefully to php5* packages" +elif [ .$real_os = .'Ubuntu' ]; then #16.10.x - */yakkety/ #16.04.x - */xenial/ #14.04.x - */trusty/ - if [ $codename = 'trusty' ]; then + if [ .$codename = .'trusty' ]; then LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php fi else #9.x - */stretch/ #8.x - */jessie/ - if [ $codename = 'jessie' ]; then + if [ .$codename = .'jessie' ]; then echo "deb http://packages.dotdeb.org $codename all" > /etc/apt/sources.list.d/dotdeb.list echo "deb-src http://packages.dotdeb.org $codename all" >> /etc/apt/sources.list.d/dotdeb.list wget -O - https://www.dotdeb.org/dotdeb.gpg | apt-key add - @@ -31,7 +41,12 @@ fi apt-get update #install dependencies -apt-get install -y nginx php7.0 php7.0-cli php7.0-fpm php7.0-pgsql php7.0-sqlite3 php7.0-odbc php7.0-curl php7.0-imap php7.0-mcrypt php7.0-xml +apt-get install -y nginx +if [ .$USE_PHP5_PACKAGE = .true ]; then + apt-get install -y php5 php5-cli php5-fpm php5-pgsql php5-sqlite php5-odbc php5-curl php5-imap php5-mcrypt +else + apt-get install -y php7.0 php7.0-cli php7.0-fpm php7.0-pgsql php7.0-sqlite3 php7.0-odbc php7.0-curl php7.0-imap php7.0-mcrypt php7.0-xml +fi #enable fusionpbx nginx config cp nginx/fusionpbx /etc/nginx/sites-available/fusionpbx From 74d33ea08dad1c62e0e7498f11a2ab82b972977f Mon Sep 17 00:00:00 2001 From: erxspin Date: Sun, 26 Feb 2017 00:11:13 +0600 Subject: [PATCH 06/17] fixed php*-fpm service name and php.ini file path (recommited) --- debian/install.sh | 6 +++++- debian/resources/php.sh | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/debian/install.sh b/debian/install.sh index 821418c..4876fd7 100755 --- a/debian/install.sh +++ b/debian/install.sh @@ -157,7 +157,11 @@ server_address=$(hostname -I) #restart services systemctl daemon-reload -systemctl restart php7.0-fpm +if [ .$USE_PHP5_PACKAGE = .true ]; then + systemctl restart php5-fpm +else + systemctl restart php7.0-fpm +fi systemctl restart nginx systemctl restart fail2ban diff --git a/debian/resources/php.sh b/debian/resources/php.sh index f70111d..d9232c5 100755 --- a/debian/resources/php.sh +++ b/debian/resources/php.sh @@ -10,12 +10,23 @@ cd "$(dirname "$0")" verbose "Configuring PHP" #update config if source is being used -sed 's#post_max_size = .*#post_max_size = 80M#g' -i /etc/php/7.0/fpm/php.ini -sed 's#upload_max_filesize = .*#upload_max_filesize = 80M#g' -i /etc/php/7.0/fpm/php.ini +if [ .$USE_PHP5_PACKAGE = .true ]; then + verbose "version 5.x" + php_ini_file='/etc/php5/fpm/php.ini' +else + verbose "version 7.0" + php_ini_file='/etc/php/7.0/fpm/php.ini' +fi +sed 's#post_max_size = .*#post_max_size = 80M#g' -i $php_ini_file +sed 's#upload_max_filesize = .*#upload_max_filesize = 80M#g' -i $php_ini_file #restart php-fpm #systemd -/bin/systemctl restart php7.0-fpm +if [ .$USE_PHP5_PACKAGE = .true ]; then + systemctl restart php5-fpm +else + systemctl restart php7.0-fpm +fi #init.d #/usr/sbin/service php7.0-fpm restart From ec872f5b68324a3da397ff88e7ec26a1af0e3d4c Mon Sep 17 00:00:00 2001 From: erxspin Date: Sun, 26 Feb 2017 00:13:27 +0600 Subject: [PATCH 07/17] prepare socket name for nginx to work with php5-fpm or php7.0-fpm (recommited) --- debian/resources/nginx.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/resources/nginx.sh b/debian/resources/nginx.sh index 387edd0..18ce2a9 100755 --- a/debian/resources/nginx.sh +++ b/debian/resources/nginx.sh @@ -50,6 +50,12 @@ fi #enable fusionpbx nginx config cp nginx/fusionpbx /etc/nginx/sites-available/fusionpbx +#prepare socket name +if [ .$USE_PHP5_PACKAGE = .true ]; then + sed -i /etc/nginx/sites-available/fusionpbx -e 's#unix:.*;#unix:/var/run/php5-fpm.sock;#g' +else + sed -i /etc/nginx/sites-available/fusionpbx -e 's#unix:.*;#unix:/var/run/php/php7.0-fpm.sock;#g' +fi ln -s /etc/nginx/sites-available/fusionpbx /etc/nginx/sites-enabled/fusionpbx #self signed certificate From cd3750886ca695005b370e82084704161d114183 Mon Sep 17 00:00:00 2001 From: erxspin Date: Sun, 26 Feb 2017 02:25:55 +0600 Subject: [PATCH 08/17] added ppa:ondrej/php5-compat repo --- debian/resources/nginx.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/resources/nginx.sh b/debian/resources/nginx.sh index 18ce2a9..60ec79f 100755 --- a/debian/resources/nginx.sh +++ b/debian/resources/nginx.sh @@ -22,6 +22,7 @@ fi if [ .$USE_PHP5_PACKAGE = .true ]; then #don't add php7.0 repository verbose "Switching forcefully to php5* packages" + LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php5-compat elif [ .$real_os = .'Ubuntu' ]; then #16.10.x - */yakkety/ #16.04.x - */xenial/ From 404c0a8f6d1144bda649dbc3faca6a8df1f568ab Mon Sep 17 00:00:00 2001 From: erxspin Date: Sun, 26 Feb 2017 03:52:57 +0600 Subject: [PATCH 09/17] added dependency ppa:ondrej/php repo and package software-properties-common --- debian/resources/nginx.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/debian/resources/nginx.sh b/debian/resources/nginx.sh index 60ec79f..a4797d4 100755 --- a/debian/resources/nginx.sh +++ b/debian/resources/nginx.sh @@ -22,12 +22,15 @@ fi if [ .$USE_PHP5_PACKAGE = .true ]; then #don't add php7.0 repository verbose "Switching forcefully to php5* packages" + which add-apt-repository || apt-get install -y software-properties-common + LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php5-compat elif [ .$real_os = .'Ubuntu' ]; then #16.10.x - */yakkety/ #16.04.x - */xenial/ #14.04.x - */trusty/ if [ .$codename = .'trusty' ]; then + which add-apt-repository || apt-get install -y software-properties-common LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php fi else From 256d1a4f917a38a77b24ba437f8695d89b28dcbb Mon Sep 17 00:00:00 2001 From: example Date: Mon, 27 Mar 2017 18:31:33 +0600 Subject: [PATCH 10/17] prepare working directory --- pre-install.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pre-install.sh b/pre-install.sh index a9ac5ed..ddd5c47 100644 --- a/pre-install.sh +++ b/pre-install.sh @@ -6,5 +6,10 @@ apt-get update && apt-get upgrade -y --force-yes #install git apt-get install -y --force-yes git +#prepare dir +if [ ! -d /usr/src ]; then + mkdir -vp /usr/src +fi + #get the install script cd /usr/src && git clone https://github.com/fusionpbx/fusionpbx-install.sh.git From bd599c7a9b28e46a0241710bc02013514b708f57 Mon Sep 17 00:00:00 2001 From: example Date: Mon, 27 Mar 2017 20:45:00 +0600 Subject: [PATCH 11/17] using more package managers --- pre-install.sh | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/pre-install.sh b/pre-install.sh index ddd5c47..b1f9a6c 100644 --- a/pre-install.sh +++ b/pre-install.sh @@ -1,10 +1,39 @@ #!/bin/sh -#upgrade the packages -apt-get update && apt-get upgrade -y --force-yes +# Exit codes +# 1 general error +# 2 unsupported OS +# 3 unsupported CPU/OS bits +# 4 unsupported package manager -#install git -apt-get install -y --force-yes git +#try to find and use package manager + +#rpm/yum for RHEL, CentOS, Fedora +which yum && { export pkgmgr='yum' ; export pkgmgr_install=$pkgmgr' -y install' ; export pkgmgr_upgrade_all=$pkgmgr' -y update' ; export pkgmgr_remove=$pkgmgr' -y --nodeps remove' ; } + +#rpm/dnf for RHEL 7, CentOS 7, Fedora 23 +which dnf && { export pkgmgr='dnf' ; export pkgmgr_install=$pkgmgr' -y install' ; export pkgmgr_upgrade_all=$pkgmgr' -y upgrade' ; export pkgmgr_remove=$pkgmgr' -y remove' ; } + +#?/pacman for Arch +which pacman && { export pkgmgr='pacman' ; export pkgmgr_install=$pkgmgr' --noconfirm -S' ; export pkgmgr_upgrade_all=$pkgmgr' --noconfirm -Syu' ; export pkgmgr_remove=$pkgmgr' --noconfirm -R' ; } + +#portage/emerge for Gentoo +which emerge && { export pkgmgr='emerge' ; export pkgmgr_install=$pkgmgr' --ask=n' ; export pkgmgr_upgrade_all=$pkgmgr' --ask=n --update --deep --with-bdeps=y @world' ; export pkgmgr_remove=$pkgmgr' --ask=n --unmerge --nodeps' ; } + +#?/zypper for SLES/openSUSE +which zypper && { export pkgmgr='zypper' ; export pkgmgr_install=$pkgmgr' --non-interactive install' ; export pkgmgr_upgrade_all=$pkgmgr' --non-interactive refresh && '$pkgmgr' --non-interactive update' ; export pkgmgr_remove=$pkgmgr' --non-interactive remove' ; } + +#dpkg/apt for Debian, Ubuntu +which apt-get && { export pkgmgr='apt-get' ; export pkgmgr_install=$pkgmgr' -y install' ; export pkgmgr_upgrade_all=$pkgmgr' update && '$pkgmgr' -y --force-yes upgrade' ; export pkgmgr_remove=$pkgmgr' -y remove' ; } + +if [ ! -z "$pkgmgr" ]; then + #upgrade the packages + $pkgmgr_upgrade_all + + #install git + $pkgmgr_install git + +fi #prepare dir if [ ! -d /usr/src ]; then @@ -12,4 +41,4 @@ if [ ! -d /usr/src ]; then fi #get the install script -cd /usr/src && git clone https://github.com/fusionpbx/fusionpbx-install.sh.git +which git && cd /usr/src && git clone https://github.com/fusionpbx/fusionpbx-install.sh.git From 21eda3298d8586d3c02a513d7acff14c6fcd94d9 Mon Sep 17 00:00:00 2001 From: example Date: Wed, 29 Mar 2017 16:54:48 +0600 Subject: [PATCH 12/17] added FreeBSD pkg command flags --- pre-install.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pre-install.sh b/pre-install.sh index b1f9a6c..adaa7bc 100644 --- a/pre-install.sh +++ b/pre-install.sh @@ -26,6 +26,9 @@ which zypper && { export pkgmgr='zypper' ; export pkgmgr_install=$pkgmgr' --non- #dpkg/apt for Debian, Ubuntu which apt-get && { export pkgmgr='apt-get' ; export pkgmgr_install=$pkgmgr' -y install' ; export pkgmgr_upgrade_all=$pkgmgr' update && '$pkgmgr' -y --force-yes upgrade' ; export pkgmgr_remove=$pkgmgr' -y remove' ; } +#?/pkg for FreeBSD +which pkg && { export pkgmgr='pkg' ; export pkgmgr_install=$pkgmgr' --yes install' ; export pkgmgr_upgrade_all=$pkgmgr' --yes upgrade' ; export pkgmgr_remove=$pkgmgr' --yes delete' ; } + if [ ! -z "$pkgmgr" ]; then #upgrade the packages $pkgmgr_upgrade_all From f823088c926c0bde3584216acd575f53543e3199 Mon Sep 17 00:00:00 2001 From: example Date: Wed, 29 Mar 2017 17:05:14 +0600 Subject: [PATCH 13/17] output more info but continue execution --- pre-install.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pre-install.sh b/pre-install.sh index adaa7bc..bbf22ef 100644 --- a/pre-install.sh +++ b/pre-install.sh @@ -35,7 +35,8 @@ if [ ! -z "$pkgmgr" ]; then #install git $pkgmgr_install git - +else + echo "Warning: Unsupported package manager" fi #prepare dir @@ -43,5 +44,7 @@ if [ ! -d /usr/src ]; then mkdir -vp /usr/src fi +which git || { echo "Warning: git not found" ; } + #get the install script -which git && cd /usr/src && git clone https://github.com/fusionpbx/fusionpbx-install.sh.git +cd /usr/src && git clone https://github.com/fusionpbx/fusionpbx-install.sh.git From 0911748f8285db1c84ed3389c33f34a61e44a404 Mon Sep 17 00:00:00 2001 From: example Date: Thu, 30 Mar 2017 22:19:24 +0600 Subject: [PATCH 14/17] output more information --- pre-install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pre-install.sh b/pre-install.sh index bbf22ef..66ad255 100644 --- a/pre-install.sh +++ b/pre-install.sh @@ -31,9 +31,11 @@ which pkg && { export pkgmgr='pkg' ; export pkgmgr_install=$pkgmgr' --yes instal if [ ! -z "$pkgmgr" ]; then #upgrade the packages + echo "Info: $pkgmgr_upgrade_all" $pkgmgr_upgrade_all #install git + echo "Info: $pkgmgr_install git" $pkgmgr_install git else echo "Warning: Unsupported package manager" From ce0caec504f3dee994264f332c4fdedc62abc598 Mon Sep 17 00:00:00 2001 From: example Date: Thu, 30 Mar 2017 22:39:34 +0600 Subject: [PATCH 15/17] run pkgmgr_upgrade_all in subshell to handle sequence of commands --- pre-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pre-install.sh b/pre-install.sh index 66ad255..dc98426 100644 --- a/pre-install.sh +++ b/pre-install.sh @@ -32,7 +32,7 @@ which pkg && { export pkgmgr='pkg' ; export pkgmgr_install=$pkgmgr' --yes instal if [ ! -z "$pkgmgr" ]; then #upgrade the packages echo "Info: $pkgmgr_upgrade_all" - $pkgmgr_upgrade_all + sh -c "$pkgmgr_upgrade_all" #install git echo "Info: $pkgmgr_install git" From 1e165143f3c93249d3ff097e1fc996e6ebc5ebb3 Mon Sep 17 00:00:00 2001 From: example Date: Thu, 30 Mar 2017 23:15:14 +0600 Subject: [PATCH 16/17] update flags for FreeBSD --- pre-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pre-install.sh b/pre-install.sh index dc98426..aa334ec 100644 --- a/pre-install.sh +++ b/pre-install.sh @@ -26,8 +26,8 @@ which zypper && { export pkgmgr='zypper' ; export pkgmgr_install=$pkgmgr' --non- #dpkg/apt for Debian, Ubuntu which apt-get && { export pkgmgr='apt-get' ; export pkgmgr_install=$pkgmgr' -y install' ; export pkgmgr_upgrade_all=$pkgmgr' update && '$pkgmgr' -y --force-yes upgrade' ; export pkgmgr_remove=$pkgmgr' -y remove' ; } -#?/pkg for FreeBSD -which pkg && { export pkgmgr='pkg' ; export pkgmgr_install=$pkgmgr' --yes install' ; export pkgmgr_upgrade_all=$pkgmgr' --yes upgrade' ; export pkgmgr_remove=$pkgmgr' --yes delete' ; } +#pkgng/pkg for FreeBSD 10 +which pkg && { export pkgmgr='pkg' ; export pkgmgr_install=$pkgmgr' install' ; export pkgmgr_upgrade_all=$pkgmgr' update && '$pkgmgr' upgrade' ; export pkgmgr_remove=$pkgmgr' delete' ; } if [ ! -z "$pkgmgr" ]; then #upgrade the packages From 6f188149f45eee8ed55e7a6ed49da4c50fe6683e Mon Sep 17 00:00:00 2001 From: example Date: Fri, 31 Mar 2017 00:00:12 +0600 Subject: [PATCH 17/17] upgrade without user confirmation for FreeBSD --- pre-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pre-install.sh b/pre-install.sh index aa334ec..f672177 100644 --- a/pre-install.sh +++ b/pre-install.sh @@ -27,7 +27,7 @@ which zypper && { export pkgmgr='zypper' ; export pkgmgr_install=$pkgmgr' --non- which apt-get && { export pkgmgr='apt-get' ; export pkgmgr_install=$pkgmgr' -y install' ; export pkgmgr_upgrade_all=$pkgmgr' update && '$pkgmgr' -y --force-yes upgrade' ; export pkgmgr_remove=$pkgmgr' -y remove' ; } #pkgng/pkg for FreeBSD 10 -which pkg && { export pkgmgr='pkg' ; export pkgmgr_install=$pkgmgr' install' ; export pkgmgr_upgrade_all=$pkgmgr' update && '$pkgmgr' upgrade' ; export pkgmgr_remove=$pkgmgr' delete' ; } +which pkg && { export pkgmgr='pkg' ; export pkgmgr_install=$pkgmgr' install --yes' ; export pkgmgr_upgrade_all=$pkgmgr' update && '$pkgmgr' upgrade --yes' ; export pkgmgr_remove=$pkgmgr' delete --yes' ; } if [ ! -z "$pkgmgr" ]; then #upgrade the packages