"Fossies" - the Fresh Open Source Software Archive

Member "fogproject-1.5.9/lib/ubuntu/config.sh" (13 Sep 2020, 7655 Bytes) of package /linux/misc/fogproject-1.5.9.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "config.sh": 1.5.8_vs_1.5.9.

A hint: This file contains one or more very long lines, so maybe it is better readable using the pure text view mode that shows the contents as wrapped lines within the browser window.


    1 #!/bin/bash
    2 #
    3 #  FOG is a computer imaging solution.
    4 #  Copyright (C) 2007  Chuck Syperski & Jian Zhang
    5 #
    6 #   This program is free software: you can redistribute it and/or modify
    7 #   it under the terms of the GNU General Public License as published by
    8 #   the Free Software Foundation, either version 3 of the License, or
    9 #    any later version.
   10 #
   11 #   This program is distributed in the hope that it will be useful,
   12 #   but WITHOUT ANY WARRANTY; without even the implied warranty of
   13 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   14 #   GNU General Public License for more details.
   15 #
   16 #   You should have received a copy of the GNU General Public License
   17 #   along with this program.  If not, see <http://www.gnu.org/licenses/>.
   18 #
   19 [[ -z $repo ]] && repo="php"
   20 [[ -z $packageQuery ]] && packageQuery="dpkg -l \$x | grep '^ii'"
   21 if [[ $linuxReleaseName == +(*[Bb][Ii][Aa][Nn]*) ]]; then
   22     sysvrcconf="sysv-rc-conf"
   23     case $OSVersion in
   24         8)
   25             php_ver="5"
   26             ;;
   27         9)
   28             php_ver="7.0"
   29             x="*php5*"
   30             ;;
   31         10)
   32             php_ver="7.3"
   33             x="*php5* *php7.0*"
   34             ;;
   35     esac
   36     old_php=$(eval $packageQuery 2>/dev/null | awk '{print $2}' | tr '\n' ' ')
   37     if [[ -n "$old_php" ]]; then
   38         dots "Removing old PHP version before installing the new one"
   39         DEBIAN_FRONTEND=noninteractive apt-get purge -yq ${old_php} >/dev/null 2>&1
   40         [[ $? -ne 0 ]] && echo "Failed" || echo "Done"
   41         apt-get clean -yq >/dev/null 2>&1
   42     fi
   43 elif [[ $linuxReleaseName == +(*[Uu][Bb][Uu][Nn][Tt][Uu]*|*[Mm][Ii][Nn][Tt]*) ]]; then
   44     DEBIAN_FRONTEND=noninteractive apt-get purge -yq sysv-rc-conf >/dev/null 2>&1
   45     case $OSVersion in
   46         20)
   47             php_ver="7.4"
   48             ;;
   49         19)
   50             php_ver="7.3"
   51             ;;
   52         18)
   53             php_ver="7.2"
   54             ;;
   55         *)
   56             sysvrcconf="sysv-rc-conf"
   57             php_ver="7.1"
   58             x="*php5* *php-5*"
   59             eval $packageQuery >>$workingdir/error_logs/fog_error_${version}.log 2>&1
   60             if [[ $? -ne 0 ]]; then
   61                 if [[ $autoaccept != yes ]]; then
   62                     echo " *** Detected a potential need to reinstall apache and php files."
   63                     echo " *** This will remove the /etc/php* and /etc/apache2* directories"
   64                     echo " ***  and remove/purge the apache and php files from this system."
   65                     echo " *** If you're okay with this please type Y, anything else will"
   66                     echo " ***  continue the installation, but may mean you will need to"
   67                     echo " ***  remove the files later and make proper changes as "
   68                     echo " ***  necessary. (Y/N): "
   69                     read dummy
   70                 else
   71                     dummy="y"
   72                 fi
   73                 case $dummy in
   74                     [Yy])
   75                         dots "Removing apache and php files"
   76                         rm -rf /etc/php* /etc/apache2*
   77                         echo "Done"
   78                         dots "Stopping web services"
   79                         if [[ $systemctl == yes ]]; then
   80                             systemctl is-active --quiet apache2 && systemctl stop apache2 >/dev/null 2>&1 || true
   81                         fi
   82                         [[ ! $? -eq 0 ]] && echo "Failed" || echo "Done"
   83                         dots "Removing the apache and php packages"
   84                         DEBIAN_FRONTEND=noninteractive apt-get purge -yq 'apache2*' 'php5*' 'php7*' 'libapache*' >/dev/null 2>&1
   85                         [[ ! $? -eq 0 ]] && echo "Failed" || echo "Done"
   86                         apt-get clean -yq >/dev/null 2>&1
   87                         ;;
   88                 esac
   89             fi
   90     esac
   91 else
   92     [[ -z $php_ver ]] && php_ver=5
   93 fi
   94 [[ -z $php_verAdds ]] && php_verAdds="-${php_ver}"
   95 [[ $php_ver == 5 ]] && php_verAdds="-5.6"
   96 [[ $php_ver != 5 ]] && phpcmd="php" || phpcmd="php5"
   97 [[ -z $phpfpm ]] && phpfpm="php${php_ver}-fpm"
   98 [[ -z $phpldap ]] && phpldap="php${php_ver}-ldap"
   99 [[ -z $phpcmd ]] && phpcmd="php"
  100 case $linuxReleaseName in
  101     *[Uu][Bb][Uu][Nn][Tt][Uu]*|*[Bb][Ii][Aa][Nn]*|*[Mm][Ii][Nn][Tt]*)
  102         if [[ -z $packages ]]; then
  103             x="mysql-server"
  104             eval $packageQuery >>$workingdir/error_logs/fog_error_${version}.log 2>&1
  105             [[ $? -eq 0 ]] && db_packages="mysql-client mysql-server" || db_packages="mariadb-client mariadb-server"
  106             packages="apache2 build-essential cpp curl g++ gawk gcc genisoimage git gzip htmldoc isc-dhcp-server isolinux lftp libapache2-mod-fastcgi libapache2-mod-php${php_ver} libc6 libcurl3 liblzma-dev m4 ${db_packages} net-tools nfs-kernel-server openssh-server $phpfpm php-gettext php${php_ver} php${php_ver}-cli php${php_ver}-curl php${php_ver}-gd php${php_ver}-json $phpldap php${php_ver}-mysql php${php_ver}-mysqlnd ${sysvrcconf} tar tftpd-hpa tftp-hpa vsftpd wget xinetd zlib1g"
  107         else
  108             # make sure we update all the php version numbers with those specified above
  109             packages=${packages//php[0-9]\.[0-9]/php${php_ver}}
  110         fi
  111         [[ -z $packageinstaller ]] && packageinstaller="apt-get -yq install -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold"
  112         [[ -z $packagelist ]] && packagelist="apt-cache pkgnames | grep"
  113         [[ -z $packageupdater ]] && packageupdater="apt-get -yq upgrade -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold"
  114         [[ -z $packmanUpdate ]] && packmanUpdate="apt-get update"
  115         [[ -z $dhcpname ]] && dhcpname="isc-dhcp-server"
  116         [[ -z $olddhcpname ]] && olddhcpname="dhcp3-server"
  117         ;;
  118 esac
  119 [[ -z $langPackages ]] && langPackages="language-pack-it language-pack-en language-pack-es language-pack-zh-hans"
  120 [[ $php_ver != 5 ]] && packages="$packages php${php_ver}-mbstring"
  121 if [[ -z $webdirdest ]]; then
  122     if [[ -z $docroot ]]; then
  123         docroot="/var/www/html/"
  124         webdirdest="${docroot}fog/"
  125     elif [[ "$docroot" != *'fog'* ]]; then
  126         webdirdest="${docroot}fog/"
  127     else
  128         webdirdest="${docroot}/"
  129     fi
  130     if [[ $docroot == /var/www/html/ && ! -d $docroot ]]; then
  131         docroot="/var/www/"
  132         webdirdest="${docroot}fog/"
  133     fi
  134 fi
  135 [[ -z $webredirect ]] && webredirect="$docroot/index.php"
  136 [[ -z $apacheuser ]] && apacheuser="www-data"
  137 [[ -z $apachelogdir ]] && apachelogdir="/var/log/apache2"
  138 [[ -z $apacheerrlog ]] && apacheerrlog="$apachelogdir/error.log"
  139 [[ -z $apacheacclog ]] && apacheacclog="$apachelogdir/access.log"
  140 [[ -z $etcconf ]] && etcconf="/etc/apache2/sites-available/001-fog.conf"
  141 [[ $php_ver != 5 ]] && phpini="/etc/$phpcmd/$php_ver/fpm/php.ini" || phpini="/etc/$phpcmd/fpm/php.ini"
  142 [[ -z $storageLocation ]] && storageLocation="/images"
  143 [[ -z $storageLocationCapture ]] && storageLocationCapture="${storageLocation}/dev"
  144 [[ -z $dhcpconfig ]] && dhcpconfig="/etc/dhcp3/dhcpd.conf"
  145 [[ -z $dhcpconfigother ]] && dhcpconfigother="/etc/dhcp/dhcpd.conf"
  146 [[ -z $tftpdirdst ]] && tftpdirdst="/tftpboot"
  147 [[ -z $tftpconfig ]] && tftpconfig="/etc/xinetd.d/tftp"
  148 [[ -z $tftpconfigupstartconf ]] && tftpconfigupstartconf="/etc/init/tftpd-hpa.conf"
  149 [[ -z $tftpconfigupstartdefaults ]] && tftpconfigupstartdefaults="/etc/default/tftpd-hpa"
  150 [[ -z $ftpconfig ]] && ftpconfig="/etc/vsftpd.conf"
  151 [[ -z $snapindir ]] && snapindir="/opt/fog/snapins"
  152 [[ -z $jsontest ]] && jsontest="php${php_ver}-json php${php_ver}-common"
  153 if [[ -z $dhcpd ]]; then
  154     if [[ -e /etc/init.d/$dhcpname ]]; then
  155         dhcpd=$dhcpname
  156     elif [[ -e /etc/init.d/$olddhcpname ]]; then
  157         dhcpd=$olddhcpname
  158     fi
  159 fi