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
Rev | Line | |
---|
[f5432db7] | 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 | # Procesos previos. |
---|
[c7d9af7] | 12 | PART=$(ogDiskToDev "$1" "$2") || exit $? |
---|
| 13 | NAME=$(ogGetHostname) |
---|
| 14 | NAME=${NAME:-"pc"} |
---|
[f5432db7] | 15 | |
---|
| 16 | # Arrancar. |
---|
[d42638a] | 17 | ogEcho info "$PROG: Desmontar todos los sistemas operativos del disco." |
---|
[3458879] | 18 | ogUnmountAll $1 | exit $? |
---|
[c7d9af7] | 19 | case "$(ogGetOsType $1 $2)" in |
---|
| 20 | Windows) |
---|
| 21 | ogEcho info "$PROG: Activar partición de Windows $PART." |
---|
| 22 | ogSetPartitionActive $1 $2 |
---|
| 23 | ogEcho info "$PROG: Comprobar sistema de archivos." |
---|
| 24 | ogCheckFs $1 $2 |
---|
| 25 | NAME=$(ogGetHostname) |
---|
| 26 | ogEcho info "$PROG: Asignar nombre Windows \"$NAME\"." |
---|
| 27 | ogSetWindowsName $1 $2 "$NAME" |
---|
| 28 | ;; |
---|
| 29 | Linux) |
---|
| 30 | ogEcho info "$PROG: Asignar nombre Linux \"$NAME\"." |
---|
| 31 | ETC=$(ogGetPath $1 $2 /etc) |
---|
| 32 | [ -d "$ETC" ] && echo "$NAME" >$ETC/hostname 2>/dev/null |
---|
| 33 | if [ -f "$ETC/fstab" ]; then |
---|
| 34 | ogEcho info "$PROG: Actaualizar fstab con partición raíz \"$PART\"." |
---|
| 35 | awk -v P="$PART " '{ if ($2=="/") {sub(/^.*$/, P, $1)} |
---|
| 36 | print } ' $ETC/fstab >/tmp/fstab |
---|
| 37 | mv /tmp/fstab $ETC/fstab |
---|
| 38 | fi |
---|
| 39 | ;; |
---|
| 40 | esac |
---|
[f5432db7] | 41 | ogEcho info "$PROG: Arrancar sistema operativo." |
---|
[3458879] | 42 | ogBoot $1 $2 |
---|
[f5432db7] | 43 | |
---|
Note: See
TracBrowser
for help on using the repository browser.