source: client/shared/scripts/bootOsCustom.template @ 391f9be

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-instalacion
Last change on this file since 391f9be was b96fd67, checked in by Irina Gómez <irinagomez@…>, 6 years ago

bootOsCustom.template: supports several disk and one data partition.

  • Property mode set to 100755
File size: 3.9 KB
Line 
1#!/bin/bash
2#/**
3#         bootOsCustom
4#@brief   Plantilla para script de configuración personalizada de sistema operativo restaurado.
5#@param   $1 nº de disco
6#@param   $2 nº de partición
7#@warning Renombrar este fichero como "bootOsCustom" para personalizar el script estándar "bootOs".
8#@note    La partición a inicializar debe estar montada
9#@version 1.1.1 Soporta varios discos
10#@date    2019/08/26
11#**/
12# CONFIGURAR: Partición de datos de Windows que no queremos ocultar (valor por defecto '0' no oculta nada)
13DISKDATA=0
14PARTDATA=0
15
16PROG="$(basename $0)"
17# Control de errores
18if [ $# -lt 2 ]; then
19    ogRaiseError $OG_ERR_FORMAT "Formato: $PROG ndisco nparticion"
20    exit $?
21fi
22
23# Parámetros obligatorios.
24DISK="$1"               # Nº de disco.
25PART="$2"               # Nº de partición.
26
27# Paso 0: Añadir código para realizar control de errores de los parámetros de entrada (recomendado).
28DEVICE=$(ogDiskToDev "$DISK" "$PART") || exit $?
29
30# Paso 1: Adaptar el código de ejemplo para arranque personalizado.
31# Nota: el script "bootOs" llama al script "bootOsCustom" después de realizar la operaciones de inicio estándar y antes de desmontar las particiones e iniciar el sistema operativo.
32
33
34MNTDIR=$(ogMount $DISK $PART) || exit $?
35NAME="$(ogGetHostname)"
36NAME=${NAME:-"pc"}
37OSTYPE=$(ogGetOsType $DISK $PART)
38
39case "$OSTYPE" in
40    Windows)
41        ## Mostrar las particiones NTFS de sistema (dos opciones)
42        ## Opción 1: SIN ocultar las demás.
43        #ogEcho log session "[40] Mostrar y activar particion de Windows $PART."
44        #[ $(ogGetPartitionType $DISK $PART) == "HNTFS" -o $(ogGetPartitionType $DISK $PART) == "WIN-RESERV" ] && ogUnhidePartition $DISK $PART
45
46        ## Recorremos los distintos discos
47        #for DEVICE in $(ogDiskToDev); do
48        #    d=$(ogDevToDisk $DEVICE)
49
50        #    ## Mostrar las particiones NTFS de sistema (dos opciones)
51        #    ## Opción 2: Ocultamos las demás.
52        #    ogEcho log session "[40] Activar particion de Windows $PART y ocultar las demás."
53        #    for (( i=1; i<=$(ogGetPartitionsNumber $d); i++ )); do
54        #        if [ $d == $DISK -a $i == $PART ] || [ $d == $DISKDATA -a $i == $PARTDATA ]; then
55        #           [ $(ogGetPartitionType $d $i) == "HNTFS" -o $(ogGetPartitionType $d $i) == "WIN-RESERV" ] && ogUnhidePartition $d $i
56        #        else
57        #            [ "$(ogGetPartitionType $d $i)" == NTFS -o "$(ogGetPartitionType $d $i)" == "WINDOWS" ] && ogHidePartition $d $i
58        #        fi
59        #    done
60
61        #    ## Borrar marcas de arrranque de todos los Windows instalados en el disco.
62        #    ogEcho log session "[30] Borrar marcas de arrranque de todos los Windows instalados en el disco."
63        #    for (( i=1; i<=$(ogGetPartitionsNumber $d); i++ )); do
64        #        [ "$(ogGetOsType $d $i)" == "Windows" ] && ogMount $d $i &>/dev/null
65        #    done
66        #    rm -f /mnt/*/ogboot.*
67
68        #done
69    ;;
70    Linux)
71        ## Modificar el nombre del equipo
72        #ogEcho log session "[30] Asignar nombre Linux \"$NAME\"."
73        #ETC=$(ogGetPath $DISK $PART /etc)
74        #[ -d "$ETC" ] && echo "$NAME" >$ETC/hostname 2>/dev/null
75
76        ## Sustituir UUID o LABEL por su dispositivo en definición de sistema de archivo raíz.
77        #if [ -f "$ETC/fstab" ]; then
78        #    ogEcho log session "[40] Actualizar fstab con particion raíz \"$PART\"."
79        #    awk -v P="$PART " '{ if ($2=="/" && $1!~/^#/) {sub(/^.*$/, P, $1)}
80        #                         print }' $ETC/fstab >/tmp/fstab
81        #    mv /tmp/fstab $ETC/fstab
82        #fi
83
84        ## Cambiar claves usuarios, copiando fichero /etc/passwd
85        ## En el servidor el nuevo fichero debe situarse en el directorio del grupo:
86        ##    /opt/opengnsys/images/groups/nombre_aula
87        #if [ -r $(ogGetGroupDir)/passwd ]; then
88        #    ogEcho log session "[65] Cambiar claves de usuarios."
89        #    cp $(ogGetGroupDir)/passwd $MNTDIR/etc
90        #fi
91    ;;
92esac
Note: See TracBrowser for help on using the repository browser.