close
Warning:
Failed to sync with repository "ogBrowser-Git": (1366, "Incorrect string value: '\\xF0\\x9F\\x93\\xA6 I...' for column 'message' at row 1"); repository information may be out of date. Look in the Trac log for more information including mitigation strategies.
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 | |
|---|
| [4dd4e42] | 11 | # Comprobar errores. |
|---|
| [c7d9af7] | 12 | PART=$(ogDiskToDev "$1" "$2") || exit $? |
|---|
| [4dd4e42] | 13 | ogMount $1 $2 || exit $? |
|---|
| 14 | |
|---|
| 15 | echo "[0] Inicio del proceso de arranque." |
|---|
| [b0ff94d] | 16 | NAME="$(ogGetHostname)" |
|---|
| [c7d9af7] | 17 | NAME=${NAME:-"pc"} |
|---|
| [199bdf3] | 18 | OSTYPE=$(ogGetOsType $1 $2) |
|---|
| [c671867] | 19 | # Borrar marcas de arrranque de todos los Windows instalados en el disco. |
|---|
| 20 | if [ "$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.* |
|---|
| 25 | fi |
|---|
| [f5432db7] | 26 | |
|---|
| [36a4dfd] | 27 | echo "[10] Desmontar todos los sistemas de archivos." |
|---|
| [4085f13] | 28 | sync |
|---|
| [36a4dfd] | 29 | for (( i=1; i <= $(ogDiskToDev | wc -w); i++ )); do |
|---|
| [4085f13] | 30 | ogUnmountAll $i &>/dev/null |
|---|
| [36a4dfd] | 31 | done |
|---|
| [199bdf3] | 32 | case "$OSTYPE" in |
|---|
| [c7d9af7] | 33 | Windows) |
|---|
| [3c75eba] | 34 | echo "[30] Mostrar y activar particion de Windows $PART." |
|---|
| 35 | [ $(ogGetPartitionType $1 $2) == "HNTFS" ] && ogUnhidePartition $1 $2 |
|---|
| [c7d9af7] | 36 | ;; |
|---|
| 37 | Linux) |
|---|
| [36a4dfd] | 38 | echo "[30] Asignar nombre Linux \"$NAME\"." |
|---|
| [c7d9af7] | 39 | ETC=$(ogGetPath $1 $2 /etc) |
|---|
| 40 | [ -d "$ETC" ] && echo "$NAME" >$ETC/hostname 2>/dev/null |
|---|
| 41 | if [ -f "$ETC/fstab" ]; then |
|---|
| [5b06270] | 42 | # Sustituir UUID o LABEL por su dispositivo en definición de sistema de archivo raíz. |
|---|
| [bfeb89a] | 43 | echo "[50] Actaualizar fstab con particion raiz \"$PART\"." |
|---|
| [5b06270] | 44 | awk -v P="$PART " '{ if ($2=="/" && $1!~/^#/) {sub(/^.*$/, P, $1)} |
|---|
| 45 | print }' $ETC/fstab >/tmp/fstab |
|---|
| [c7d9af7] | 46 | mv /tmp/fstab $ETC/fstab |
|---|
| 47 | fi |
|---|
| 48 | ;; |
|---|
| 49 | esac |
|---|
| [bfeb89a] | 50 | echo "[70] Desmontar cache local." |
|---|
| 51 | ogUnmountCache |
|---|
| [180a07dd] | 52 | echo "[90] Arrancar sistema operativo." |
|---|
| [3458879] | 53 | ogBoot $1 $2 |
|---|
| [f5432db7] | 54 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.