diff options
author | ramon <ramongomez@us.es> | 2011-03-17 15:57:25 +0000 |
---|---|---|
committer | ramon <ramongomez@us.es> | 2011-03-17 15:57:25 +0000 |
commit | 6905c2a7fd1346cceda94558b3ce4238ae5780a1 (patch) | |
tree | 5b3b73a64056098ae888910200fbfc1ff4e11ce4 /admin/Interface | |
parent | d34384901d1c1313fe2410378792971841dd2864 (diff) |
Rama version1.0: Disponible script de interfaz web para cambiar de modo de montaje del repositorio.
Refs #291.
git-svn-id: https://opengnsys.es/svn/branches/version1.0@1555 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'admin/Interface')
-rwxr-xr-x | admin/Interface/CambiarAcceso | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/admin/Interface/CambiarAcceso b/admin/Interface/CambiarAcceso new file mode 100755 index 00000000..ced882ca --- /dev/null +++ b/admin/Interface/CambiarAcceso @@ -0,0 +1,49 @@ +#!/bin/bash + +#_______________________________________________________________________________________________________________________________ +# +# PARAMETROS RECIBIDOS DESDE EL CLIENTE +# $1 modo (admin, user) +#_______________________________________________________________________________________________________________________________ + +# Error si llamada no se realliza desde OpenGnSys Client. +PROG=$(basename $0) +CALLER=$(ogGetCaller) +if [ "$CALLER" != "CrearImagen" -a "$CALLER" != "ConsolaRemota" ]; then + ogRaiseError $OG_ERR_NOTEXEC "$CALLER -> $PROG" + exit $? +fi + +# Salir si el repositorio está bloquedo (tiene ficheros abiertos). +REPOIP=$(ogGetRepoIp) +if [ -z "$REPOIP" ]; then + ogRaiseError $OG_ERR_NOTFOUND "repo no montado" + exit $? +fi +if ogIsRepoLocked; then + ogRaiseError $OG_ERR_LOCKED "repo $REPOIP" + exit $? +fi + +# Comprobar protocolo y modo de acceso. +protocol=${protocol:-"smb"} +case "$protocol" in + nfs|smb) ;; + *) ogRaiseError $OG_ERR_FORMAT "protocolo desconocido $protocol" + exit $? ;; +esac +case "$1" in + admin) MODE="rw,nolock" ;; + user) MODE="ro,nolock" ;; + *) ogRaiseError $OG_ERR_FORMAT "modo desconocido $1" + exit $? ;; +esac + +# Desmontar repositorio y volver a montarlo con el modo adecuado. +umount $OGIMG +ogEcho info "$PROG: Montar repositorio $REPO por $protocol en modo $1" +case "$protocol" in + nfs) mount -t nfs -o $MODE $REPOIP:$OGIMG $OGIMG ;; + smb) mount -t cifs //${ROOTSERVER}/ogimages $OGIMG -o $MODE,serverino,acl,username=opengnsys,password=og ;; +esac + |