Mario Gzuk wrote:
> Hi,
>
>   
>> Btw, i have come to solution to provide on-demand remote
>> re-installations, using a conjunction of samba and PXE booting. I don't
>> remember seing anything like that in any docs, or even on
>> unattended-gui. Would it be benificial to post such solution here?
>>
>>     
>
> can you explain this some more in detail? unattended and unattended-gui
> supports both PXE booting and samba. With unattended-gui you can make a
> "one-click"- reinstall with the old configuration (partitioning,os,
> software).
> But I dont know exactly what you want to do....
>
>
> greetings mario
>
>   

Hi Mario,

I might have overlooked unattended-gui, so it might do just that. I'll 
elaborate a bit now.

All workstations are prepared to always boot from PXE, having as second 
boot device the local hard disk.
The default PXE boot presents a small menu with two choices, normal boot 
(local hard disk) and maintenance boot (network boot).

# cat /tftpboot/pxelinux.cfg/default

DEFAULT menu.c32
PROMPT 0
NOESCAPE 1
ALLOWOPTIONS 0
MENU TITLE Boot Options
TIMEOUT 40
ONTIMEOUT chain.c32 hd0 1

LABEL local
    MENU LABEL ^Proceed normal boot
    LOCALBOOT 0

LABEL install
    MENU LABEL ^Maintenance
    MENU PASSWD $4$o29hIUr3S$zajgflJvXUL2o94IQeJblILmCMUA$
        KERNEL bzImage
        APPEND initrd=initrd z_user=Administrator z_pass=secretpass 
z_path=//myserver.mydomain.com/install



Ok, now besides that file, i also have another boot file

# cat /tftpboot/pxelinux.cfg/force-reinstall

default unattended

label unattended
        KERNEL bzImage
# Add options (z_user=..., z_path=..., etc.) to this line.
        APPEND initrd=initrd z_user=Administrator z_pass=secretpass 
z_path=//myserver.mydomain.com/install



I have also made two small scripts that will basically create/remove a 
symblink to each of these pxe configuration files.

# cat /usr/local/bin/reinstall.sh
#!/bin/bash

# In case the share/boot server is in the same network as the 
workstations, you can grab the MAC_ADDR directly
#ARP_ADDR=`arp -n | grep "$IP_ADDR " | awk '{print tolower($3)}' | sed 
's/:/-/g'`

# In the case the share/boot server is also your dhcp server (ISC DHCP), 
and have fixed ips, you can grab the MAC_ADDR from there
#MAC_ADDR=`grep -i $1 /etc/dhcp3/dhcpd.conf | grep "#" | awk '{print 
tolower($3)}' | sed 's/:/-/g'`

# In the case this machine is just a file/boot server, in a different 
network. We can try grabbing from unattended MAC declarations
MAC_ADDR=`grep -i $1 
/home/samba/unattended-4.6/install/site/unattend.csv | head -n 1 | awk 
-F '"' '{print $2}' | sed -r 
's...@^(.{2})(.{2})(.{2})(.{2})(.{2})@\1-\2-\3-\4-...@g' | awk '{print 
tolower($_)}'`

if [ -n "$MAC_ADDR" ]; then
    ln -s /tftpboot/pxelinux.cfg/force-reinstall 
/tftpboot/pxelinux.cfg/01-"$MAC_ADDR"
fi
# If you have winexe, you can reboot this same second
#winexe -U MYDOMAIN/Administrator%secretpass //$1 'cmd shutdown -r -t 01'



Then, to be able to remove the symblink

cat /usr/local/bin/remove-tftp-file.sh
#!/bin/bash

# If the share/boot server is in the same network as the workstations, 
you can grab the MAC_ADDR directly
#ARP_ADDR=`arp -n | grep "$1 " | awk '{print tolower($3)}' | sed 's/:/-/g'`

IP_ADDR=`echo $1 | sed 's...@.*_@@'`
MACHINE_NAME=`host $IP_ADDR|sed -r 's@(.* )(\w*)(.*)@\2@'`

ARP_ADDR=`grep -i $MACHINE_NAME 
/home/samba/unattended-4.6/install/site/unattend.csv | head -n 1 | awk 
-F '"' '{print $2}' | sed -r 
's...@^(.{2})(.{2})(.{2})(.{2})(.{2})@\1-\2-\3-\4-...@g' | awk '{print 
tolower($_)}'`


if [ -n "$ARP_ADDR" ]; then
    BOOT_FILE=/tftpboot/pxelinux.cfg/01-"$ARP_ADDR"
    rm -f $BOOT_FILE
fi






Ok .. so now i just plugged this into samba.


[Install]
comment = Unattended Install
path = /home/samba/unattended-4.6/install
browseable = no
writeable = no
public = no
root preexec = /usr/local/bin/remove-tftp-file.sh %m




Now, to reinstall a machine, remotelly i just need to run reinstall.sh 
and that workstation will be marked for reinstall. The next boot the 
machine does (which can be forced using winexe for instance - 
http://eol.ovh.org/winexe/), it will enter the second pxe configuration 
and start the install process. When the machine starts installing, by 
accessing the "install" share, the symblink is removed from the pxelinux 
directory, avoiding the endless boot/install process.

Although this is working jusr fine, feel free to guide to a simpler way 
of doing this.

Regards,

Hugo Monteiro.

-- 
ci.fct.unl.pt:~# cat .signature

Hugo Monteiro
Email    : hugo.monte...@fct.unl.pt
Telefone : +351 212948300 Ext.15307
Web      : http://hmonteiro.net

Centro de Informática
Faculdade de Ciências e Tecnologia da
                   Universidade Nova de Lisboa
Quinta da Torre   2829-516 Caparica   Portugal
Telefone: +351 212948596   Fax: +351 212948548
www.ci.fct.unl.pt             ap...@fct.unl.pt

ci.fct.unl.pt:~# _


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
unattended-info mailing list
unattended-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unattended-info

Reply via email to