diff options
-rwxr-xr-x | installer/opengnsys_installer.sh | 20 | ||||
-rwxr-xr-x | installer/opengnsys_update.sh | 51 |
2 files changed, 44 insertions, 27 deletions
diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh index 33f25af7..031fa19e 100755 --- a/installer/opengnsys_installer.sh +++ b/installer/opengnsys_installer.sh @@ -170,7 +170,7 @@ OSVERSION="${OSVERSION%%.*}" # Configuración según la distribución GNU/Linux (usar minúsculas). case "$OSDISTRIB" in ubuntu|debian|linuxmint) - DEPENDENCIES=( subversion apache2 php php-ldap php-fpm libapache2-mod-fastcgi mysql-server php-mysql isc-dhcp-server bittorrent tftp-hpa tftpd-hpa xinetd build-essential g++-multilib libmysqlclient-dev wget curl doxygen graphviz bittornado ctorrent samba rsync unzip netpipes debootstrap schroot squashfs-tools btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq wakeonlan udpcast shim-signed grub-efi-amd64-signed ) + DEPENDENCIES=( subversion apache2 php php-ldap php-fpm mysql-server php-mysql isc-dhcp-server bittorrent tftp-hpa tftpd-hpa xinetd build-essential g++-multilib libmysqlclient-dev wget curl doxygen graphviz bittornado ctorrent samba rsync unzip netpipes debootstrap schroot squashfs-tools btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq wakeonlan udpcast shim-signed grub-efi-amd64-signed ) UPDATEPKGLIST="apt-get update" INSTALLPKG="apt-get -y install --force-yes" CHECKPKG="dpkg -s \$package 2>/dev/null | grep Status | grep -qw install" @@ -207,9 +207,10 @@ case "$OSDISTRIB" in TFTPCFGDIR=/var/lib/tftpboot ;; fedora|centos) - DEPENDENCIES=( subversion httpd mod_ssl php php-ldap mysql-server mysql-devel mysql-devel.i686 php-mysql dhcp tftp-server tftp xinetd binutils gcc gcc-c++ glibc-devel glibc-devel.i686 glibc-static glibc-static.i686 libstdc++-devel.i686 make wget curl doxygen graphviz ctorrent samba samba-client rsync unzip debootstrap schroot squashfs-tools python-crypto arp-scan procps-ng gettext moreutils jq net-tools http://ftp.altlinux.org/pub/distributions/ALTLinux/5.1/branch/$(arch)/RPMS.classic/netpipes-4.2-alt1.$(arch).rpm ) + DEPENDENCIES=( subversion httpd mod_ssl php php-ldap php-fpm mysql-server mysql-devel mysql-devel.i686 php-mysql dhcp tftp-server tftp xinetd binutils gcc gcc-c++ glibc-devel glibc-devel.i686 glibc-static glibc-static.i686 libstdc++-devel.i686 make wget curl doxygen graphviz ctorrent samba samba-client rsync unzip debootstrap schroot squashfs-tools python-crypto arp-scan procps-ng gettext moreutils jq net-tools udpcast shim-x64 grub2-efi-x64 grub2-efi-x64-modules http://ftp.altlinux.org/pub/distributions/ALTLinux/5.1/branch/$(arch)/RPMS.classic/netpipes-4.2-alt1.$(arch).rpm ) + [ "$OSDISTRIB" == "centos" ] && UPDATEPKGLIST="yum update -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-$OSVERSION.noarch.rpm http://rpms.remirepo.net/enterprise/remi-release-$OSVERSION.rpm" INSTALLEXTRADEPS=( 'pushd /tmp; wget -t3 http://download.bittornado.com/download/BitTornado-0.3.18.tar.gz && tar xvzf BitTornado-0.3.18.tar.gz && cd BitTornado-CVS && python setup.py install && ln -fs btlaunchmany.py /usr/bin/btlaunchmany && ln -fs bttrack.py /usr/bin/bttrack; popd' ) - INSTALLPKG="yum install -y libstdc++ libstdc++.i686" + INSTALLPKG="yum update -y libstdc++ libstdc++.i686" CHECKPKG="rpm -q --quiet \$package" SYSTEMD=$(which systemctl 2>/dev/null) if [ -n "$SYSTEMD" ]; then @@ -240,6 +241,7 @@ case "$OSDISTRIB" in INETDCFGDIR=/etc/xinetd.d MYSQLSERV=mysqld MARIADBSERV=mariadb + PHPFPMSERV=php-fpm RSYNCSERV=rsync RSYNCCFGDIR=/etc SAMBASERV=smb @@ -303,7 +305,7 @@ case "$OSDISTRIB" in add-apt-repository -y ppa:ondrej/php eval $UPDATEPKGLIST PHP7VERSION=$(apt-cache pkgnames php7 | sort | head -1) - PHPFPM="${PHP7VERSION}-fpm" + PHPFPMSERV="${PHP7VERSION}-fpm" DEPENDENCIES=( ${DEPENDENCIES[@]//php/$PHP7VERSION} ) fi # Adaptar dependencias para libmysqlclient. @@ -313,13 +315,9 @@ case "$OSDISTRIB" in ;; centos) # Postconfiguación personalizada para CentOS. # Configuración para PHP 7. - if ! yum list php7 &>/dev/null; then - if [ $OSVERSION -lt 7 ]; then - yum install -y https://mirror.webtatic.com/yum/el$OSVERSION/latest.rpm - PHP7VERSION=$(yum list -q php7\*w | awk -F. '/^php/ {p=$1} END {print p}') - DEPENDENCIES=( ${DEPENDENCIES[@]//php/$PHP5VERSION} ) - fi - fi + PHP7VERSION=$(yum list -q php7\* 2>/dev/null | awk -F. '/^php/ {print $1; exit;}') + DEPENDENCIES=( ${DEPENDENCIES[@]//php/$PHP7VERSION} ) + PHPFPMSERV="${PHP7VERSION}-fpm" # Cambios a aplicar a partir de CentOS 7. if [ $OSVERSION -ge 7 ]; then # Sustituir MySQL por MariaDB. diff --git a/installer/opengnsys_update.sh b/installer/opengnsys_update.sh index d30c626a..54af0340 100755 --- a/installer/opengnsys_update.sh +++ b/installer/opengnsys_update.sh @@ -96,7 +96,8 @@ LOG_FILE=/tmp/$(basename $OGLOGFILE) # - OSDISTRIB - distribución Linux # - DEPENDENCIES - array de dependencias que deben estar instaladas # - UPDATEPKGLIST, INSTALLPKGS, CHECKPKG - comandos para gestión de paquetes -# - APACHECFGDIR, APACHESERV, DHCPSERV, INETDCFGDIR - configuración y servicios +# - APACHECFGDIR, APACHESERV, PHPFPMSERV, DHCPSERV, INETDCFGDIR - configuración y servicios + function autoConfigure() { local service @@ -117,7 +118,7 @@ function autoConfigure() # Configuración según la distribución de Linux. if [ -f /etc/debian_version ]; then # Distribución basada en paquetes Deb. - DEPENDENCIES=( curl rsync btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq wakeonlan udpcast php-fpm libapache2-mod-fastcgi ) + DEPENDENCIES=( curl rsync btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq wakeonlan udpcast shim-signed grub-efi-amd64-signed php-fpm ) UPDATEPKGLIST="add-apt-repository -y ppa:ondrej/php; apt-get update" INSTALLPKGS="apt-get -y install" DELETEPKGS="apt-get -y purge" @@ -136,12 +137,13 @@ function autoConfigure() APACHEDISABLEMODS="php" APACHEUSER="www-data" APACHEGROUP="www-data" + PHPFPMSERV="php-fpm" INETDCFGDIR=/etc/xinetd.d elif [ -f /etc/redhat-release ]; then # Distribución basada en paquetes rpm. - DEPENDENCIES=( curl rsync btrfs-progs procps-ng arp-scan gettext moreutils jq net-tools ) - # En CentOS 7 instalar arp-scan de CentOS 6. - [ "$OSDISTRIB$OSVERSION" == "centos7" ] && DEPENDENCIES=( ${DEPENDENCIES[*]/arp-scan/http://dag.wieers.com/redhat/el6/en/$(arch)/dag/RPMS/arp-scan-1.9-1.el6.rf.$(arch).rpm} ) + DEPENDENCIES=( curl rsync btrfs-progs procps-ng arp-scan gettext moreutils jq net-tools udpcast shim-x64 grub2-efi-x64 grub2-efi-x64-modules ) + # Repositorios para PHP 7 en CentOS. + [ "$OSDISTRIB" == "centos" ] && UPDATEPKGLIST="yum update -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-$OSVERSION.noarch.rpm http://rpms.remirepo.net/enterprise/remi-release-$OSVERSION.rpm" INSTALLPKGS="yum install -y" DELETEPKGS="yum remove -y" CHECKPKG="rpm -q --quiet \$package" @@ -158,6 +160,7 @@ function autoConfigure() fi APACHEUSER="apache" APACHEGROUP="apache" + PHPFPMSERV="php-fpm" INETDCFGDIR=/etc/xinetd.d else # Otras distribuciones. @@ -372,13 +375,24 @@ function installDependencies() if [ -f /etc/debian_version ]; then # Basado en paquetes Deb. PHP7VERSION=$(apt-cache pkgnames php7 2>/dev/null | sort | head -1) - PHP5PKGS=( $(dpkg -l |awk '$2~/^php5/ {print $2}') ) + PHPFPMSERV="${PHP7VERSION}-fpm" + PHP5PKGS=( $(dpkg -l | awk '$2~/^php5/ {print $2}') ) if [ -n "$PHP5PKGS" ]; then $DELETEPKGS ${PHP5PKGS[@]} - PHP5PKGS[0]=$PHP7VERSION + PHP5PKGS[0]="$PHP7VERSION" INSTALLDEPS=${PHP5PKGS[@]//php5*-/${PHP7VERSION}-} fi fi + if [ "$OSDISTRIB" == "centos" ]; then + PHP7VERSION=$(yum list -q php7\* 2>/dev/null | awk -F. '/^php/ {print $1; exit;}') + PHPFPMSERV="${PHP7VERSION}-fpm" + PHP5PKGS=( $(yum list installed | awk '$1~/^php/ && $2~/^5\./ {sub(/\..*$/, "", $1); print $1}') ) + if [ -n "$PHP5PKGS" ]; then + $DELETEPKGS ${PHP5PKGS[@]} + PHP5PKGS[0]="$PHP7VERSION-php" + INSTALLDEPS=${PHP5PKGS[@]//php-/${PHP7VERSION}-php} + fi + fi if [ $# = 0 ]; then echoAndLog "${FUNCNAME}(): no dependencies are needed" @@ -533,6 +547,11 @@ function apacheConfiguration () { local config template module socketfile + # Avtivar PHP-FPM. + echoAndLog "${FUNCNAME}(): configuring PHP-FPM" + service=$PHPFPMSERV + $ENABLESERVICE; $STARTSERVICE + # Activar módulos de Apache. if [ -e $APACHECFGDIR/sites-available/opengnsys.conf ]; then echoAndLog "${FUNCNAME}(): Configuring Apache modules" @@ -544,20 +563,20 @@ function apacheConfiguration () echoAndLog "${FUNCNAME}(): Configuring Apache modules" sed -i '/rewrite/s/^#//' $APACHECFGDIR/*.conf fi + # Elegir plantilla según versión de Apache. + if [ -n "$(apachectl -v | grep "2\.[0-2]")" ]; then + template=$WORKDIR/opengnsys/server/etc/apache-prev2.4.conf.tmpl > $config + else + template=$WORKDIR/opengnsys/server/etc/apache.conf.tmpl + fi + sockfile=$(find /run/php -name "php*.sock" -type s -print 2>/dev/null) # Actualizar configuración de Apache a partir de fichero de plantilla. for config in $APACHECFGDIR/{,sites-available/}opengnsys.conf; do - # Elegir plantilla según versión de Apache. - if [ -n "$(apachectl -v | grep "2\.[0-2]")" ]; then - template=$WORKDIR/opengnsys/server/etc/apache-prev2.4.conf.tmpl > $config - else - template=$WORKDIR/opengnsys/server/etc/apache.conf.tmpl - fi - sockfile=$(find /run/php -name "php*.sock" -type s -print 2>/dev/null) - sed -e "s,CONSOLEDIR,$INSTALL_TARGET/www,g; s/SOCKETFILE/$socketfile/g" $template > $config + [ -e $config ] && sed -e "s,CONSOLEDIR,$INSTALL_TARGET/www,g; s/SOCKETFILE/$socketfile/g" $template > $config done # Reiniciar Apache. - service=$APACHESERV; $STARTSERCICE + service=$APACHESERV; $STARTSERVICE # Variables de ejecución de Apache. # - APACHE_RUN_USER |