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
Line | |
---|
1 | #!/bin/bash |
---|
2 | # Scirpt de ejemplo para arancar un sistema operativo instalado. |
---|
3 | # (puede usarse como base para el programa de arranque usado por OpenGNSys Admin). |
---|
4 | |
---|
5 | PROG="$(basename $0)" |
---|
6 | if [ $# -ne 2 ]; then |
---|
7 | ogRaiseError $OG_ERR_FORMAT "Formato: $PROG ndisco nparticion" |
---|
8 | exit $? |
---|
9 | fi |
---|
10 | |
---|
11 | # Iniciación de porcentaje de la barra de progreso del Browser. |
---|
12 | echo "[0] Inicio del proceso de arranque." |
---|
13 | |
---|
14 | # Procesos previos. |
---|
15 | PART=$(ogDiskToDev "$1" "$2") || exit $? |
---|
16 | NAME=$(ogGetHostname) |
---|
17 | NAME=${NAME:-"pc"} |
---|
18 | |
---|
19 | # Arrancar. |
---|
20 | echo "[5] Desmontar todos los sistemas operativos del disco." |
---|
21 | ogUnmountAll $1 2>/dev/null | exit $? |
---|
22 | case "$(ogGetOsType $1 $2)" in |
---|
23 | Windows) |
---|
24 | echo "20 Activar partición de Windows $PART." |
---|
25 | ogSetPartitionActive $1 $2 |
---|
26 | ogEcho info "$PROG: Comprobar sistema de archivos." |
---|
27 | ogCheckFs $1 $2 |
---|
28 | NAME=$(ogGetHostname) |
---|
29 | echo "[30] Asignar nombre Windows \"$NAME\"." |
---|
30 | ogSetWindowsName $1 $2 "$NAME" |
---|
31 | ;; |
---|
32 | Linux) |
---|
33 | echo "[20] 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 | echo "[30] Actaualizar fstab con partición raíz \"$PART\"." |
---|
38 | awk -v P="$PART " '{ if ($2=="/") {sub(/^.*$/, P, $1)} |
---|
39 | print } ' $ETC/fstab >/tmp/fstab |
---|
40 | mv /tmp/fstab $ETC/fstab |
---|
41 | fi |
---|
42 | ;; |
---|
43 | esac |
---|
44 | echo "[90] Arrancar sistema operativo." |
---|
45 | ogBoot $1 $2 |
---|
46 | |
---|
Note: See
TracBrowser
for help on using the repository browser.