[f3850507] | 1 | #!/bin/bash |
---|
| 2 | |
---|
[7ee2d1a] | 3 | #/** |
---|
| 4 | # configureOS |
---|
| 5 | #@brief Scirpt de ejemplo para realizar la configuracion del sistema operativo restaurado. |
---|
| 6 | #@brief (puede usarse como base para el programa de creación de imágenes usado por OpenGnSys Admin). |
---|
| 7 | #@param 1 disco |
---|
| 8 | #@param 2 particion |
---|
| 9 | #@return |
---|
| 10 | #@TODO comprobar que el tipo de particion corresponde con el sistema de archivos. |
---|
| 11 | #@exception OG_ERR_FORMAT # 1 formato incorrecto. |
---|
| 12 | #@version 1.0.1 - Integracion cambio de nombre, extender fs, chequear particion activa |
---|
| 13 | #@author |
---|
| 14 | #@date 2011-05-11 |
---|
[78b5dfe7] | 15 | #@version 1.0.1 - Configura el sector de la particion y el gestor de windows para iniciarse desde cualquier particion. |
---|
| 16 | #@author Antonio J. Doblas Viso. Universidad de Malaga. |
---|
| 17 | #@date 2011-05-20 |
---|
[ab82469] | 18 | #@version 1.0.2 - Configura el sector de la particion y el gestor de linux para iniciarse desde cualquier particion. |
---|
| 19 | #@author Antonio J. Doblas Viso. Universidad de Malaga. |
---|
| 20 | #@date 2011-11-22 |
---|
[78b5dfe7] | 21 | |
---|
[7ee2d1a] | 22 | |
---|
| 23 | |
---|
| 24 | # Si el sistema de archivos no esta extendido. Realizar. |
---|
[f3850507] | 25 | PARTSIZE=$(ogGetPartitionSize $1 $2) |
---|
| 26 | FSSIZE=$(ogGetFsSize $1 $2) |
---|
| 27 | if [ $FSSIZE -lt $PARTSIZE ]; then |
---|
| 28 | echo "Extender sistema de archivos." |
---|
| 29 | ogExtendFs $1 $2 |
---|
| 30 | fi |
---|
| 31 | |
---|
[7ee2d1a] | 32 | #Si no existe particion activa, activar este sistema. |
---|
| 33 | FLAGACTIVE=$(ogGetPartitionActive $1) |
---|
| 34 | [ -z $FLAGACTIVE ] && ogSetPartitionActive $1 $2 |
---|
| 35 | |
---|
[f3850507] | 36 | # Cambiar nombre en sistemas Windows y quitar usuario de acceso por defecto. |
---|
| 37 | if [ "$(ogGetOsType $1 $2)" = "Windows" ]; then |
---|
[b0ff94d] | 38 | # Cambiar nombre en sistemas Windows. |
---|
[f3850507] | 39 | HOST=$(ogGetHostname) |
---|
| 40 | HOST=${HOST:-"pc"} |
---|
| 41 | ogSetWindowsName $1 $2 "$HOST" |
---|
[b0ff94d] | 42 | # Descomentar la siguiente línea para cambiar usuario de inicio. |
---|
| 43 | #ogSetWinlogonUser $1 $2 " " |
---|
| 44 | # Configurar el boot sector de la partición Windows. |
---|
| 45 | ogFixBootSector $1 $2 |
---|
| 46 | # Configurar el gestor de arranque de Windows XP/Vista/7. |
---|
[78b5dfe7] | 47 | ogWindowsBootParameters $1 $2 |
---|
[b0ff94d] | 48 | # Registrar en Windows que la partición indicada es su nueva unidad C:\ |
---|
[78b5dfe7] | 49 | ogWindowsRegisterPartition $1 $2 C $1 $2 |
---|
[b0ff94d] | 50 | fi |
---|
| 51 | |
---|
[ab82469] | 52 | if [ "$(ogGetOsType $1 $2)" = "Linux" ]; then |
---|
| 53 | ogGrubInstallPartition $1 $2 |
---|
| 54 | fi |
---|