summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorramon <ramongomez@us.es>2010-07-13 14:59:35 +0000
committerramon <ramongomez@us.es>2010-07-13 14:59:35 +0000
commit9ee62adb9637e479247e0607b580ee7a030495a7 (patch)
tree9a59c5f1870992480b359f588088b5e1fedec602
parentffac868a6b1838d5d09972c9fdf246c386d56e6d (diff)
Fixes #170 - Ficheros .torrent se crean en el repositorio y no desde el cliente.
git-svn-id: https://opengnsys.es/svn/trunk@1099 a21b9725-9963-47de-94b9-378ad31fedc9
-rwxr-xr-xclient/nfsexport/scripts/createImage6
-rwxr-xr-xinstaller/opengnsys_installer.sh8
-rwxr-xr-xinstaller/opengnsys_update.sh2
-rwxr-xr-xrepoman/bin/torrent-creator22
4 files changed, 18 insertions, 20 deletions
diff --git a/client/nfsexport/scripts/createImage b/client/nfsexport/scripts/createImage
index 59317ca4..8bde082a 100755
--- a/client/nfsexport/scripts/createImage
+++ b/client/nfsexport/scripts/createImage
@@ -54,12 +54,6 @@ if [ $REDSIZE -lt $SIZE ]; then
ogExtendFs $1 $2
fi
-# Creamos fichero torrent. si REPO tracker=ipREPO, si CACHE tracker=ipLocal
-[ "$3" == "REPO" ] && IPTORRENT=`mount | grep ":/opt/opengnsys/images" | cut -f1 -d:` \
- || IPTORRENT=`ogGetIpAddress`
-echo "[95] Crear torrent $3 $4 $IPTORRENT"
-ogCreateTorrent "$3" "$4" "$IPTORRENT"
-
TIME=$[SECONDS-TIME1]
echo "[100] Duración de la operación $[TIME/60]m $[TIME%60]s"
exit $EXITCODE
diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh
index bae7b025..98eaf061 100755
--- a/installer/opengnsys_installer.sh
+++ b/installer/opengnsys_installer.sh
@@ -965,11 +965,13 @@ function openGnsysClientCreate()
# Configuración básica de servicios de OpenGnSys
function openGnsysConfigure()
{
- echoAndLog "openGnsysConfigure(): Copying init files."
+ echoAndLog "${FUNCNAME}(): Copying init files."
cp -p $WORKDIR/opengnsys/admin/Services/opengnsys.init /etc/init.d/opengnsys
cp -p $WORKDIR/opengnsys/admin/Services/opengnsys.default /etc/default/opengnsys
update-rc.d opengnsys defaults
- echoAndLog "openGnsysConfigure(): Creating OpenGnSys config file in \"$INSTALL_TARGET/etc\"."
+ echoAndLog "${FUNCNAME}(): Creating cron files."
+ echo "* * * * * root [ -x $INSTALL_TARGET/bin/torrent-creator ] && $INSTALL_TARGET/bin/torrent-creator" > /etc/cron.d/torrentcreator
+ echoAndLog "${FUNCNAME}(): Creating OpenGnSys config file in \"$INSTALL_TARGET/etc\"."
perl -pi -e "s/SERVERIP/$SERVERIP/g" $INSTALL_TARGET/etc/ogAdmServer.cfg
perl -pi -e "s/SERVERIP/$SERVERIP/g" $INSTALL_TARGET/etc/ogAdmRepo.cfg
perl -pi -e "s/SERVERIP/$SERVERIP/g" $INSTALL_TARGET/etc/ogAdmAgent.cfg
@@ -977,7 +979,7 @@ function openGnsysConfigure()
OPENGNSYS_CONSOLEURL="http://$SERVERIP/opengnsys"
perl -pi -e "s/SERVERIP/$SERVERIP/g; s/OPENGNSYSURL/${OPENGNSYS_CONSOLEURL//\//\\/}/g" $INSTALL_TARGET/www/controlacceso.php
sed -e "s/SERVERIP/$SERVERIP/g" -e "s/OPENGNSYSURL/${OPENGNSYS_CONSOLEURL//\//\\/}/g" $WORKDIR/opengnsys/admin/Services/ogAdmClient/ogAdmClient.cfg > $INSTALL_TARGET/client/etc/ogAdmClient.cfg
- echoAndLog "openGnsysConfiguration(): Starting OpenGnSys services."
+ echoAndLog "${FUNCNAME}(): Starting OpenGnSys services."
/etc/init.d/opengnsys start
}
diff --git a/installer/opengnsys_update.sh b/installer/opengnsys_update.sh
index 6ab7f2f8..8f82fb9f 100755
--- a/installer/opengnsys_update.sh
+++ b/installer/opengnsys_update.sh
@@ -304,6 +304,8 @@ function updateServerFiles () {
rsync --exclude .svn -irplt "${SOURCES[$i]}" "${INSTALL_TARGET}/${TARGETS[$i]}"
done
popd >/dev/null
+ echoAndLog "${FUNCNAME}(): updating cron files"
+ echo "* * * * * root [ -x $INSTALL_TARGET/bin/torrent-creator ] && $INSTALL_TARGET/bin/torrent-creator" > /etc/cron.d/torrentcreator
echoAndLog "${FUNCNAME}(): server files updated successfully."
}
diff --git a/repoman/bin/torrent-creator b/repoman/bin/torrent-creator
index a9eb6732..5fa7eb91 100755
--- a/repoman/bin/torrent-creator
+++ b/repoman/bin/torrent-creator
@@ -1,23 +1,23 @@
#!/bin/bash
-
+# Genera los ficheros .torrent de las imágenes almacenadas en el repositorio.
#Version 0.3 Ejecución desde cron cada minuto,
-# Trabaja sólo con la primera imagen que tenga asociado un fichero .doTorrent
-## echo " * * * * * root /opt/opengnsys/bin/torrent-creator" > /etc/cron.d/torrent-creator.cron
+## echo "* * * * * root /opt/opengnsys/bin/torrent-creator" > /etc/cron.d/torrentcreator
-# Variables.
+# Comprobar si el proceso ya está en ejecución.
PROG=$(basename $0)
+[ "$(pgrep "$PROG")" != "$$" ] && exit
+
+# Variables.
OPENGNSYS=${OPENGNSYS:-"/opt/opengnsys"}
PATH=$PATH:$OPENGNSYS/bin
OGIMG="$OPENGNSYS/images"
-source $OPENGNSYS/etc/ogAdmRepo.cfg
-TRACKERURL="http://$IPlocal:6969/announce"
+REPOCFG="$OPENGNSYS/etc/ogAdmRepo.cfg"
LOGFILE="$OPENGNSYS/log/$PROG.log"
-
-if [ "$(pgrep "$PROG")" != "$$" ]; then
- echo "`date` : Proceso ya en ejecución" >> $LOGFILE
- exit
-fi
+# Error si no está bien configurado el repositorio de imágenes.
+[ -d $OGIMG -a -f $REPOCFG ] || exit 1
+source $REPOCFG
+TRACKERURL="http://$IPlocal:6969/announce"
# Directorio de imágenes.
pushd $OGIMG >/dev/null