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 | |
---|
[180a07dd] | 11 | # Iniciación de porcentaje de la barra de progreso del Browser. |
---|
| 12 | echo "[0] Inicio del proceso de arranque." |
---|
| 13 | |
---|
[f5432db7] | 14 | # Procesos previos. |
---|
[c7d9af7] | 15 | PART=$(ogDiskToDev "$1" "$2") || exit $? |
---|
| 16 | NAME=$(ogGetHostname) |
---|
| 17 | NAME=${NAME:-"pc"} |
---|
[f5432db7] | 18 | |
---|
| 19 | # Arrancar. |
---|
[36a4dfd] | 20 | echo "[10] Desmontar todos los sistemas de archivos." |
---|
| 21 | sync |
---|
| 22 | for (( i=1; i <= $(ogDiskToDev | wc -w); i++ )); do |
---|
| 23 | ogUnmountAll $i 2>/dev/null |
---|
| 24 | done |
---|
| 25 | echo "[20] Desmontar cache local." |
---|
| 26 | ogUnmountCache |
---|
[c7d9af7] | 27 | case "$(ogGetOsType $1 $2)" in |
---|
| 28 | Windows) |
---|
[36a4dfd] | 29 | echo "30 Activar partición de Windows $PART." |
---|
[c7d9af7] | 30 | ogSetPartitionActive $1 $2 |
---|
[36a4dfd] | 31 | echo "40 Comprobar sistema de archivos." |
---|
[c7d9af7] | 32 | ogCheckFs $1 $2 |
---|
| 33 | NAME=$(ogGetHostname) |
---|
[4b9cdda] | 34 | echo "[50] Asignar nombre Windows \"$NAME\" y usuario por defecto." |
---|
[c7d9af7] | 35 | ogSetWindowsName $1 $2 "$NAME" |
---|
[4b9cdda] | 36 | ogSetWinlogonUser $1 $2 " " |
---|
[c7d9af7] | 37 | ;; |
---|
| 38 | Linux) |
---|
[36a4dfd] | 39 | echo "[30] Asignar nombre Linux \"$NAME\"." |
---|
[c7d9af7] | 40 | ETC=$(ogGetPath $1 $2 /etc) |
---|
| 41 | [ -d "$ETC" ] && echo "$NAME" >$ETC/hostname 2>/dev/null |
---|
| 42 | if [ -f "$ETC/fstab" ]; then |
---|
[36a4dfd] | 43 | echo "[50] Actaualizar fstab con partición raíz \"$PART\"." |
---|
[c7d9af7] | 44 | awk -v P="$PART " '{ if ($2=="/") {sub(/^.*$/, P, $1)} |
---|
| 45 | print } ' $ETC/fstab >/tmp/fstab |
---|
| 46 | mv /tmp/fstab $ETC/fstab |
---|
| 47 | fi |
---|
| 48 | ;; |
---|
| 49 | esac |
---|
[180a07dd] | 50 | echo "[90] Arrancar sistema operativo." |
---|
[3458879] | 51 | ogBoot $1 $2 |
---|
[f5432db7] | 52 | |
---|
Note: See
TracBrowser
for help on using the repository browser.