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
RevLine 
[f5432db7]1#!/bin/bash
[6963f42]2# Script de ejemplo para arancar un sistema operativo instalado.
[f5432db7]3# (puede usarse como base para el programa de arranque usado por OpenGNSys Admin).
4
5PROG="$(basename $0)"
[5359439]6if [ $# -lt 2 -o $# -gt 3 ]; then
[dc4eac6]7    ogRaiseError $OG_ERR_FORMAT "Formato: $PROG ndisco nfilesys [str_kernel str_initrd str_kernelparams]"
[f5432db7]8    exit $?
9fi
10
[4dd4e42]11# Comprobar errores.
[c7d9af7]12PART=$(ogDiskToDev "$1" "$2") || exit $?
[6963f42]13ogMount $1 $2  &>/dev/null || exit $?
[4dd4e42]14
15echo "[0] Inicio del proceso de arranque."
[b0ff94d]16NAME="$(ogGetHostname)"
[c7d9af7]17NAME=${NAME:-"pc"}
[199bdf3]18OSTYPE=$(ogGetOsType $1 $2)
[c671867]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
[f5432db7]26
[199bdf3]27case "$OSTYPE" in
[c7d9af7]28    Windows)
[3c75eba]29        echo "[30] Mostrar y activar particion de Windows $PART."
30        [ $(ogGetPartitionType $1 $2) == "HNTFS" ] && ogUnhidePartition $1 $2
[c7d9af7]31        ;;
32    Linux)
[36a4dfd]33        echo "[30] Asignar nombre Linux \"$NAME\"."
[c7d9af7]34        ETC=$(ogGetPath $1 $2 /etc)
35        [ -d "$ETC" ] && echo "$NAME" >$ETC/hostname 2>/dev/null
36        if [ -f "$ETC/fstab" ]; then
[5b06270]37            # Sustituir UUID o LABEL por su dispositivo en definición de sistema de archivo raíz.
[6963f42]38            echo "[50] Actualizar fstab con particion raiz \"$PART\"."
[5b06270]39            awk -v P="$PART " '{ if ($2=="/" && $1!~/^#/) {sub(/^.*$/, P, $1)}
40                                 print }' $ETC/fstab >/tmp/fstab
[c7d9af7]41            mv /tmp/fstab $ETC/fstab
42        fi
43        ;;
44esac
[6963f42]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."
[bfeb89a]57ogUnmountCache
[180a07dd]58echo "[90] Arrancar sistema operativo."
[6963f42]59ogBoot "$@"
Note: See TracBrowser for help on using the repository browser.