source: client/shared/etc/preinit/mountrepo.sh @ 64f4ada

918-git-images-111dconfigfileconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacionwebconsole3
Last change on this file since 64f4ada was 1a2fa9d8, checked in by ramon <ramongomez@…>, 10 years ago

#673: Actualizar código incluido en OepnGnSys? 1.0.6 sobre la rama version1.1 para desarrollar la nueva versión.

git-svn-id: https://opengnsys.es/svn/branches/version1.1@4609 a21b9725-9963-47de-94b9-378ad31fedc9

  • Property mode set to 100755
File size: 1.9 KB
Line 
1#!/bin/bash
2#/**
3#@file    mountrepo.sh
4#@brief   Script para montar el repositorio de datos remoto.
5#@warning License: GNU GPLv3+
6#@version 1.0
7#@author  Ramon Gomez, ETSII Universidad de Sevilla
8#@date    2011-03-17
9#*/
10
11OGIMG=${OGIMG:-/opt/opengnsys/images}
12ROOTREPO=${ROOTREPO:-"$ROOTSERVER"}
13
14# TODO Revisar proceso de arranque para no montar 2 veces el repositorio.
15if [ "$ogactiveadmin" == "true" ]; then
16        export boot=admin       # ATENCIÓN: siempre en modo "admin".
17        umount $OGIMG 2>/dev/null
18
19        protocol=${ogprotocol:-"smb"}
20        printf "$MSG_MOUNTREPO\n" "$protocol" "$boot"
21        case "$ogprotocol" in
22                nfs)    mount.nfs ${ROOTREPO}:$OGIMG $OGIMG -o rw,nolock ;;
23                smb)    PASS=$(grep "^[         ]*\(export \)\?OPTIONS=" /scripts/ogfunctions 2>&1 | \
24                                sed 's/\(.*\)pass=\(\w*\)\(.*\)/\2/')
25                        PASS=${PASS:-"og"}
26                        mount.cifs //${ROOTREPO}/ogimages $OGIMG -o rw,serverino,acl,username=opengnsys,password=$PASS
27                        ;;
28                local)  # TODO: hacer funcion dentro de este script que monte smb
29                        # Comprobamos que estatus sea online.
30                        if [ "$ogstatus" == "offline" -o "$SERVER" == "" ]; then
31                           # Si estatus es offline buscamos un dispositivo con etiqueta repo
32                           # y si no existe montamos la cache como repo (si existe).
33                           TYPE=$(blkid | grep REPO | awk -F"TYPE=" '{print $2}' | tr -d \")
34                           if [ "$TYPE" == "" ]; then
35                                [ -d $OGCAC/$OGIMG ] && mount --bind  $OGCAC/$OGIMG $OGIMG
36                           else
37                                mount -t $TYPE LABEL=REPO $OGIMG &>/dev/null
38                           fi
39                        else
40                           # Comprobamos que existe un servicio de samba.
41                           smbclient -L $SERVER -N &>/dev/null
42                           if [ $? -eq 0 ]; then
43                                PASS=$(grep "^[         ]*\(export \)\?OPTIONS=" /scripts/ogfunctions 2>&1 | \
44                                   sed 's/\(.*\)pass=\(\w*\)\(.*\)/\2/')
45                                PASS=${PASS:-"og"}
46                                mount.cifs //${ROOTREPO}/ogimages $OGIMG -o rw,serverino,acl,username=opengnsys,password=$PASS
47                           fi
48                           # TODO: buscar condicion para NFS
49                        fi
50                        ;;
51        esac
52fi
53
Note: See TracBrowser for help on using the repository browser.