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 | #**/ |
---|
10 | # CONFIGURAR: Partición de datos de Windows que no queremos ocultar |
---|
11 | PARTDATA=0 |
---|
12 | |
---|
13 | PROG="$(basename $0)" |
---|
14 | # Control de errores |
---|
15 | if [ $# -lt 2 ]; then |
---|
16 | ogRaiseError $OG_ERR_FORMAT "Formato: $PROG ndisco nparticion" |
---|
17 | exit $? |
---|
18 | fi |
---|
19 | |
---|
20 | # Parámetros obligatorios. |
---|
21 | DISK="$1" # Nº de disco. |
---|
22 | PART="$2" # Nº de partición. |
---|
23 | |
---|
24 | # Paso 0: Añadir código para realizar control de errores de los parámetros de entrada (recomendado). |
---|
25 | |
---|
26 | # Paso 1: Adaptar el código de ejemplo para postconfiguración personalizada. |
---|
27 | # 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. |
---|
28 | |
---|
29 | |
---|
30 | MNTDIR=$(ogMount $DISK $PART) |
---|
31 | OSTYPE=$(ogGetOsType $DISK $PART) |
---|
32 | case "$OSTYPE" in |
---|
33 | Windows) |
---|
34 | ## Mostrar las particiones NTFS de sistema y datos y ocultamos las demás. |
---|
35 | #echo "[65] Activar particion de Windows $PART y ocultar las demás." |
---|
36 | #for (( i=1; i<=$(ogGetPartitionsNumber $DISK); i++ )); do |
---|
37 | # if [ $i == $PART -o $i == $PARTDATA ]; then |
---|
38 | # [ $(ogGetPartitionType $DISK $PART) == "HNTFS" ] && ogUnhidePartition $1 $PART |
---|
39 | # # Activo la particion si no es de datos |
---|
40 | # [ $i -ne $PARTDATA ] && ogSetPartitionActive $DISK $i |
---|
41 | # else |
---|
42 | # [ "$(ogGetPartitionType $DISK $i)" == NTFS ] && ogHidePartition $DISK $i |
---|
43 | # fi |
---|
44 | #done |
---|
45 | ;; |
---|
46 | Linux) |
---|
47 | ## Cambiar claves usuarios, copiando fichero /etc/passwd |
---|
48 | ## En el servidor el nuevo fichero debe situarse en el directorio del grupo: |
---|
49 | ## /opt/opengnsys/images/groups/nombre_aula |
---|
50 | #if [ -r $(ogGetGroupDir)/passwd ]; then |
---|
51 | # echo "[65] Cambiar claves de usuarios." |
---|
52 | # cp $(ogGetGroupDir)/passwd $MNTDIR/etc |
---|
53 | #fi |
---|
54 | ;; |
---|
55 | esac |
---|