root/contrib/pxe-installer/init

Revision 81fb2efee8df38077a5ddb0a836433287e729ac9, 1.3 KB (checked in by Frederic Lepied <frederic.lepied@…>, 3 years ago)

do not use the mac address anymore

  • Property mode set to 100755
Line 
1#!/bin/bash
2
3PATH=/usr/sbin:/usr/bin:/sbin:/bin
4export PATH
5
6set -x
7
8mount /proc
9
10booturl=http://10.33.0.1:8000
11insturl=http://10.33.0.1/profiles
12
13eval `cat /proc/cmdline | tr " " "\n" | grep booturl=`
14eval `cat /proc/cmdline | tr " " "\n" | grep insturl=`
15
16# usb setup
17if grep -q ' usb' /proc/cmdline; then
18    modprobe ohci-hcd
19    modprobe ehci-hcd
20    modprobe usbhid
21fi
22
23# setup network
24pciids=`lspci -n|grep ' 0200: '|sed 's/.*\([0-9a-f]\{4\}\):\([0-9a-f]\{4\}\).*/0x0000\1 0x0000\2/'|sort -u`
25kver=`uname -r`
26
27for pciid in $pciids; do
28    modules=`grep "$pciid" /lib/modules/$kver/modules.pcimap |cut -f1 -d' '|sort -u`
29   
30    for module in $modules; do
31        modprobe $module && break
32    done
33done
34
35dhclient eth0
36
37# request install script from the server
38mac=`ifconfig |grep HWaddr|sed -e 's/.*HWaddr //' -e 's/-/:/' -e 's/ *//g' |head -1`
39profile=`wget -q -O- $booturl/profile/`
40wget -q $insturl/$profile/install.script || wget -q $insturl/install.script
41export profile
42chmod +x install.script
43./install.script 2>&1 | tee log
44
45# request localboot if the install script exited with a good status
46if [ $? = 0 ]; then
47    wget -q $booturl/localboot/
48else
49    echo "failed install"
50fi
51
52# if debug is passed on the cmdline of the kernel, launch a shell else reboot
53if grep -q ' debug' /proc/cmdline; then
54    exec /bin/bash
55else
56    reboot -f
57fi
58
59# init ends here
Note: See TracBrowser for help on using the browser.