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 | echo "[0] Inicio del proceso de arranque." |
---|
[c7d9af7] | 12 | PART=$(ogDiskToDev "$1" "$2") || exit $? |
---|
[b0ff94d] | 13 | NAME="$(ogGetHostname)" |
---|
[c7d9af7] | 14 | NAME=${NAME:-"pc"} |
---|
[199bdf3] | 15 | OSTYPE=$(ogGetOsType $1 $2) |
---|
[c671867] | 16 | # Borrar marcas de arrranque de todos los Windows instalados en el disco. |
---|
| 17 | if [ "$OSTYPE" == "Windows" ]; then |
---|
| 18 | for (( i=1; i<=$(ogGetPartitionsNumber $1); i++ )); do |
---|
| 19 | [ "$(ogGetOsType $1 $i)" == "Windows" ] && ogMount $1 $i &>/dev/null |
---|
| 20 | done |
---|
| 21 | rm -f /mnt/*/ogboot.* |
---|
| 22 | fi |
---|
[f5432db7] | 23 | |
---|
[36a4dfd] | 24 | echo "[10] Desmontar todos los sistemas de archivos." |
---|
| 25 | sync |
---|
| 26 | for (( i=1; i <= $(ogDiskToDev | wc -w); i++ )); do |
---|
| 27 | ogUnmountAll $i 2>/dev/null |
---|
| 28 | done |
---|
[199bdf3] | 29 | case "$OSTYPE" in |
---|
[c7d9af7] | 30 | Windows) |
---|
[3c75eba] | 31 | echo "[30] Mostrar y activar particion de Windows $PART." |
---|
| 32 | [ $(ogGetPartitionType $1 $2) == "HNTFS" ] && ogUnhidePartition $1 $2 |
---|
[c7d9af7] | 33 | ogSetPartitionActive $1 $2 |
---|
[4b9cdda] | 34 | echo "[50] Asignar nombre Windows \"$NAME\" y usuario por defecto." |
---|
[c7d9af7] | 35 | ogSetWindowsName $1 $2 "$NAME" |
---|
| 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 |
---|
[bfeb89a] | 42 | echo "[50] Actaualizar fstab con particion raiz \"$PART\"." |
---|
[c7d9af7] | 43 | awk -v P="$PART " '{ if ($2=="/") {sub(/^.*$/, P, $1)} |
---|
| 44 | print } ' $ETC/fstab >/tmp/fstab |
---|
| 45 | mv /tmp/fstab $ETC/fstab |
---|
| 46 | fi |
---|
| 47 | ;; |
---|
| 48 | esac |
---|
[bfeb89a] | 49 | echo "[70] Desmontar cache local." |
---|
| 50 | ogUnmountCache |
---|
[180a07dd] | 51 | echo "[90] Arrancar sistema operativo." |
---|
[3458879] | 52 | ogBoot $1 $2 |
---|
[f5432db7] | 53 | |
---|
Note: See
TracBrowser
for help on using the repository browser.