source: client/shared/scripts/bootOs @ 18391d1

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 18391d1 was 6963f42, checked in by irina <irinagomez@…>, 8 years ago

#773 Se corrige bootOs para que llame al script bootOsCustom.template. bootOsCustom.template: El código personalizado se muestra comentado y con una descripción de lo que hace.

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

  • Property mode set to 100755
File size: 1.9 KB
Line 
1#!/bin/bash
2# Script de ejemplo para arancar un sistema operativo instalado.
3# (puede usarse como base para el programa de arranque usado por OpenGNSys Admin).
4
5PROG="$(basename $0)"
6if [ $# -lt 2 -o $# -gt 3 ]; then
7    ogRaiseError $OG_ERR_FORMAT "Formato: $PROG ndisco nfilesys [str_kernel str_initrd str_kernelparams]"
8    exit $?
9fi
10
11# Comprobar errores.
12PART=$(ogDiskToDev "$1" "$2") || exit $?
13ogMount $1 $2  &>/dev/null || exit $?
14
15echo "[0] Inicio del proceso de arranque."
16NAME="$(ogGetHostname)"
17NAME=${NAME:-"pc"}
18OSTYPE=$(ogGetOsType $1 $2)
19# Borrar marcas de arrranque de todos los Windows instalados en el disco.
20if [ "$OSTYPE" == "Windows" ]; then
21    for (( i=1; i<=$(ogGetPartitionsNumber $1); i++ )); do
22        [ "$(ogGetOsType $1 $i)" == "Windows" ] && ogMount $1 $i &>/dev/null
23    done
24    rm -f /mnt/*/ogboot.*
25fi
26
27case "$OSTYPE" in
28    Windows)
29        echo "[30] Mostrar y activar particion de Windows $PART."
30        [ $(ogGetPartitionType $1 $2) == "HNTFS" ] && ogUnhidePartition $1 $2
31        ;;
32    Linux)
33        echo "[30] Asignar nombre Linux \"$NAME\"."
34        ETC=$(ogGetPath $1 $2 /etc)
35        [ -d "$ETC" ] && echo "$NAME" >$ETC/hostname 2>/dev/null
36        if [ -f "$ETC/fstab" ]; then
37            # Sustituir UUID o LABEL por su dispositivo en definición de sistema de archivo raíz.
38            echo "[50] Actualizar fstab con particion raiz \"$PART\"."
39            awk -v P="$PART " '{ if ($2=="/" && $1!~/^#/) {sub(/^.*$/, P, $1)}
40                                 print }' $ETC/fstab >/tmp/fstab
41            mv /tmp/fstab $ETC/fstab
42        fi
43        ;;
44esac
45
46if which bootOsCustom  &>/dev/null; then
47    echo "[60] Configuración personalizada del inicio."
48    bootOsCustom $@
49fi
50
51echo "[70] Desmontar todos los sistemas de archivos."
52sync
53for (( i=1; i <= $(ogDiskToDev | wc -w); i++ )); do
54    ogUnmountAll $i &>/dev/null
55done
56echo "[80] Desmontar cache local."
57ogUnmountCache
58echo "[90] Arrancar sistema operativo."
59ogBoot "$@"
Note: See TracBrowser for help on using the repository browser.