[b094c59] | 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. |
---|
[f5432db7] | 15 | #@arg \c int_ndisk nº de orden del disco |
---|
| 16 | #@arg \c int_npartition nº de orden de la partición |
---|
[b094c59] | 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. |
---|
[f5432db7] | 22 | #@note En Linux, debe arrancarse la partición del directorio \c /boot |
---|
| 23 | #@version 0.9 - Adaptación para OpenGNSys. |
---|
[b094c59] | 24 | #@author Ramon Gomez, ETSII Universidad de Sevilla |
---|
| 25 | #@date 2009-09-11 |
---|
| 26 | #*/ |
---|
| 27 | function ogBoot () { |
---|
| 28 | |
---|
| 29 | # Variables locales. |
---|
[326cec3] | 30 | local PART TYPE MNTDIR PARAMS KERNEL INITRD APPEND FILE LOADER |
---|
[b094c59] | 31 | |
---|
| 32 | #/// Si se solicita, mostrar ayuda. |
---|
| 33 | if [ "$*" == "help" ]; then |
---|
| 34 | ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_npartition" \ |
---|
| 35 | "$FUNCNAME 1 1" |
---|
| 36 | return |
---|
| 37 | fi |
---|
| 38 | #/// Error si no se reciben 2 parámetros. |
---|
| 39 | [ $# == 2 ] || ogRaiseError $OG_ERR_FORMAT || return $? |
---|
| 40 | |
---|
[4c63eb9] | 41 | #/// Detectar tipo de sistema de archivos y montarlo. |
---|
[049eadbe] | 42 | PART=$(ogDiskToDev $1 $2) || return $? |
---|
[b094c59] | 43 | TYPE=$(ogGetFsType $1 $2) || return $? |
---|
[f5432db7] | 44 | MNTDIR=$(ogMount $1 $2) 2>/dev/null |
---|
| 45 | [ -z "$MNTDIR" ] && ogRaiseError OG_ERR_PARTITION "$1, $2" && return $? |
---|
[b094c59] | 46 | |
---|
| 47 | case "$TYPE" in |
---|
[049eadbe] | 48 | EXT[234]|REISERFS|REISER4|JFS|XFS) |
---|
[f5432db7] | 49 | #/// Obtiene los parámetros de arranque para Linux. |
---|
| 50 | PARAMS=$(ogLinuxBootParameters $1 $2) || return $? |
---|
| 51 | read -e KERNEL INITRD APPEND <<<"$PARAMS" |
---|
[049eadbe] | 52 | #/// Si no hay kernel, no hay sistema operativo. |
---|
[f5432db7] | 53 | [ -z "$KERNEL" ] && ogRaiseError $OG_ERR_NOTOS && return $? |
---|
[049eadbe] | 54 | #/// Arrancar de partición distinta a la original. |
---|
| 55 | [ -e "$MNTDIR/etc" ] && APPEND=$(echo $APPEND | awk -v P="$PART " '{sub (/root=[-+=_/a-zA-Z0-9]* /,"root="P);print}') |
---|
[f5432db7] | 56 | # Configurar kernel Linux con los parámetros leídos de su GRUB. |
---|
[049eadbe] | 57 | kexec -l "${MNTDIR}${KERNEL}" --append="$APPEND" --initrd="${MNTDIR}${INITRD}" |
---|
[f5432db7] | 58 | ;; |
---|
| 59 | NTFS|HNTFS|FAT32|HFAT32) |
---|
| 60 | #/// Compruebar si hay un cargador de Windows. |
---|
| 61 | for f in io.sys ntldr bootmgr; do |
---|
| 62 | FILE="$(ogGetPath $1 $2 $f 2>/dev/null)" |
---|
| 63 | [ -n "$FILE" ] && LOADER="$(basename $FILE)" |
---|
| 64 | done |
---|
| 65 | [ -z "$LOADER" ] && ogRaiseError $OG_ERR_NOTOS && return $? |
---|
| 66 | # Activar la partición y copiar Grub4DOS. |
---|
| 67 | ogSetPartitionActive $1 $2 |
---|
| 68 | cp $OGLIB/grub4dos/* $MNTDIR # */ (necesario para Doxygen) |
---|
| 69 | kexec -l $MNTDIR/grub.exe --append=--config-file="find --set-root /$LOADER; chainloader /$LOADER; tpm --init" |
---|
| 70 | ;; |
---|
| 71 | *) ogRaiseError $OG_ERR_PARTITION "$1, $2" |
---|
[326cec3] | 72 | return $? |
---|
[f5432db7] | 73 | ;; |
---|
[b094c59] | 74 | esac |
---|
| 75 | |
---|
[4c63eb9] | 76 | #/// Arrancar. |
---|
[b094c59] | 77 | kexec -e |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | |
---|
| 81 | #/** |
---|
[3e1561d] | 82 | # ogGetRegistryValue path_mountpoint str_registrytype str_valuename |
---|
| 83 | #@brief Devuelve el dato de un valor del registro de Windows. |
---|
[f5432db7] | 84 | #@arg \c path_mountpoint directorio donde está montado el sistema Windows |
---|
| 85 | #@arg \c str_registrytype tipo de registro a leer |
---|
| 86 | #@arg \c str_valuename valor de registro |
---|
[3e1561d] | 87 | #@return str_valuedata - valor de la clave. |
---|
[055adcf] | 88 | #@exception OG_ERR_FORMAT Formato incorrecto. |
---|
[f5432db7] | 89 | #@exception OG_ERR_NOTFOUND Disco o partición no corresponden con un dispositivo. |
---|
[055adcf] | 90 | #@exception OG_ERR_PARTITION Tipo de partición desconocido o no se puede montar. |
---|
| 91 | #@note registrytype = { default, sam, security, software, system, components } |
---|
| 92 | #@warning Requisitos: chntpw, awk |
---|
| 93 | #@warning La partición de Windows debe estar montada previamente. |
---|
[f5432db7] | 94 | #@version 0.9 - Adaptación para OpenGNSys. |
---|
[055adcf] | 95 | #@author Ramon Gomez, ETSII Universidad de Sevilla |
---|
| 96 | #@date 2009-09-11 |
---|
| 97 | #*/ |
---|
[3e1561d] | 98 | function ogGetRegistryValue () { |
---|
[055adcf] | 99 | |
---|
| 100 | # Variables locales. |
---|
[50a094c] | 101 | local FILE FILENT FILEXP |
---|
[055adcf] | 102 | |
---|
| 103 | #/// Si se solicita, mostrar ayuda. |
---|
| 104 | if [ "$*" == "help" ]; then |
---|
| 105 | ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint str_registrytype str_key" |
---|
| 106 | return |
---|
| 107 | fi |
---|
| 108 | #/// Error si no se reciben 3 parámetros. |
---|
| 109 | [ $# == 3 ] || ogRaiseError $OG_ERR_FORMAT || return $? |
---|
| 110 | |
---|
| 111 | #/// Camino del fichero de registro en NT/2000 o XP/Vista/7. |
---|
| 112 | FILENT=$(ogGetPath "/$1/winnt/system32/config/$2") |
---|
[945b003] | 113 | [ -f $FILENT ] && FILE="$FILENT" |
---|
[055adcf] | 114 | FILEXP=$(ogGetPath "/$1/windows/system32/config/$2") |
---|
[945b003] | 115 | [ -f $FLEHXP ] && FILE="$FILEXP" |
---|
[055adcf] | 116 | [ ! -f $FILE ] && ogRaiseError OG_ERR_NOTFOUND "$1,$2" && return $? |
---|
| 117 | |
---|
[3e1561d] | 118 | #/// Devolver el dato del valor de registro. |
---|
[055adcf] | 119 | chntpw $FILE << FIN 2>/dev/null | awk '/> Value/ {getline;print $0;}' |
---|
| 120 | cd ${3%\\*} |
---|
| 121 | cat ${3##*\\} |
---|
| 122 | q |
---|
| 123 | FIN |
---|
| 124 | } |
---|
| 125 | |
---|
| 126 | |
---|
| 127 | #/** |
---|
[3e1561d] | 128 | # ogGetWindowsName int_ndisk int_npartition |
---|
| 129 | #@brief Muestra el nombre del equipo en el registro de Windows. |
---|
[f5432db7] | 130 | #@arg \c int_ndisk nº de orden del disco |
---|
| 131 | #@arg \c int_npartition nº de orden de la partición |
---|
[3e1561d] | 132 | #@return str_name - nombre del equipo |
---|
| 133 | #@exception OG_ERR_FORMAT Formato incorrecto. |
---|
| 134 | #@exception OG_ERR_NOTFOUND Disco o particion no corresponden con un dispositivo. |
---|
| 135 | #@exception OG_ERR_PARTITION Tipo de partición desconocido o no se puede montar. |
---|
[f5432db7] | 136 | #@version 0.9 - Adaptación para OpenGNSys. |
---|
[3e1561d] | 137 | #@author Ramon Gomez, ETSII Universidad de Sevilla |
---|
| 138 | #@date 2009-09-23 |
---|
| 139 | #*/ |
---|
| 140 | function ogGetWindowsName () { |
---|
| 141 | |
---|
| 142 | # Variables locales. |
---|
| 143 | local PART MNTDIR |
---|
| 144 | |
---|
| 145 | #/// Si se solicita, mostrar ayuda. |
---|
| 146 | if [ "$*" == "help" ]; then |
---|
| 147 | ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_npartition" \ |
---|
| 148 | "$FUNCNAME 1 1 ==> PRACTICA-PC" |
---|
| 149 | return |
---|
| 150 | fi |
---|
| 151 | #/// Error si no se reciben 2 parámetros. |
---|
| 152 | [ $# == 2 ] || ogRaiseError $OG_ERR_FORMAT || return $? |
---|
| 153 | |
---|
| 154 | #/// Montar el sistema de archivos. |
---|
[f5432db7] | 155 | MNTDIR=$(ogMount $1 $2) 2>/dev/null |
---|
| 156 | [ -z "$MNTDIR" ] && ogRaiseError OG_ERR_PARTITION "$1, $2" && return $? |
---|
[3e1561d] | 157 | |
---|
| 158 | #/// Obtener dato del valor de registro. |
---|
| 159 | ogGetRegistryValue $MNTDIR system '\ControlSet001\Control\ComputerName\ComputerName\ComputerName' |
---|
| 160 | } |
---|
| 161 | |
---|
| 162 | |
---|
| 163 | #/** |
---|
[50a094c] | 164 | # ogListRegistryKeys path_mountpoint str_registrytype str_key |
---|
[3e1561d] | 165 | #@brief Lista los nombres de claves de una determinada clave del registro de Windows. |
---|
[f5432db7] | 166 | #@arg \c path_mountpoint directorio donde está montado el sistema Windows |
---|
| 167 | #@arg \c str_registrytype tipo de registro a leer |
---|
| 168 | #@arg \c str_key clave de registro |
---|
[945b003] | 169 | #@return |
---|
[50a094c] | 170 | #@exception OG_ERR_FORMAT Formato incorrecto. |
---|
| 171 | #@exception OG_ERR_NOTFOUND Disco o particion no corresponden con un dispositivo. |
---|
| 172 | #@exception OG_ERR_PARTITION Tipo de partición desconocido o no se puede montar. |
---|
| 173 | #@note registrytype = { default, sam, security, software, system, components } |
---|
| 174 | #@warning Requisitos: chntpw, awk |
---|
| 175 | #@warning La partición de Windows debe estar montada previamente. |
---|
[f5432db7] | 176 | #@version 0.9 - Adaptación para OpenGNSys. |
---|
[50a094c] | 177 | #@author Ramon Gomez, ETSII Universidad de Sevilla |
---|
| 178 | #@date 2009-09-23 |
---|
| 179 | #*/ |
---|
| 180 | function ogListRegistryKeys () { |
---|
| 181 | |
---|
| 182 | # Variables locales. |
---|
| 183 | local FILE FILENT FILEXP |
---|
| 184 | |
---|
| 185 | #/// Si se solicita, mostrar ayuda. |
---|
| 186 | if [ "$*" == "help" ]; then |
---|
| 187 | ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint str_registrytype str_key" |
---|
| 188 | return |
---|
| 189 | fi |
---|
| 190 | #/// Error si no se reciben 3 parámetros. |
---|
| 191 | [ $# == 3 ] || ogRaiseError $OG_ERR_FORMAT || return $? |
---|
| 192 | |
---|
| 193 | #/// Camino del fichero de registro en NT/2000 o XP/Vista/7. |
---|
| 194 | FILENT=$(ogGetPath "/$1/winnt/system32/config/$2") |
---|
[945b003] | 195 | [ -f $FILENT ] && FILE="$FILENT" |
---|
[50a094c] | 196 | FILEXP=$(ogGetPath "/$1/windows/system32/config/$2") |
---|
[945b003] | 197 | [ -f $FLEHXP ] && FILE="$FILEXP" |
---|
[50a094c] | 198 | [ ! -f $FILE ] && ogRaiseError OG_ERR_NOTFOUND "$1,$2" && return $? |
---|
| 199 | |
---|
| 200 | #/// Devolver la lista de claves de registro. |
---|
| 201 | chntpw $FILE << FIN 2>/dev/null | awk 'BEGIN {FS="[<>]"} $1~/^ $/ {print $2}' |
---|
| 202 | ls $3 |
---|
| 203 | q |
---|
| 204 | FIN |
---|
| 205 | } |
---|
| 206 | |
---|
| 207 | |
---|
| 208 | #/** |
---|
[4c63eb9] | 209 | # ogLinuxBootParameters int_ndisk int_npartition |
---|
[b094c59] | 210 | #@brief Muestra los parámetros de arranque de un sistema de archivos Linux. |
---|
[f5432db7] | 211 | #@arg \c int_ndisk nº de orden del disco |
---|
| 212 | #@arg \c int_npartition nº de orden de la partición |
---|
[b094c59] | 213 | #@return kernel initrd parámetros ... |
---|
| 214 | #@exception OG_ERR_FORMAT Formato incorrecto. |
---|
| 215 | #@exception OG_ERR_NOTFOUND Disco o particion no corresponden con un dispositivo. |
---|
| 216 | #@exception OG_ERR_PARTITION Tipo de partición desconocido o no se puede montar. |
---|
[055adcf] | 217 | #@warning Función básica usada por \c ogBoot |
---|
| 218 | #@version 0.9 - Primera adaptación para OpenGNSys. |
---|
[b094c59] | 219 | #@author Ramon Gomez, ETSII Universidad de Sevilla |
---|
| 220 | #@date 2009-09-11 |
---|
| 221 | #*/ |
---|
| 222 | function ogLinuxBootParameters () { |
---|
| 223 | |
---|
| 224 | # Variables locales. |
---|
[4c63eb9] | 225 | local MNTDIR CONF |
---|
[b094c59] | 226 | |
---|
| 227 | #/// Si se solicita, mostrar ayuda. |
---|
| 228 | if [ "$*" == "help" ]; then |
---|
| 229 | ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_npartition" \ |
---|
| 230 | "$FUNCNAME 1 2 ==> ..." |
---|
| 231 | return |
---|
| 232 | fi |
---|
| 233 | #/// Error si no se reciben 2 parámetros. |
---|
| 234 | [ $# == 2 ] || ogRaiseError $OG_ERR_FORMAT || return $? |
---|
| 235 | |
---|
| 236 | #/// Detectar id. de tipo de partición y codificar al mnemonico. |
---|
[f5432db7] | 237 | MNTDIR=$(ogMount $1 $2) 2>/dev/null |
---|
| 238 | [ -z "$MNTDIR" ] && ogRaiseError OG_ERR_PARTITION "$1, $2" && return $? |
---|
[b094c59] | 239 | |
---|
| 240 | # Fichero de configuración de GRUB. |
---|
| 241 | CONF="$MNTDIR/boot/grub/menu.lst" |
---|
[ee4a96e] | 242 | [ ! -e $CONF ] && CONF="$MNTDIR/boot/grub/grub.cfg" |
---|
| 243 | [ ! -e $CONF ] && ogRaiseError $OG_ERR_NOTFOUND "grub.cfg" && return $? |
---|
[b094c59] | 244 | |
---|
[4c63eb9] | 245 | #/** Toma del fichero de configuracion los valores del kernel, initrd |
---|
[ee4a96e] | 246 | # y parámetros de arranque usando las cláusulas por defecto |
---|
| 247 | # ("default" en GRUB1, "set default" en GRUB2) |
---|
| 248 | # y los formatea para que sean compatibles con \c kexec . */ |
---|
[3d0750f] | 249 | #/* (ncesario para Doxygen) |
---|
[b094c59] | 250 | awk 'BEGIN {cont=-1;} |
---|
| 251 | $1~/^default/ {sub(/=/," "); def=$2;} |
---|
[18f4bc2] | 252 | $1~/^set/ && $2~/^default/ {gsub(/[="]/," "); def=$3;} |
---|
[ee4a96e] | 253 | $1~/^title|^menuentry/ {cont++} |
---|
| 254 | $1~/^kernel|^linux/ {if (def==cont) { |
---|
[b094c59] | 255 | kern=$2; |
---|
[c56dec5] | 256 | sub($1,"");sub($1,"");sub(/^[ \t]*/,"");app=$0} |
---|
[b094c59] | 257 | } |
---|
| 258 | $1~/^initrd/ {if (def==cont) init=$2} |
---|
| 259 | END {if (kern!="") printf("%s %s %s", kern,init,app)} |
---|
| 260 | ' $CONF |
---|
| 261 | } |
---|
| 262 | |
---|
[3e1561d] | 263 | |
---|
| 264 | |
---|
| 265 | #/** |
---|
| 266 | # ogSetRegistryValue path_mountpoint str_registrytype str_valuename str_valuedata |
---|
| 267 | #@brief Establece el dato asociado a un valor del registro de Windows. |
---|
[f5432db7] | 268 | #@arg \c path_mountpoint directorio donde está montado el sistema Windows |
---|
| 269 | #@arg \c str_registrytype tipo de registro |
---|
| 270 | #@arg \c str_valuename nombre del valor de registro |
---|
| 271 | #@arg \c str_valuedata dato del valor de registro |
---|
[3e1561d] | 272 | #@return (nada) |
---|
| 273 | #@exception OG_ERR_FORMAT Formato incorrecto. |
---|
[f5432db7] | 274 | #@exception OG_ERR_NOTFOUND Disco o partición no corresponden con un dispositivo. |
---|
[3e1561d] | 275 | #@exception OG_ERR_PARTITION Tipo de partición desconocido o no se puede montar. |
---|
| 276 | #@note registrytype = { default, sam, security, software, system, components } |
---|
| 277 | #@warning Requisitos: chntpw, awk |
---|
| 278 | #@warning La partición de Windows debe estar montada previamente. |
---|
[f5432db7] | 279 | #@version 0.9 - Adaptación para OpenGNSys. |
---|
[3e1561d] | 280 | #@author Ramon Gomez, ETSII Universidad de Sevilla |
---|
| 281 | #@date 2009-09-24 |
---|
| 282 | #*/ |
---|
| 283 | function ogSetRegistryValue () { |
---|
| 284 | |
---|
| 285 | # Variables locales. |
---|
| 286 | local FILE FILENT FILEXP |
---|
| 287 | |
---|
| 288 | #/// Si se solicita, mostrar ayuda. |
---|
| 289 | if [ "$*" == "help" ]; then |
---|
| 290 | ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint str_registrytype str_key" |
---|
| 291 | return |
---|
| 292 | fi |
---|
| 293 | #/// Error si no se reciben 4 parámetros. |
---|
| 294 | [ $# == 4 ] || ogRaiseError $OG_ERR_FORMAT || return $? |
---|
| 295 | |
---|
| 296 | #/// Camino del fichero de registro en NT/2000 o XP/Vista/7. |
---|
| 297 | FILENT=$(ogGetPath "/$1/winnt/system32/config/$2") |
---|
[945b003] | 298 | [ -f $FILENT ] && FILE="$FILENT" |
---|
[3e1561d] | 299 | FILEXP=$(ogGetPath "/$1/windows/system32/config/$2") |
---|
[945b003] | 300 | [ -f $FLEHXP ] && FILE="$FILEXP" |
---|
[3e1561d] | 301 | [ ! -f $FILE ] && ogRaiseError OG_ERR_NOTFOUND "$1,$2" && return $? |
---|
| 302 | |
---|
| 303 | #/// Cambiar el dato del valor de registro. |
---|
[f5432db7] | 304 | chntpw $FILE << FIN &>/dev/null |
---|
[3e1561d] | 305 | ed $3 |
---|
| 306 | $4 |
---|
| 307 | q |
---|
| 308 | y |
---|
| 309 | FIN |
---|
| 310 | } |
---|
| 311 | |
---|
| 312 | |
---|
| 313 | #/** |
---|
| 314 | # ogSetWindowsName int_ndisk int_npartition str_name |
---|
| 315 | #@brief Establece el nombre del equipo en el registro de Windows. |
---|
[f5432db7] | 316 | #@arg \c int_ndisk nº de orden del disco |
---|
| 317 | #@arg \c int_npartition nº de orden de la partición |
---|
| 318 | #@arg \c str_name nombre asignado |
---|
[3e1561d] | 319 | #@return (nada) |
---|
| 320 | #@exception OG_ERR_FORMAT Formato incorrecto. |
---|
| 321 | #@exception OG_ERR_NOTFOUND Disco o particion no corresponden con un dispositivo. |
---|
| 322 | #@exception OG_ERR_PARTITION Tipo de partición desconocido o no se puede montar. |
---|
[f5432db7] | 323 | #@version 0.9 - Adaptación a OpenGNSys. |
---|
[3e1561d] | 324 | #@author Ramon Gomez, ETSII Universidad de Sevilla |
---|
| 325 | #@date 2009-09-24 |
---|
| 326 | #*/ |
---|
| 327 | function ogSetWindowsName () { |
---|
| 328 | |
---|
| 329 | # Variables locales. |
---|
| 330 | local PART MNTDIR NAME |
---|
| 331 | |
---|
| 332 | #/// Si se solicita, mostrar ayuda. |
---|
| 333 | if [ "$*" == "help" ]; then |
---|
| 334 | ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_npartition" \ |
---|
| 335 | "$FUNCNAME 1 1 PRACTICA-PC" |
---|
| 336 | return |
---|
| 337 | fi |
---|
| 338 | #/// Error si no se reciben 3 parámetros. |
---|
| 339 | [ $# == 3 ] || ogRaiseError $OG_ERR_FORMAT || return $? |
---|
| 340 | |
---|
| 341 | #/// Montar el sistema de archivos. |
---|
[f5432db7] | 342 | MNTDIR=$(ogMount $1 $2) 2>/dev/null |
---|
| 343 | [ -z "$MNTDIR" ] && ogRaiseError OG_ERR_PARTITION "$1, $2" && return $? |
---|
[3e1561d] | 344 | NAME="$3" |
---|
| 345 | |
---|
| 346 | #/// Modificar datos de los valores de registro. |
---|
[f5432db7] | 347 | ogSetRegistryValue $MNTDIR system '\ControlSet001\Control\ComputerName\ComputerName\ComputerName' "$NAME" |
---|
| 348 | ogSetRegistryValue $MNTDIR system '\ControlSet001\Services\Tcpip\Parameters\Hostname' "$NAME" |
---|
| 349 | ogSetRegistryValue $MNTDIR system '\ControlSet001\Services\Tcpip\Parameters\NV Hostname' "$NAME" |
---|
[3e1561d] | 350 | } |
---|
| 351 | |
---|
[f5432db7] | 352 | |
---|
[a781d7b] | 353 | function ogNewMbrXP () { |
---|
[945b003] | 354 | #/** @function NewMbrXP: @brief Genera un nuevo Master Boot Record en el disco duro indicado, compatible con los SO tipo Windows |
---|
| 355 | #@param $1 obligatorio int_numdisk |
---|
| 356 | #@return salida del programa my-sys |
---|
| 357 | #@warning no definidos |
---|
| 358 | #@attention Requisitos: my-sys, compilado ubicado en /var/EAC/admin/source |
---|
| 359 | #@note |
---|
| 360 | #@version 0.1 Date: 27/10/2008 Author Antonio J. Doblas Viso. Universidad de Malaga |
---|
| 361 | #*/ |
---|
| 362 | # |
---|
| 363 | if [ $# = 0 ] |
---|
| 364 | then |
---|
| 365 | Msg "sintaxis: ogNewMbrXP int_disco " red |
---|
| 366 | return |
---|
| 367 | fi |
---|
| 368 | if [ $# = 1 ] |
---|
| 369 | then |
---|
| 370 | particion=`ogDiskToDev $1` |
---|
| 371 | ms-sys -z -f $particion |
---|
| 372 | ms-sys -m -f $particion |
---|
| 373 | fi |
---|
| 374 | } |
---|