1 | #!/bin/bash |
---|
2 | |
---|
3 | #/** |
---|
4 | # configureOs |
---|
5 | #@brief Scirpt para realizar la configuracion del sistema operativo restaurado. |
---|
6 | #@param 1 disco |
---|
7 | #@param 2 particion |
---|
8 | #@return |
---|
9 | #@TODO comprobar que el tipo de particion corresponde con el sistema de archivos. |
---|
10 | #@exception OG_ERR_FORMAT # 1 formato incorrecto. |
---|
11 | #@version 1.0.1 - Integracion cambio de nombre, extender fs, chequear particion activa |
---|
12 | #@author |
---|
13 | #@date 2011-05-11 |
---|
14 | #@version 1.0.1 - Configura el sector de la particion y el gestor de windows para iniciarse desde cualquier particion. |
---|
15 | #@author Antonio J. Doblas Viso. Universidad de Malaga. |
---|
16 | #@date 2011-05-20 |
---|
17 | #@version 1.0.2 - Configura el sector de la particion y el gestor de linux para iniciarse desde cualquier particion. |
---|
18 | #@author Antonio J. Doblas Viso. Universidad de Malaga. |
---|
19 | #@date 2011-11-22 |
---|
20 | #@version 1.0.3 - Configura el chkdisk en el arranque de windows, segun variable OGWINCHKDISK del engine.cfg. |
---|
21 | #@author Antonio J. Doblas Viso. Universidad de Malaga. |
---|
22 | #@date 2011-12-23 |
---|
23 | #@version 1.0.4 - Inyecta el cliente para gestión del sistema operativo. |
---|
24 | #@author Ramon Gomez, ETSII Universidad de Sevilla |
---|
25 | #@date 2012-04-11 |
---|
26 | |
---|
27 | # Carga el configurador del engine y los parámetros de red. |
---|
28 | [ -z $OGENGINECONFIGURATE ] && source /opt/opengnsys/etc/engine.cfg |
---|
29 | [ -f $DEVICECFG ] && source $DEVICECFG |
---|
30 | |
---|
31 | # Si el sistema de archivos no esta extendido, ampliarlo al tamaño de su partición. |
---|
32 | PARTSIZE=$(ogGetPartitionSize $1 $2) || exit $? |
---|
33 | FSSIZE=$(ogGetFsSize $1 $2) |
---|
34 | if [ $FSSIZE -lt $PARTSIZE ]; then |
---|
35 | echo "Extender sistema de archivos." |
---|
36 | ogExtendFs $1 $2 |
---|
37 | fi |
---|
38 | |
---|
39 | # Si no existe partición activa, activar este sistema. |
---|
40 | FLAGACTIVE=$(ogGetPartitionActive $1) |
---|
41 | [ -z $FLAGACTIVE ] && ogSetPartitionActive $1 $2 |
---|
42 | |
---|
43 | # Post-configuración personalizada para cada tipo de sistema operativo. |
---|
44 | OSTYPE="$(ogGetOsType $1 $2)" |
---|
45 | case "$OSTYPE" in |
---|
46 | Windows) |
---|
47 | # Cambiar nombre en sistemas Windows. |
---|
48 | HOST=$(ogGetHostname) |
---|
49 | HOST=${HOST:-"pc"} |
---|
50 | ogSetWindowsName $1 $2 "$HOST" |
---|
51 | # Descomentar la siguiente línea para cambiar usuario de inicio. |
---|
52 | #ogSetWinlogonUser $1 $2 " " |
---|
53 | # Configurar el boot sector de la partición Windows. |
---|
54 | ogFixBootSector $1 $2 |
---|
55 | # Configurar el gestor de arranque de Windows XP/Vista/7. |
---|
56 | ogWindowsBootParameters $1 $2 |
---|
57 | # Registrar en Windows que la partición indicada es su nueva unidad C:\ |
---|
58 | ogWindowsRegisterPartition $1 $2 C $1 $2 |
---|
59 | #ogLoadHiveWindows $1 $2; ogSetWindowsChkdisk $OGWINCHKDISK; ogUpdateHiveWindows |
---|
60 | # Instalar cliente para Windows (no activar en sistema en produccion ver ticket 604). |
---|
61 | #ogInstallMiniSetup $1 $2 postconf.cmd |
---|
62 | #ogInstallWindowsClient $1 $2 postconf.cmd |
---|
63 | ;; |
---|
64 | Linux) |
---|
65 | ## Install and Configure Grub based on OS installed and Grub 1st stage location. |
---|
66 | ogGrubInstallPartition $1 $2 |
---|
67 | # Instalar cliente para Linux. |
---|
68 | ogInstallLinuxClient $1 $2 |
---|
69 | ;; |
---|
70 | esac |
---|
71 | |
---|