source: client/engine/Boot.lib @ cd95622

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
Last change on this file since cd95622 was 6439d55, checked in by irina <irinagomez@…>, 14 years ago

Boot.lib: seguimiento inicio sesión para Windows en general, no sólo XP

git-svn-id: https://opengnsys.es/svn/branches/version1.0@2132 a21b9725-9963-47de-94b9-378ad31fedc9

  • Property mode set to 100755
File size: 18.3 KB
Line 
1#!/bin/bash
2#/**
3#@file    Boot.lib
4#@brief   Librería o clase Boot
5#@class   Boot
6#@brief   Funciones para arranque y post-configuración de sistemas de archivos.
7#@version 0.9
8#@warning License: GNU GPLv3+
9#*/
10
11
12#/**
13#         ogBoot int_ndisk int_npartition
14#@brief   Inicia el proceso de arranque de un sistema de archivos.
15#@param   int_ndisk      nº de orden del disco
16#@param   int_npartition nº de orden de la partición
17#@return  (activar el sistema de archivos).
18#@exception OG_ERR_FORMAT    Formato incorrecto.
19#@exception OG_ERR_NOTFOUND  Disco o particion no corresponden con un dispositivo.
20#@exception OG_ERR_PARTITION Tipo de partición desconocido o no se puede montar.
21#@exception OG_ERR_NOTOS     La partición no tiene instalado un sistema operativo.
22#@note    En Linux, debe arrancarse la partición del directorio \c /boot
23#@version 0.1 - Integracion para OpenGNSys. - EAC: HDboot(); BootLinuxEX() en Boot.lib 
24#@author  Antonio J. Doblas Viso, Universidad de Malaga
25#@date    2008-10-27
26#@version 0.9 - Adaptacion para OpenGNSys.
27#@author  Ramon Gomez, ETSII Universidad de Sevilla
28#@date    2009-09-11
29#*/ ##
30function ogBoot ()
31{
32# Variables locales.
33local PART TYPE MNTDIR PARAMS KERNEL INITRD APPEND FILE LOADER
34
35# Si se solicita, mostrar ayuda.
36if [ "$*" == "help" ]; then
37    ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_npartition" \
38           "$FUNCNAME 1 1"
39    return
40fi
41# Error si no se reciben 2 parámetros.
42[ $# == 2 ] || ogRaiseError $OG_ERR_FORMAT || return $?
43
44# Detectar tipo de sistema de archivos y montarlo.
45PART=$(ogDiskToDev $1 $2) || return $?
46TYPE=$(ogGetFsType $1 $2) || return $?
47MNTDIR=$(ogMount $1 $2) 2>/dev/null
48[ -z "$MNTDIR" ] && ogRaiseError OG_ERR_PARTITION "$1, $2" && return $?
49
50case "$TYPE" in
51    EXT[234]|REISERFS|REISER4|JFS|XFS)
52        # Obtiene los parámetros de arranque para Linux.
53        PARAMS=$(ogLinuxBootParameters $1 $2) || return $?
54        read -e KERNEL INITRD APPEND <<<"$PARAMS"
55        # Si no hay kernel, no hay sistema operativo.
56        [ -z "$KERNEL" ] && ogRaiseError $OG_ERR_NOTOS && return $?
57        # Arrancar de partición distinta a la original.
58        [ -e "$MNTDIR/etc" ] && APPEND=$(echo $APPEND | awk -v P="$PART " '{sub (/root=[-+=_/a-zA-Z0-9]* /,"root="P);print}')
59        # Configurar kernel Linux con los parámetros leídos de su GRUB.
60        kexec -l "${MNTDIR}${KERNEL}" --append="$APPEND" --initrd="${MNTDIR}${INITRD}"
61        ;;
62    NTFS|HNTFS|FAT32|HFAT32)
63        # Compruebar si hay un cargador de Windows.
64        for f in io.sys ntldr bootmgr; do
65            FILE="$(ogGetPath $1 $2 $f 2>/dev/null)"
66            [ -n "$FILE" ] && LOADER="$f"
67        done
68        [ -z "$LOADER" ] && ogRaiseError $OG_ERR_NOTOS && return $?
69        # Activar la partición y copiar Grub4DOS.
70        ogSetPartitionActive $1 $2
71        #FIXME: activar seguimiento inicio sesion Windows con grub4dos
72                #if `ogGetOsVersion $1 $2 | grep "Windows" > /dev/null`
73        #then
74        #       dd if=/dev/zero of=${MNTDIR}/ogboot.me  bs=1024 count=3
75        #       dd if=/dev/zero of=${MNTDIR}/ogboot.firstboot  bs=1024 count=3
76        #       dd if=/dev/zero of=${MNTDIR}/ogboot.secondboot  bs=1024 count=3         
77        #       ogLoadHiveWindows $1 $2
78                #       ogHiveNTRunMachine "cmd /c del c:\ogboot.* "  ogcleanboot
79                #       ogUpdateHiveWindows
80                #       reboot
81        #else       
82                cp $OGLIB/grub4dos/* $MNTDIR    # */ (Comentario Doxygen)
83                ##kexec -l $MNTDIR/grub.exe --append=--config-file="find --set-root /$LOADER; chainloader /$LOADER; tpm --init"
84                kexec -l $MNTDIR/grub.exe --append=--config-file="root (hd$[$1-1],$[$2-1]); chainloader (hd$[$1-1],$[$2-1])/$LOADER; tpm --init"
85                #fi
86        ;;
87    *)  ogRaiseError $OG_ERR_PARTITION "$1, $2"
88        return $?
89        ;;
90esac
91
92# Arrancar.
93kexec -e
94}
95
96
97#/**
98#         ogGetWindowsName int_ndisk int_npartition
99#@brief   Muestra el nombre del equipo en el registro de Windows.
100#@param   int_ndisk      nº de orden del disco
101#@param   int_npartition nº de orden de la partición
102#@return  str_name - nombre del equipo
103#@exception OG_ERR_FORMAT    Formato incorrecto.
104#@exception OG_ERR_NOTFOUND  Disco o particion no corresponden con un dispositivo.
105#@exception OG_ERR_PARTITION Tipo de partición desconocido o no se puede montar.
106#@version 0.9 - Adaptación para OpenGNSys.
107#@author  Ramon Gomez, ETSII Universidad de Sevilla
108#@date    2009-09-23
109#*/ ##
110function ogGetWindowsName ()
111{
112# Variables locales.
113local PART MNTDIR
114
115# Si se solicita, mostrar ayuda.
116if [ "$*" == "help" ]; then
117    ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_npartition" \
118           "$FUNCNAME 1 1  ==>  PRACTICA-PC"
119    return
120fi
121# Error si no se reciben 2 parámetros.
122[ $# == 2 ] || ogRaiseError $OG_ERR_FORMAT || return $?
123
124# Montar el sistema de archivos.
125MNTDIR=$(ogMount $1 $2) 2>/dev/null
126[ -z "$MNTDIR" ] && ogRaiseError OG_ERR_PARTITION "$1, $2" && return $?
127
128# Obtener dato del valor de registro.
129ogGetRegistryValue $MNTDIR system '\ControlSet001\Control\ComputerName\ComputerName\ComputerName'
130}
131
132
133#/**
134#         ogLinuxBootParameters int_ndisk int_npartition
135#@brief   Muestra los parámetros de arranque de un sistema de archivos Linux.
136#@param   int_ndisk      nº de orden del disco
137#@param   int_npartition nº de orden de la partición
138#@return  str_kernel str_initrd str_parameters ...
139#@exception OG_ERR_FORMAT    Formato incorrecto.
140#@exception OG_ERR_NOTFOUND  Disco o particion no corresponden con un dispositivo.
141#@exception OG_ERR_PARTITION Tipo de partición desconocido o no se puede montar.
142#@warning Función básica usada por \c ogBoot
143#@version 0.9 - Primera adaptación para OpenGNSys.
144#@author  Ramon Gomez, ETSII Universidad de Sevilla
145#@date    2009-09-11
146#@version 0.9.2 - Soporta partición /boot independiente.
147#@author  Ramon Gomez, ETSII Universidad de Sevilla
148#@date    2010-07-20
149#*/ ##
150function ogLinuxBootParameters ()
151{
152# Variables locales.
153local MNTDIR CONFDIR CONFFILE
154
155# Si se solicita, mostrar ayuda.
156if [ "$*" == "help" ]; then
157    ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_npartition" \
158           "$FUNCNAME 1 2  ==>  ..."
159    return
160fi
161# Error si no se reciben 2 parámetros.
162[ $# == 2 ] || ogRaiseError $OG_ERR_FORMAT || return $?
163
164# Detectar id. de tipo de partición y codificar al mnemonico.
165MNTDIR=$(ogMount $1 $2) 2>/dev/null
166[ -z "$MNTDIR" ] && ogRaiseError OG_ERR_PARTITION "$1, $2" && return $?
167
168# Fichero de configuración de GRUB.
169CONFDIR=$MNTDIR                               # Partición de arranque /boot.
170[ -d $MNTDIR/boot ] && CONFDIR=$MNTDIR/boot   # Partición raíz con directorio boot.
171CONFFILE="$CONFDIR/grub/menu.lst"
172[ ! -e $CONFFILE ] && CONFFILE="$CONFDIR/grub/grub.cfg"
173[ ! -e $CONFFILE ] && ogRaiseError $OG_ERR_NOTFOUND "grub.cfg" && return $?
174
175# Toma del fichero de configuracion los valores del kernel, initrd
176#       y parámetros de arranque usando las cláusulas por defecto
177#       ("default" en GRUB1, "set default" en GRUB2)
178#       y los formatea para que sean compatibles con \c kexec .  */
179# /* (comentario Doxygen)
180awk 'BEGIN {cont=-1;}
181     $1~/^default/      {sub(/=/," "); def=$2;}
182     $1~/^set/ && $2~/^default/ {gsub(/[="]/," "); def=$3;}
183     $1~/^title|^menuentry/ {cont++}
184     $1~/^kernel|^linux/ {if (def==cont) {
185                            kern=$2;
186                            sub($1,"");sub($1,"");sub(/^[ \t]*/,"");app=$0}  # /* (comentario Doxygen)
187                        }
188     $1~/^initrd/       {if (def==cont) init=$2}
189     END {if (kern!="") printf("%s %s %s", kern,init,app)}
190    ' $CONFFILE
191# */ (comentario Doxygen)
192}
193
194
195#/**
196#         ogSetWindowsName int_ndisk int_npartition str_name
197#@brief   Establece el nombre del equipo en el registro de Windows.
198#@param   int_ndisk      nº de orden del disco
199#@param   int_npartition nº de orden de la partición
200#@param   str_name       nombre asignado
201#@return  (nada)
202#@exception OG_ERR_FORMAT    Formato incorrecto.
203#@exception OG_ERR_NOTFOUND  Disco o particion no corresponden con un dispositivo.
204#@exception OG_ERR_PARTITION Tipo de partición desconocido o no se puede montar.
205#@version 0.9 - Adaptación a OpenGNSys.
206#@author  Ramon Gomez, ETSII Universidad de Sevilla
207#@date    2009-09-24
208#*/ ##
209function ogSetWindowsName ()
210{
211# Variables locales.
212local PART MNTDIR NAME
213
214# Si se solicita, mostrar ayuda.
215if [ "$*" == "help" ]; then
216    ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_npartition str_name" \
217           "$FUNCNAME 1 1 PRACTICA-PC"
218    return
219fi
220# Error si no se reciben 3 parámetros.
221[ $# == 3 ] || ogRaiseError $OG_ERR_FORMAT || return $?
222
223# Montar el sistema de archivos.
224MNTDIR=$(ogMount $1 $2) 2>/dev/null
225[ -z "$MNTDIR" ] && ogRaiseError OG_ERR_PARTITION "$1, $2" && return $?
226NAME="$3"
227
228# Modificar datos de los valores de registro.
229ogSetRegistryValue $MNTDIR system '\ControlSet001\Control\ComputerName\ComputerName\ComputerName' "$NAME" 2>/dev/null
230ogSetRegistryValue $MNTDIR system '\ControlSet001\Services\Tcpip\Parameters\Hostname' "$NAME" 2>/dev/null
231ogSetRegistryValue $MNTDIR system '\ControlSet001\services\Tcpip\Parameters\Hostname' "$NAME" 2>/dev/null
232ogSetRegistryValue $MNTDIR system '\ControlSet001\Services\Tcpip\Parameters\NV Hostname' "$NAME" 2>/dev/null
233ogSetRegistryValue $MNTDIR system '\ControlSet001\services\Tcpip\Parameters\NV Hostname' "$NAME" 2>/dev/null
234}
235
236
237#/**
238#         ogSetWinlogonUser int_ndisk int_npartition str_username
239#@brief   Establece el nombre de usuario por defecto en la entrada de Windows.
240#@param   int_ndisk      nº de orden del disco
241#@param   int_npartition nº de orden de la partición
242#@param   str_username   nombre de usuario por defecto
243#@return  (nada)
244#@exception OG_ERR_FORMAT    Formato incorrecto.
245#@exception OG_ERR_NOTFOUND  Disco o particion no corresponden con un dispositivo.
246#@exception OG_ERR_PARTITION Tipo de partición desconocido o no se puede montar.
247#@version 0.9.2 - Adaptación a OpenGNSys.
248#@author  Ramon Gomez, ETSII Universidad de Sevilla
249#@date    2010-07-20
250#*/ ##
251function ogSetWinlogonUser ()
252{
253# Variables locales.
254local PART MNTDIR NAME
255
256# Si se solicita, mostrar ayuda.
257if [ "$*" == "help" ]; then
258    ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_npartition str_username" \
259           "$FUNCNAME 1 1 USUARIO"
260    return
261fi
262# Error si no se reciben 3 parámetros.
263[ $# == 3 ] || ogRaiseError $OG_ERR_FORMAT || return $?
264
265# Montar el sistema de archivos.
266MNTDIR=$(ogMount $1 $2) 2>/dev/null
267[ -z "$MNTDIR" ] && ogRaiseError OG_ERR_PARTITION "$1, $2" && return $?
268NAME="$3"
269
270# Modificar datos en el registro.
271ogSetRegistryValue $MNTDIR SOFTWARE '\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName' "$3"
272}
273
274
275#/**
276#         ogBootMbrXP int_ndisk
277#@brief   Genera un nuevo Master Boot Record en el disco duro indicado, compatible con los SO tipo Windows
278#@param   int_ndisk      nº de orden del disco
279#@return  salida del programa my-sys
280#@exception OG_ERR_FORMAT    Formato incorrecto.
281#@exception OG_ERR_PARTITION Tipo de partición desconocido o no se puede montar.
282#@version 0.9 - Adaptación a OpenGNSys.
283#@author  Antonio J. Doblas Viso. Universidad de Málaga
284#@date    2009-09-24
285#*/ ##
286
287function ogBootMbrXP ()
288{
289# Variables locales.
290local PART
291
292# Si se solicita, mostrar ayuda.
293if [ "$*" == "help" ]; then
294    ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk " \
295           "$FUNCNAME 1 "
296    return
297fi
298# Error si no se reciben 1 parámetros.
299[ $# == 1 ] || ogRaiseError $OG_ERR_FORMAT || return $?
300
301PART="$(ogDiskToDev $1)" || return $?
302ms-sys -z -f $PART
303ms-sys -m -f $PART
304}
305
306
307#/**
308#         ogBootMbrGeneric int_ndisk
309#@brief   Genera un nuevo Codigo de arranque en el MBR del disco indicado, compatible con los SO tipo Windows, Linux.
310#@param   int_ndisk      nº de orden del disco
311#@return  salida del programa my-sys
312#@exception OG_ERR_FORMAT    Formato incorrecto.
313#@exception OG_ERR_NOTFOUND Tipo de partición desconocido o no se puede montar.
314#@version 0.9 - Adaptación a OpenGNSys.
315#@author  Antonio J. Doblas Viso. Universidad de Málaga
316#@date    2009-09-24
317#*/ ##
318
319function ogBootMbrGeneric ()
320{
321# Variables locales.
322local PART
323
324# Si se solicita, mostrar ayuda.
325if [ "$*" == "help" ]; then
326    ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk " \
327           "$FUNCNAME 1 "
328    return
329fi
330# Error si no se reciben 1 parámetros.
331[ $# == 1 ] || return $(ogRaiseError $OG_ERR_FORMAT; echo $?)
332
333PART="$(ogDiskToDev $1)" || return $(ogRaiseError $OG_ERR_NOTFOUND; echo $?)
334ms-sys -z -f $PART
335ms-sys -s -f $PART
336}
337
338
339
340
341#/**
342#         ogFixBootSector int_ndisk int_parition
343#@brief   Corrige el boot sector de una particion activa para MS windows/dos -fat-ntfs
344#@param   int_ndisk      nº de orden del disco
345#@param   int_partition     nº de particion
346#@return 
347#@exception OG_ERR_FORMAT    Formato incorrecto.
348#@exception OG_ERR_PARTITION Tipo de partición desconocido o no se puede montar.
349#@version 0.9 - Adaptación a OpenGNSys.
350#@author  Antonio J. Doblas Viso. Universidad de Málaga
351#@date    2009-09-24
352#*/ ##
353
354function ogFixBootSector ()
355{
356# Variables locales.
357local PART DISK FILE
358
359# Si se solicita, mostrar ayuda.
360if [ "$*" == "help" ]; then
361    ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_partition " \
362           "$FUNCNAME 1 1 "
363    return
364fi
365
366# Error si no se reciben 2 parámetros.
367[ $# == 2 ] || return $(ogRaiseError $OG_ERR_FORMAT; echo $?)
368
369#TODO, solo si la particion existe
370#TODO, solo si es ntfs o fat
371PARTYPE=$(ogGetPartitionId $1 $2)
372case $PARTYPE in
373        1|4|6|7|b|c|e|f)
374        ;;
375        *)
376        return $(ogRaiseError $OG_ERR_PARTITION; echo $?)
377        ;;
378esac
379
380ogUnmount $1 $2 || return $(ogRaiseError $OG_ERR_PARTITION; echo $?)
381
382#Preparando instruccion
383let DISK=$1-1   
384PART=$2
385FILE=/tmp/temporal
386cat > $FILE <<EOF
387disk=$DISK
388main_part=$PART
389fix_first_sector=yes
390EOF
391
392spartlnx.run -cui -nm -a -f $FILE
393
394}
395
396
397
398#/**
399#         ogWindowsBootParameters int_ndisk int_parition
400#@brief   Configura el gestor de arranque de windows 7 / vista / XP / 2000
401#@param   int_ndisk      nº de orden del disco
402#@param   int_partition     nº de particion
403#@return 
404#@exception OG_ERR_FORMAT    Formato incorrecto.
405#@exception OG_ERR_PARTITION Tipo de partición desconocido o no se puede montar.
406#@version 0.9 - Integración desde EAC para OpenGNSys.
407#@author  Antonio J. Doblas Viso. Universidad de Málaga
408#@date    2009-09-24
409#@version 1.0.1 - Adapatacion para OpenGnsys.
410#@author  Antonio J. Doblas Viso. Universidad de Málaga
411#@date    2011-05-20
412#*/ ##
413
414
415function ogWindowsBootParameters ()
416{
417# Variables locales.
418local PART DISK FILE
419#Preparando variables adaptadas a sintaxis windows.
420let DISK=$1-1
421PART=$2
422FILE=/tmp/temporal
423
424# Si se solicita, mostrar ayuda.
425if [ "$*" == "help" ]; then
426    ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_partition " \
427           "$FUNCNAME 1 1 "
428    return
429fi
430
431# Error si no se reciben 2 parámetros.
432[ $# == 2 ] || return $(ogRaiseError $OG_ERR_FORMAT; echo $?)
433
434ogDiskToDev $1 $2 || return $(ogRaiseError $OG_ERR_PARTITION; echo $?)
435
436VERSION=$(ogGetOsVersion $1 $2)
437
438if echo "$VERSION" | grep "Windows 7"
439then
440        WINVER="Windows 7"
441elif echo "$VERSION" | grep "Windows Seven"
442then
443        WINVER="Windows Vista"
444elif echo "$VERSION" | grep "XP"
445then
446        MOUNT=$(ogMount $1 $2)
447        [ -f ${MOUNT}/boot.ini ] || return $(ogRaiseError $OG_ERR_NOTOS; echo $?)
448        cat ${MOUNT}/boot.ini | sed s/partition\([0-9]\)/partition\($PART\)/g | sed s/rdisk\([0-9]\)/rdisk\($DISK\)/g > ${MOUNT}/tmp.boot.ini; mv ${MOUNT}/tmp.boot.ini ${MOUNT}/boot.ini
449        return 0
450else
451        return $(ogRaiseError $OG_ERR_NOTOS; echo $?)
452fi
453
454ogUnmount $1 $2 || return $(ogRaiseError $OG_ERR_PARTITION; echo $?)
455
456
457#Preparando instruccion Windows Resume Application
458cat > $FILE <<EOF
459boot_disk=$DISK
460boot_main_part=$PART
461disk=$DISK
462main_part=$PART
463boot_entry=Windows Resume Application
464EOF
465spartlnx.run -cui -nm -w -f $FILE
466
467#Preparando instruccion tipo windows
468cat > $FILE <<EOF
469boot_disk=$DISK
470boot_main_part=$PART
471disk=$DISK
472main_part=$PART
473boot_entry=$WINVER
474EOF
475spartlnx.run -cui -nm -w -f $FILE
476
477##Preparando instruccion        Ramdisk Options
478#cat > $FILE <<EOF
479#boot_disk=$DISK
480#boot_main_part=$PART
481#disk=$DISK
482#main_part=$PART
483#boot_entry=Ramdisk Options
484#EOF
485#spartlnx.run -cui -nm -w -f $FILE
486
487#Preparando instruccion Windows Boot Manager
488cat > $FILE <<EOF
489boot_disk=$DISK
490boot_main_part=$PART
491disk=$DISK
492main_part=$PART
493boot_entry=Windows Boot Manager
494EOF
495spartlnx.run -cui -nm -w -f $FILE
496
497#Preparando instruccion Herramienta de diagnóstico de memoria de Windows
498#cat > $FILE <<EOF
499#boot_disk=$DISK
500#boot_main_part=$PART
501#disk=$DISK
502#main_part=$PART
503#boot_entry=Herramienta de diagnóstico de memoria de Windows
504#EOF
505#spartlnx.run -cui -nm -w -f $FILE
506
507}
508       
509
510#         ogWindowsRegisterPartition int_ndisk int_partiton str_volume int_disk int_partition
511#@brief   Registra una partición en windows con un determinado volumen.
512#@param   int_ndisk      nº de orden del disco a registrar
513#@param   int_partition     nº de particion a registrar
514#@param   str_volumen      volumen a resgistar
515#@param   int_ndisk_windows      nº de orden del disco donde esta windows
516#@param   int_partition_windows     nº de particion donde esta windows
517#@return 
518#@exception OG_ERR_FORMAT    Formato incorrecto.
519#@exception OG_ERR_PARTITION Tipo de partición desconocido o no se puede montar.
520#@version 0.9 - Adaptación a OpenGNSys.
521#@author  Antonio J. Doblas Viso. Universidad de Málaga
522#@date    2009-09-24
523#*/ ##
524
525
526function ogWindowsRegisterPartition ()
527{       
528# Variables locales.
529local PART DISK FILE
530
531# Si se solicita, mostrar ayuda.
532if [ "$*" == "help" ]; then
533    ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk_TO_registre int_partition_TO_registre str_NewVolume int_disk int_parition " \
534           "$FUNCNAME 1 1 c: 1 1"
535    return
536fi
537
538# Error si no se reciben 5 parámetros.
539[ $# == 5 ] || return $(ogRaiseError $OG_ERR_FORMAT; echo $?)
540
541REGISTREDDISK=$1
542REGISTREDPART=$2
543REGISTREDVOL=$(echo $3 | cut -c1 | tr '[:lower:]' '[:upper:]')
544DISK=$4
545PART=$5
546FILE=/tmp/temporal
547
548ogDiskToDev $REGISTREDDISK $REGISTREDPART || return $(ogRaiseError $OG_ERR_PARTITION "particion a registrar "; echo $?)
549ogDiskToDev $DISK $PART || return $(ogRaiseError $OG_ERR_PARTITION "particion de windows"; echo $?)
550
551ogGetOsType $DISK $PART | grep "Windows" || return $(ogRaiseError $OG_ERR_NOTOS "no es windows"; echo $?)
552
553VERSION=$(ogGetOsVersion $DISK $PART)
554
555#Systemroot
556
557if ogGetPath $DISK $PART WINDOWS
558then
559        SYSTEMROOT="Windows"
560elif ogGetPath $DISK $PART WINNT
561then
562        SYSTEMROOT="winnt"
563else
564        return $(ogRaiseError $OG_ERR_NOTOS; echo $?)
565fi
566
567ogUnmount $DISK $PART
568let DISK=$DISK-1
569let REGISTREDDISK=$REGISTREDDISK-1
570#Preparando instruccion Windows Boot Manager
571cat > $FILE <<EOF
572windows_disk=$DISK
573windows_main_part=$PART
574windows_dir=$SYSTEMROOT
575disk=$REGISTREDDISK
576main_part=$REGISTREDPART
577;ext_part
578part_letter=$REGISTREDVOL
579EOF
580spartlnx.run -cui -nm -u -f $FILE
581}
Note: See TracBrowser for help on using the repository browser.