summaryrefslogtreecommitdiffstats
path: root/installer
diff options
context:
space:
mode:
Diffstat (limited to 'installer')
-rwxr-xr-xinstaller/opengnsys_installer.sh58
-rwxr-xr-xinstaller/opengnsys_update.sh88
2 files changed, 84 insertions, 62 deletions
diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh
index 02ec3cad..a1586067 100755
--- a/installer/opengnsys_installer.sh
+++ b/installer/opengnsys_installer.sh
@@ -132,7 +132,7 @@ function globalSetup ()
else
REMOTE=1
fi
- BRANCH="opengnsys-1.1.1c"
+ BRANCH="master"
CODE_URL="https://codeload.github.com/opengnsys/OpenGnsys/zip/$BRANCH"
API_URL="https://api.github.com/repos/opengnsys/OpenGnsys"
@@ -189,7 +189,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 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 libev-dev libjansson-dev libssl-dev shim-signed grub-efi-amd64-signed gawk libdbi-dev libdbi1 libdbd-mysql)
+ 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 libev-dev libjansson-dev libssl-dev shim-signed grub-efi-amd64-signed gawk libdbi-dev libdbi1 libdbd-mysql automake)
UPDATEPKGLIST="apt-get update"
INSTALLPKG="apt-get -y install --force-yes"
CHECKPKG="dpkg -s \$package 2>/dev/null | grep Status | grep -qw install"
@@ -227,7 +227,7 @@ case "$OSDISTRIB" in
TFTPCFGDIR=/var/lib/tftpboot
;;
fedora|centos)
- DEPENDENCIES=( subversion httpd mod_ssl 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 libev-devel jansson-devel openssl-devel shim-x64 grub2-efi-x64 grub2-efi-x64-modules gawk libdbi-devel libdbi libdbi-dbd-mysql 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-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 libev-devel jansson-devel openssl-devel shim-x64 grub2-efi-x64 grub2-efi-x64-modules gawk libdbi-devel libdbi libdbi-dbd-mysql automake http://ftp.altlinux.org/pub/distributions/ALTLinux/5.1/branch/$(arch)/RPMS.classic/netpipes-4.2-alt1.$(arch).rpm )
[ "$OSDISTRIB" == "centos" ] && UPDATEPKGLIST="yum install -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://ftp.acc.umu.se/mirror/bittornado/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"
@@ -1328,30 +1328,12 @@ function servicesCompilation ()
# Compilar OpenGnsys Server
echoAndLog "${FUNCNAME}(): Compiling OpenGnsys Admin Server"
pushd $WORKDIR/opengnsys/admin/Sources/Services/ogAdmServer
- make && mv ogAdmServer $INSTALL_TARGET/sbin
+ autoreconf -fi && ./configure && make && mv ogAdmServer $INSTALL_TARGET/sbin
if [ $? -ne 0 ]; then
echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Admin Server"
hayErrores=1
fi
popd
- # Compilar OpenGnsys Agent
- echoAndLog "${FUNCNAME}(): Compiling OpenGnsys Agent"
- pushd $WORKDIR/opengnsys/admin/Sources/Services/ogAdmAgent
- make && mv ogAdmAgent $INSTALL_TARGET/sbin
- if [ $? -ne 0 ]; then
- echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Agent"
- hayErrores=1
- fi
- popd
- # Compilar OpenGnsys Client
- echoAndLog "${FUNCNAME}(): Compiling OpenGnsys Admin Client"
- pushd $WORKDIR/opengnsys/admin/Sources/Clients/ogAdmClient
- make && mv ogAdmClient ../../../../client/shared/bin
- if [ $? -ne 0 ]; then
- echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Admin Client"
- hayErrores=1
- fi
- popd
return $hayErrores
}
@@ -1406,6 +1388,21 @@ function copyClientFiles()
errorAndLog "${FUNCNAME}(): client copy files with errors"
fi
+ local ogclientUrl="https://codeload.github.com/opengnsys/ogClient/zip/$BRANCH"
+
+ echoAndLog "${FUNCNAME}(): downloading ogClient code..."
+
+ if ! (curl "${ogclientUrl}" -o ogclient.zip && \
+ unzip -qo ogclient.zip && \
+ mv "ogClient-$BRANCH" $INSTALL_TARGET/client/ogClient)
+ then
+ errorAndLog "${FUNCNAME}(): "\
+ "error getting ogClient code from ${ogclientUrl}"
+ return 1
+ fi
+ rm -f ogclient.zip
+ echoAndLog "${FUNCNAME}(): ogClient code was downloaded"
+
return $errstatus
}
@@ -1464,6 +1461,8 @@ function openGnsysConfigure()
echoAndLog "${FUNCNAME}(): Copying init files."
cp -a $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.init /etc/init.d/opengnsys
+ cp -a $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.service \
+ /lib/systemd/system/opengnsys.service
cp -a $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.default /etc/default/opengnsys
# Deshabilitar servicios de BitTorrent si no están instalados.
if [ ! -e /usr/bin/bttrack ]; then
@@ -1493,11 +1492,6 @@ function openGnsysConfigure()
$WORKDIR/opengnsys/admin/Sources/Services/ogAdmServer/ogAdmServer.cfg > $INSTALL_TARGET/etc/ogAdmServer-$dev.cfg
sed -e "s/SERVERIP/${SERVERIP[i]}/g" \
$WORKDIR/opengnsys/repoman/etc/ogAdmRepo.cfg.tmpl > $INSTALL_TARGET/etc/ogAdmRepo-$dev.cfg
- sed -e "s/SERVERIP/${SERVERIP[i]}/g" \
- -e "s/DBUSER/$OPENGNSYS_DB_USER/g" \
- -e "s/DBPASSWORD/$OPENGNSYS_DB_PASSWD/g" \
- -e "s/DATABASE/$OPENGNSYS_DATABASE/g" \
- $WORKDIR/opengnsys/admin/Sources/Services/ogAdmAgent/ogAdmAgent.cfg > $INSTALL_TARGET/etc/ogAdmAgent-$dev.cfg
CONSOLEURL="https://${SERVERIP[i]}/opengnsys"
sed -e "s/SERVERIP/${SERVERIP[i]}/g" \
-e "s/DBUSER/$OPENGNSYS_DB_USER/g" \
@@ -1505,19 +1499,15 @@ function openGnsysConfigure()
-e "s/DATABASE/$OPENGNSYS_DATABASE/g" \
-e "s/OPENGNSYSURL/${CONSOLEURL//\//\\/}/g" \
$INSTALL_TARGET/www/controlacceso.php > $INSTALL_TARGET/www/controlacceso-$dev.php
- sed -e "s/SERVERIP/${SERVERIP[i]}/g" \
- -e "s/OPENGNSYSURL/${CONSOLEURL//\//\\/}/g" \
- $WORKDIR/opengnsys/admin/Sources/Clients/ogAdmClient/ogAdmClient.cfg > $INSTALL_TARGET/client/etc/ogAdmClient-$dev.cfg
if [ "$dev" == "$DEFAULTDEV" ]; then
OPENGNSYS_CONSOLEURL="$CONSOLEURL"
+ OPENGNSYS_SERVERIP="${SERVERIP[i]}"
fi
fi
let i++
done
ln -f $INSTALL_TARGET/etc/ogAdmServer-$DEFAULTDEV.cfg $INSTALL_TARGET/etc/ogAdmServer.cfg
ln -f $INSTALL_TARGET/etc/ogAdmRepo-$DEFAULTDEV.cfg $INSTALL_TARGET/etc/ogAdmRepo.cfg
- ln -f $INSTALL_TARGET/etc/ogAdmAgent-$DEFAULTDEV.cfg $INSTALL_TARGET/etc/ogAdmAgent.cfg
- ln -f $INSTALL_TARGET/client/etc/ogAdmClient-$DEFAULTDEV.cfg $INSTALL_TARGET/client/etc/ogAdmClient.cfg
ln -f $INSTALL_TARGET/www/controlacceso-$DEFAULTDEV.php $INSTALL_TARGET/www/controlacceso.php
# Configuración del motor de clonación.
@@ -1551,6 +1541,10 @@ EOT
echoAndLog "${FUNCNAME}(): Starting OpenGnsys services."
$STARTSERVICE
fi
+
+ echoAndLog "${FUNCNAME}(): Creating ogClient config files."
+ sed -i -e "s/127\.0\.0\.1/$OPENGNSYS_SERVERIP/g" \
+ $INSTALL_TARGET/client/ogClient/cfg/ogclient.json
}
diff --git a/installer/opengnsys_update.sh b/installer/opengnsys_update.sh
index f0a6f32f..aa981c0a 100755
--- a/installer/opengnsys_update.sh
+++ b/installer/opengnsys_update.sh
@@ -55,8 +55,6 @@ fi
# Cargar configuración de acceso a la base de datos.
if [ -r $INSTALL_TARGET/etc/ogAdmServer.cfg ]; then
source $INSTALL_TARGET/etc/ogAdmServer.cfg
-elif [ -r $INSTALL_TARGET/etc/ogAdmAgent.cfg ]; then
- source $INSTALL_TARGET/etc/ogAdmAgent.cfg
fi
OPENGNSYS_DATABASE=${OPENGNSYS_DATABASE:-"$CATALOG"} # Base de datos
OPENGNSYS_DBUSER=${OPENGNSYS_DBUSER:-"$USUARIO"} # Usuario de acceso
@@ -117,7 +115,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 libev-dev libjansson-dev libssl-dev shim-signed grub-efi-amd64-signed php-fpm gawk libdbi-dev libdbi1 libdbd-mysql)
+ DEPENDENCIES=( curl rsync btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq wakeonlan udpcast libev-dev libjansson-dev libssl-dev shim-signed grub-efi-amd64-signed php-fpm gawk libdbi-dev libdbi1 libdbd-mysql automake)
# Paquete correcto para realpath.
[ -z "$(apt-cache pkgnames realpath)" ] && DEPENDENCIES=( ${DEPENDENCIES[@]//realpath/coreutils} )
UPDATEPKGLIST="add-apt-repository -y ppa:ondrej/php; apt-get update"
@@ -144,7 +142,7 @@ function autoConfigure()
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 udpcast libev-devel jansson-devel openssl-devel shim-x64 grub2-efi-x64 grub2-efi-x64-modules gawk libdbi-devel libdbi libdbi-dbd-mysql)
+ DEPENDENCIES=( curl rsync btrfs-progs procps-ng arp-scan gettext moreutils jq net-tools udpcast libev-devel jansson-devel openssl-devel shim-x64 grub2-efi-x64 grub2-efi-x64-modules gawk libdbi-devel libdbi libdbi-dbd-mysql automake)
# 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"
@@ -972,9 +970,27 @@ function updateServerFiles()
if ! diff -q $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.init /etc/init.d/opengnsys 2>/dev/null; then
echoAndLog "${FUNCNAME}(): updating new init file"
backupFile /etc/init.d/opengnsys
+ service="opengnsys"
+ $STOPSERVICE
cp -a $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.init /etc/init.d/opengnsys
+ systemctl daemon-reload
+ $STARTSERVICE
NEWFILES="$NEWFILES /etc/init.d/opengnsys"
fi
+ if ! diff -q \
+ $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.service \
+ /lib/systemd/system/opengnsys.service 2>/dev/null; then
+ echoAndLog "${FUNCNAME}(): updating new service file"
+ backupFile /lib/systemd/system/opengnsys.service
+ service="opengnsys"
+ $STOPSERVICE
+ cp -a \
+ $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.service \
+ /lib/systemd/system/opengnsys.service
+ systemctl daemon-reload
+ $STARTSERVICE
+ NEWFILES="$NEWFILES /lib/systemd/system/opengnsys.service"
+ fi
if ! diff -q $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.default /etc/default/opengnsys >/dev/null; then
echoAndLog "${FUNCNAME}(): updating new default file"
backupFile /etc/default/opengnsys
@@ -987,12 +1003,6 @@ function updateServerFiles()
done < $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.default
NEWFILES="$NEWFILES /etc/default/opengnsys"
fi
- if egrep -q "(UrlMsg=.*msgbrowser.php)|(UrlMenu=http://)" $INSTALL_TARGET/client/etc/ogAdmClient.cfg 2>/dev/null; then
- echoAndLog "${FUNCNAME}(): updating new client config file"
- backupFile $INSTALL_TARGET/client/etc/ogAdmClient.cfg
- perl -pi -e 's!UrlMsg=.*msgbrowser\.php!UrlMsg=http://localhost/cgi-bin/httpd-log\.sh!g; s!UrlMenu=http://!UrlMenu=https://!g' $INSTALL_TARGET/client/etc/ogAdmClient.cfg
- NEWFILES="$NEWFILES $INSTALL_TARGET/client/etc/ogAdmClient.cfg"
- fi
echoAndLog "${FUNCNAME}(): updating cron files"
[ ! -f /etc/cron.d/torrentcreator ] && echo "* * * * * root [ -x $INSTALL_TARGET/bin/torrent-creator ] && $INSTALL_TARGET/bin/torrent-creator" > /etc/cron.d/torrentcreator
@@ -1029,11 +1039,13 @@ function moveNewService()
# Comparar los ficheros.
if ! diff -q $1 $2/$(basename $1) &>/dev/null; then
# Parar los servicios si fuese necesario.
- [ -z "$NEWSERVICES" ] && service="opengnsys" $STOPSERVICE
+ service="opengnsys"
+ [ -z "$NEWSERVICES" ] && $STOPSERVICE
# Nuevo servicio.
NEWSERVICES="$NEWSERVICES $(basename $1)"
# Mover el nuevo fichero de servicio
mv $1 $2
+ $STARTSERVICE
fi
}
@@ -1046,7 +1058,7 @@ function compileServices()
# Compilar OpenGnsys Server
echoAndLog "${FUNCNAME}(): Recompiling OpenGnsys Admin Server"
pushd $WORKDIR/opengnsys/admin/Sources/Services/ogAdmServer
- make && moveNewService ogAdmServer $INSTALL_TARGET/sbin
+ autoreconf -fi && ./configure && make && moveNewService ogAdmServer $INSTALL_TARGET/sbin
if [ $? -ne 0 ]; then
echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Admin Server"
hayErrores=1
@@ -1054,25 +1066,11 @@ function compileServices()
popd
# Parar antiguo servicio de repositorio.
pgrep ogAdmRepo > /dev/null && service="ogAdmRepo" $STOPSERVICE
- # Compilar OpenGnsys Agent
- echoAndLog "${FUNCNAME}(): Recompiling OpenGnsys Server Agent"
- pushd $WORKDIR/opengnsys/admin/Sources/Services/ogAdmAgent
- make && moveNewService ogAdmAgent $INSTALL_TARGET/sbin
- if [ $? -ne 0 ]; then
- echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Server Agent"
- hayErrores=1
- fi
- popd
+ # Remove OpenGnsys Agent (ogAdmAgent)
+ echoAndLog "${FUNCNAME}(): deleting deprecated OpenGnsys Agent"
+ [ -e $INSTALL_TARGET/sbin/ogAdmAgent ] && \
+ rm -f $INSTALL_TARGET/sbin/ogAdmAgent
- # Compilar OpenGnsys Client
- echoAndLog "${FUNCNAME}(): Recompiling OpenGnsys Client"
- pushd $WORKDIR/opengnsys/admin/Sources/Clients/ogAdmClient
- make && mv ogAdmClient $INSTALL_TARGET/client/bin
- if [ $? -ne 0 ]; then
- echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Client"
- hayErrores=1
- fi
- popd
# Generar un API token de ogAdmServer si no existe en el fichero de configuración.
grep -q "APITOKEN=" $INSTALL_TARGET/etc/ogAdmServer.cfg || \
$INSTALL_TARGET/bin/settoken -f
@@ -1138,6 +1136,30 @@ function updateClient()
fi
}
+# Update ogClient
+function updateOgClient()
+{
+ local ogclientUrl="https://codeload.github.com/opengnsys/ogClient/zip/$BRANCH"
+
+ echoAndLog "${FUNCNAME}(): downloading ogClient code..."
+
+ if ! (curl "${ogclientUrl}" -o ogclient.zip && \
+ unzip -qo ogclient.zip)
+ then
+ errorAndLog "${FUNCNAME}(): "\
+ "error getting ogClient code from ${ogclientUrl}"
+ return 1
+ fi
+ if [ -e $INSTALL_TARGET/client/ogClient/cfg/ogclient.json ]; then
+ rm -f ogClient-"$BRANCH"/cfg/ogclient.json
+ fi
+ mv -f "ogClient-$BRANCH" $INSTALL_TARGET/client/ogClient
+ rm -f ogclient.zip
+ echoAndLog "${FUNCNAME}(): ogClient code was downloaded and updated"
+
+ return 0
+}
+
# Comprobar permisos y ficheros.
function checkFiles()
{
@@ -1330,6 +1352,12 @@ if [ $? -ne 0 ]; then
exit 1
fi
+# Update ogClient
+if ! updateOgClient; then
+ errorAndLog "Error updating ogClient files"
+ exit 1
+fi
+
# Comprobar permisos y ficheros.
checkFiles