[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-clonage/sources/scripts/ -> pxe_gen_cfg.sh (source)

   1  #!/bin/bash
   2  
   3  # $Id: pxe_gen_cfg.sh 8426 2015-02-03 08:08:34Z crob $
   4  # Auteur: Stephane Boireau
   5  # Dernire modification: 12/2014
   6  
   7  # Ajout en visudo:
   8  # Cmnd_Alias SE3CLONAGE=/usr/share/se3/scripts/se3_tftp_boot_pxe.sh,/usr/share/se3/scripts/pxe_gen_cfg.sh
   9  
  10  timestamp=$(date +%s)
  11  timedate=$(date "+%Y-%m-%d %H:%M:%S")
  12  
  13  #===========================================
  14  if [ -e /var/www/se3/includes/config.inc.php ]; then
  15      dbhost=`cat /var/www/se3/includes/config.inc.php | grep "dbhost=" | cut -d = -f 2 |cut -d \" -f 2`
  16      dbname=`cat /var/www/se3/includes/config.inc.php | grep "dbname=" | cut -d = -f 2 |cut -d \" -f 2`
  17      dbuser=`cat /var/www/se3/includes/config.inc.php | grep "dbuser=" | cut -d = -f 2 |cut -d \" -f 2`
  18      dbpass=`cat /var/www/se3/includes/config.inc.php | grep "dbpass=" | cut -d = -f 2 |cut -d \" -f 2`
  19  else
  20      echo "Fichier de conf inaccessible"
  21      exit 1
  22  fi
  23  
  24  tftp_slitaz_cmdline=$(echo "SELECT value FROM params WHERE name='tftp_slitaz_cmdline';"|mysql -N -h $dbhost -u $dbuser -p$dbpass $dbname)
  25  
  26  # On pourra peut-etre remplacer par une autre machine pour heberger le serveur web requis pour le telechargement... pour alleger la charge pesant sur SE3
  27  
  28  # A FAIRE: Pouvoir mettre le sysrcd.dat sur un autre serveur web
  29  se3ip=$(echo "SELECT value FROM params WHERE name='se3ip';"|mysql -N -h $dbhost -u $dbuser -p$dbpass $dbname)
  30  www_sysrcd_ip=$se3ip
  31  #===========================================
  32  
  33  case $1 in
  34  
  35  
  36  "install_linux")
  37  
  38  
  39  mac=$(echo "$2" | sed -e "s/:/-/g")
  40          ip=$3
  41          pc=$4
  42          url_preseed=$5
  43          architecture=$6
  44  
  45          # on regenere unattend.csv
  46          /usr/share/se3/scripts/unattended_generate.sh -u > /dev/null
  47  
  48          fich=/tftpboot/pxelinux.cfg/01-$mac
  49  
  50          echo "# Script de boot de la machine $pc
  51  # MAC=$mac
  52  # IP= $ip
  53  # Date de generation du fichier: $timedate
  54  # Timestamp: $timestamp
  55  
  56  # Echappatoires pour booter sur le DD:
  57  label 0
  58     localboot 0x80
  59  label a
  60     localboot 0x00
  61  label q
  62     localboot -1
  63  label disk1
  64     localboot 0x80
  65  label disk2
  66    localboot 0x81
  67  
  68  # Label d'install linux :
  69  label linuxinst
  70  KERNEL  debian-installer/$architecture/linux
  71  APPEND  ramdisk_size=7680 language=fr locale=fr_FR.UTF-8 console-setup/layoutcode=fr_FR netcfg/wireless_wep= netcfg/choose_interface=eth0 netcfg/dhcp_timeout=60 netcfg/get_hostname=poste netcfg/get_domain=intranet.local keyboard-configuration/xkb-keymap=fr languagechooser/language-name=French countrychooser/shortlist=FR console-keymaps-at/keymap=fr debian-installer/country=FR  debian-installer/locale=fr_FR.UTF-8 preseed/url=$url_preseed initrd=debian-installer/$architecture/initrd.gz --
  72      
  73  # Choix de boot par dfaut:
  74  default linuxinst
  75  
  76  # On boote aprs 6 secondes:
  77  timeout 60
  78  
  79  # Permet-on  l'utilisateur de choisir l'option de boot?
  80  # Si on ne permet pas, le timeout n'est pas pris en compte.
  81  prompt 1
  82  " > $fich
  83  
  84      ;;
  85  
  86  
  87  
  88  
  89  
  90      "sauve")
  91          #mac=$(echo "$2" | sed -e "s/:/-/g")
  92          #ip=$3
  93          #pc=$4
  94          #nom_image=$(echo "$5" | tr "[]" "[AAAEEEEIIOOUUUCcaaaeeeeiioouuu]" | sed -e "s/[^A-Za-z0-9_.]//g")
  95          #src_part=$6
  96          #dest_part=$7
  97          #auto_reboot=$8
  98          #delais_reboot=$9
  99          #del_old_svg=${10}
 100  
 101          mac=$(echo "$*" | sed -e "s| |\n|g"|grep "^mac="|cut -d"=" -f2 | sed -e "s/:/-/g")
 102          ip=$(echo "$*" | sed -e "s| |\n|g"|grep "^ip="|cut -d"=" -f2)
 103          pc=$(echo "$*" | sed -e "s| |\n|g"|grep "pc="|cut -d"=" -f2)
 104          nom_image=$(echo "$*" | sed -e "s| |\n|g"|grep "^nom_image="|cut -d"=" -f2 | tr "[]" "[AAAEEEEIIOOUUUCcaaaeeeeiioouuu]" | sed -e "s/[^A-Za-z0-9_.]//g")
 105          src_part=$(echo "$*" | sed -e "s| |\n|g"|grep "^src_part="|cut -d"=" -f2)
 106          dest_part=$(echo "$*" | sed -e "s| |\n|g"|grep "dest_part="|cut -d"=" -f2)
 107          auto_reboot=$(echo "$*" | sed -e "s| |\n|g"|grep "auto_reboot="|cut -d"=" -f2)
 108          delais_reboot=$(echo "$*" | sed -e "s| |\n|g"|grep "delais_reboot="|cut -d"=" -f2)
 109          del_old_svg=$(echo "$*" | sed -e "s| |\n|g"|grep "del_old_svg="|cut -d"=" -f2)
 110  
 111          if [ "$auto_reboot" != "y" -a "$auto_reboot" != "halt" ]; then
 112              auto_reboot="n"
 113          fi
 114  
 115          verif=$(echo "$delais_reboot" | sed -e "s/[0-9]//g")
 116          if [ "x$verif" != "x" ]; then
 117              delais_reboot=60
 118          fi
 119  
 120          ajout=""
 121          if [ -n "$del_old_svg" ]; then
 122              ajout=" del_old_svg=$del_old_svg"
 123          fi
 124  
 125          fich=/tftpboot/pxelinux.cfg/01-$mac
 126  
 127          chaine_modules=""
 128          if [ -e /var/www/se3/includes/config.inc.php ]; then
 129              dbhost=`cat /var/www/se3/includes/config.inc.php | grep "dbhost=" | cut -d = -f 2 |cut -d \" -f 2`
 130              dbname=`cat /var/www/se3/includes/config.inc.php | grep "dbname=" | cut -d = -f 2 |cut -d \" -f 2`
 131              dbuser=`cat /var/www/se3/includes/config.inc.php | grep "dbuser=" | cut -d = -f 2 |cut -d \" -f 2`
 132              dbpass=`cat /var/www/se3/includes/config.inc.php | grep "dbpass=" | cut -d = -f 2 |cut -d \" -f 2`
 133  
 134              tmp_mac=$(echo "$mac"|tr "-" ":")
 135              tmp_module=($(echo "SELECT valeur FROM se3_tftp_infos WHERE mac='$tmp_mac';"|mysql -N -h $dbhost -u $dbuser -p$dbpass $dbname| tr "[A-Z]" "[a-z]"))
 136              nbmodules=${#tmp_module[*]}
 137  
 138              if [ $nbmodules -gt 0 ]; then
 139                  chaine_modules="modprobe="
 140                  index=0
 141                  while [ $index -lt $nbmodules ]
 142                  do
 143                      if [ $index -gt 0 ]; then
 144                          chaine_modules="$chaine_modules,"
 145                      fi
 146                      chaine_modules="$chaine_modules}$tmp_module[$index]}"
 147                      index=$(($index+1))
 148                  done
 149                  chaine_modules="$chaine_modules "
 150              fi
 151          fi
 152  
 153  
 154          echo "# Script de boot de la machine $pc
 155  # MAC=$mac
 156  # IP= $ip
 157  # Date de generation du fichier: $timedate
 158  # Timestamp: $timestamp
 159  
 160  # Echappatoires pour booter sur le DD:
 161  label 0
 162     localboot 0x80
 163  label a
 164     localboot 0x00
 165  label q
 166     localboot -1
 167  label disk1
 168     localboot 0x80
 169  label disk2
 170    localboot 0x81
 171  
 172  # Label distribution SliTaz:
 173  label taz
 174     kernel bzImage
 175     append initrd=rootfs.gz rw root=/dev/null lang=fr_FR kmap=fr-latin1 vga=normal sound=no screen=text
 176  
 177  # Label de sauvegarde:
 178  label tazsvg
 179     kernel bzImage" > $fich
 180  
 181          if [ -z "$nom_image" ]; then
 182              echo "   append initrd=rootfs.gz rw root=/dev/null lang=fr_FR kmap=fr-latin1 vga=normal screen=text sound=no src_part=$src_part dest_part=$dest_part auto_reboot=$auto_reboot delais_reboot=$delais_reboot $ajout} work=/root/bin/sauve_part.sh $chaine_modules} $tftp_slitaz_cmdline}" >> $fich
 183          else
 184              echo "   append initrd=rootfs.gz rw root=/dev/null lang=fr_FR kmap=fr-latin1 vga=normal screen=text sound=no src_part=$src_part dest_part=$dest_part nom_image=$nom_image auto_reboot=$auto_reboot delais_reboot=$delais_reboot $ajout} work=/root/bin/sauve_part.sh $chaine_modules} $tftp_slitaz_cmdline}" >> $fich
 185          fi
 186  
 187          echo "
 188  # Choix de boot par dfaut:
 189  default tazsvg
 190  
 191  # On boote aprs 6 secondes:
 192  timeout 60
 193  
 194  # Permet-on  l'utilisateur de choisir l'option de boot?
 195  # Si on ne permet pas, le timeout n'est pas pris en compte.
 196  prompt 1
 197  " >> $fich
 198      ;;
 199  
 200      "restaure")
 201          #mac=$(echo "$2" | sed -e "s/:/-/g")
 202          #ip=$3
 203          #pc=$4
 204          #nom_image=$(echo "$5" | tr "[]" "[AAAEEEEIIOOUUUCcaaaeeeeiioouuu]" | sed -e "s/[^A-Za-z0-9_.]//g")
 205          #src_part=$6
 206          #dest_part=$7
 207          #auto_reboot=$8
 208          #delais_reboot=$9
 209  
 210          mac=$(echo "$*" | sed -e "s| |\n|g"|grep "^mac="|cut -d"=" -f2 | sed -e "s/:/-/g")
 211          ip=$(echo "$*" | sed -e "s| |\n|g"|grep "^ip="|cut -d"=" -f2)
 212          pc=$(echo "$*" | sed -e "s| |\n|g"|grep "pc="|cut -d"=" -f2)
 213          nom_image=$(echo "$*" | sed -e "s| |\n|g"|grep "^nom_image="|cut -d"=" -f2| tr "[]" "[AAAEEEEIIOOUUUCcaaaeeeeiioouuu]" | sed -e "s/[^A-Za-z0-9_.]//g")
 214          src_part=$(echo "$*" | sed -e "s| |\n|g"|grep "^src_part="|cut -d"=" -f2)
 215          dest_part=$(echo "$*" | sed -e "s| |\n|g"|grep "dest_part="|cut -d"=" -f2)
 216          auto_reboot=$(echo "$*" | sed -e "s| |\n|g"|grep "auto_reboot="|cut -d"=" -f2)
 217          delais_reboot=$(echo "$*" | sed -e "s| |\n|g"|grep "delais_reboot="|cut -d"=" -f2)
 218  
 219          #if [ "$auto_reboot" != "y" ]; then
 220          if [ "$auto_reboot" != "y" -a "$auto_reboot" != "halt" ]; then
 221              auto_reboot="n"
 222          fi
 223  
 224          verif=$(echo "$delais_reboot" | sed -e "s/[0-9]//g")
 225          if [ "x$verif" != "x" ]; then
 226              delais_reboot=60
 227          fi
 228  
 229          fich=/tftpboot/pxelinux.cfg/01-$mac
 230  
 231          chaine_modules=""
 232          if [ -e /var/www/se3/includes/config.inc.php ]; then
 233              dbhost=`cat /var/www/se3/includes/config.inc.php | grep "dbhost=" | cut -d = -f 2 |cut -d \" -f 2`
 234              dbname=`cat /var/www/se3/includes/config.inc.php | grep "dbname=" | cut -d = -f 2 |cut -d \" -f 2`
 235              dbuser=`cat /var/www/se3/includes/config.inc.php | grep "dbuser=" | cut -d = -f 2 |cut -d \" -f 2`
 236              dbpass=`cat /var/www/se3/includes/config.inc.php | grep "dbpass=" | cut -d = -f 2 |cut -d \" -f 2`
 237  
 238              tmp_mac=$(echo "$mac"|tr "-" ":")
 239              tmp_module=($(echo "SELECT valeur FROM se3_tftp_infos WHERE mac='$tmp_mac';"|mysql -N -h $dbhost -u $dbuser -p$dbpass $dbname| tr "[A-Z]" "[a-z]"))
 240              nbmodules=${#tmp_module[*]}
 241  
 242              if [ $nbmodules -gt 0 ]; then
 243                  chaine_modules="modprobe="
 244                  index=0
 245                  while [ $index -lt $nbmodules ]
 246                  do
 247                      if [ $index -gt 0 ]; then
 248                          chaine_modules="$chaine_modules,"
 249                      fi
 250                      chaine_modules="$chaine_modules}$tmp_module[$index]}"
 251                      index=$(($index+1))
 252                  done
 253                  chaine_modules="$chaine_modules "
 254              fi
 255          fi
 256  
 257          echo "# Script de boot de la machine $pc
 258  # MAC=$mac
 259  # IP= $ip
 260  # Date de generation du fichier: $timedate
 261  # Timestamp: $timestamp
 262  
 263  # Echappatoires pour booter sur le DD:
 264  label 0
 265     localboot 0x80
 266  label a
 267     localboot 0x00
 268  label q
 269     localboot -1
 270  label disk1
 271     localboot 0x80
 272  label disk2
 273    localboot 0x81
 274  
 275  # Label distribution SliTaz:
 276  label taz
 277     kernel bzImage
 278     append initrd=rootfs.gz rw root=/dev/null lang=fr_FR kmap=fr-latin1 vga=normal sound=no screen=text
 279  
 280  # Label de restauration:
 281  label tazrst
 282     kernel bzImage" > $fich
 283  
 284          if [ -z "$nom_image" ]; then
 285              echo "   append initrd=rootfs.gz rw root=/dev/null lang=fr_FR kmap=fr-latin1 vga=normal screen=text sound=no src_part=$src_part dest_part=$dest_part auto_reboot=$auto_reboot delais_reboot=$delais_reboot work=/root/bin/restaure_part.sh $chaine_modules} $tftp_slitaz_cmdline}" >> $fich
 286          else
 287              echo "   append initrd=rootfs.gz rw root=/dev/null lang=fr_FR kmap=fr-latin1 vga=normal screen=text sound=no src_part=$src_part dest_part=$dest_part nom_image=$nom_image auto_reboot=$auto_reboot delais_reboot=$delais_reboot work=/root/bin/restaure_part.sh $chaine_modules} $tftp_slitaz_cmdline}" >> $fich
 288          fi
 289  
 290          echo "
 291  # Choix de boot par dfaut:
 292  default tazrst
 293  
 294  # On boote aprs 6 secondes:
 295  timeout 60
 296  
 297  # Permet-on  l'utilisateur de choisir l'option de boot?
 298  # Si on ne permet pas, le timeout n'est pas pris en compte.
 299  prompt 1
 300  " >> $fich
 301      ;;
 302  
 303      "sysresccd_sauve")
 304          #mac=$(echo "$2" | sed -e "s/:/-/g")
 305          #ip=$3
 306          #pc=$4
 307          #nom_image=$(echo "$5" | tr "[]" "[AAAEEEEIIOOUUUCcaaaeeeeiioouuu]" | sed -e "s/[^A-Za-z0-9_.]//g")
 308          #src_part=$6
 309          #dest_part=$7
 310          #auto_reboot=$8
 311          #delais_reboot=$9
 312          #del_old_svg=${10}
 313  
 314          mac=$(echo "$*" | sed -e "s| |\n|g"|grep "^mac="|cut -d"=" -f2 | sed -e "s/:/-/g")
 315          ip=$(echo "$*" | sed -e "s| |\n|g"|grep "^ip="|cut -d"=" -f2)
 316          pc=$(echo "$*" | sed -e "s| |\n|g"|grep "pc="|cut -d"=" -f2)
 317          nom_image=$(echo "$*" | sed -e "s| |\n|g"|grep "^nom_image="|cut -d"=" -f2 | tr "[]" "[AAAEEEEIIOOUUUCcaaaeeeeiioouuu]" | sed -e "s/[^A-Za-z0-9_.]//g")
 318          src_part=$(echo "$*" | sed -e "s| |\n|g"|grep "^src_part="|cut -d"=" -f2)
 319          dest_part=$(echo "$*" | sed -e "s| |\n|g"|grep "dest_part="|cut -d"=" -f2)
 320          auto_reboot=$(echo "$*" | sed -e "s| |\n|g"|grep "auto_reboot="|cut -d"=" -f2)
 321          delais_reboot=$(echo "$*" | sed -e "s| |\n|g"|grep "delais_reboot="|cut -d"=" -f2)
 322          del_old_svg=$(echo "$*" | sed -e "s| |\n|g"|grep "del_old_svg="|cut -d"=" -f2)
 323  
 324          type_svg=$(echo "$*" | sed -e "s| |\n|g"|grep "type_svg="|cut -d"=" -f2)
 325          if [ -z "$type_svg" ]; then
 326              type_svg="partimage"
 327          else
 328              if [ "$type_svg" != "partimage" -a "$type_svg" != "ntfsclone" -a "$type_svg" != "fsarchiver" ]; then
 329                  type_svg="partimage"
 330              fi
 331          fi
 332  
 333          kernel=$(echo "$*" | sed -e "s| |\n|g"|grep "^kernel="|cut -d"=" -f2)
 334          if [ "$kernel" = "rescuecd" -a ! -e "/tftpboot/rescuecd" -a -e "/tftpboot/rescue32" ]; then
 335              kernel="rescue32"
 336          fi
 337          if [ "$kernel" = "rescue32" -a ! -e "/tftpboot/rescue32" -a -e "/tftpboot/rescuecd" ]; then
 338              kernel="rescuecd"
 339          fi
 340  
 341          if [ "$kernel" = "auto" ]; then
 342              kernel="ifcpu64.c32"
 343          fi
 344  
 345          url_authorized_keys=$(echo "$*" | sed -e "s| |\n|g"|grep "^url_authorized_keys="|cut -d"=" -f2)
 346          if [ -n "$url_authorized_keys" ]; then
 347              opt_url_authorized_keys=" url_authorized_keys=$url_authorized_keys"
 348          else
 349              opt_url_authorized_keys=""
 350          fi
 351  
 352          if [ "$auto_reboot" != "y" -a "$auto_reboot" != "halt" ]; then
 353              auto_reboot="n"
 354          fi
 355  
 356          verif=$(echo "$delais_reboot" | sed -e "s/[0-9]//g")
 357          if [ "x$verif" != "x" ]; then
 358              delais_reboot=60
 359          fi
 360  
 361          ajout=""
 362          if [ -n "$del_old_svg" ]; then
 363              ajout=" del_old_svg=$del_old_svg"
 364          fi
 365  
 366          fich=/tftpboot/pxelinux.cfg/01-$mac
 367  
 368          echo "# Script de boot de la machine $pc
 369  # MAC=$mac
 370  # IP= $ip
 371  # Date de generation du fichier: $timedate
 372  # Timestamp: $timestamp
 373  
 374  # Echappatoires pour booter sur le DD:
 375  label 0
 376     localboot 0x80
 377  label a
 378     localboot 0x00
 379  label q
 380     localboot -1
 381  label disk1
 382     localboot 0x80
 383  label disk2
 384    localboot 0x81
 385  
 386  # Label de sauvegarde:
 387  label sysrcdsvg
 388      kernel $kernel
 389      #initrd initram.igz" > $fich
 390  # A revoir: On peut avoir besoin de altker32,... au lieu de rescuecd
 391  
 392  # kernel rescuecd
 393  # initrd initram.igz
 394  # APPEND scandelay=1 setkmap=fr autoruns=0 ar_nowait vga=791
 395  # 
 396  
 397          if [ "$kernel" = "ifcpu64.c32" ]; then
 398              if [ "$dest_part:0:4}" = "smb:" ]; then
 399                  if [ -z "$nom_image" ]; then
 400                      echo "   append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp src_part=$src_part dest_part=$dest_part/$mac auto_reboot=$auto_reboot delais_reboot=$delais_reboot nom_machine=$pc mac_machine=$mac work=sauve_part.sh hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} type_svg=$type_svg $ajout} -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp src_part=$src_part dest_part=$dest_part/$mac auto_reboot=$auto_reboot delais_reboot=$delais_reboot nom_machine=$pc mac_machine=$mac work=sauve_part.sh hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} type_svg=$type_svg $ajout}" >> $fich
 401                  else
 402                      echo "   append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp src_part=$src_part dest_part=$dest_part/$mac nom_image=$nom_image auto_reboot=$auto_reboot delais_reboot=$delais_reboot nom_machine=$pc mac_machine=$mac work=sauve_part.sh hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} type_svg=$type_svg $ajout} -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp src_part=$src_part dest_part=$dest_part/$mac nom_image=$nom_image auto_reboot=$auto_reboot delais_reboot=$delais_reboot nom_machine=$pc mac_machine=$mac work=sauve_part.sh hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} type_svg=$type_svg $ajout}" >> $fich
 403                  fi
 404              else
 405                  if [ -z "$nom_image" ]; then
 406                      echo "   append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp src_part=$src_part dest_part=$dest_part auto_reboot=$auto_reboot delais_reboot=$delais_reboot work=sauve_part.sh hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} type_svg=$type_svg $ajout} -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp src_part=$src_part dest_part=$dest_part auto_reboot=$auto_reboot delais_reboot=$delais_reboot work=sauve_part.sh hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} type_svg=$type_svg $ajout}" >> $fich
 407                  else
 408                      echo "   append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp src_part=$src_part dest_part=$dest_part nom_image=$nom_image auto_reboot=$auto_reboot delais_reboot=$delais_reboot work=sauve_part.sh hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} type_svg=$type_svg $ajout} -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp src_part=$src_part dest_part=$dest_part nom_image=$nom_image auto_reboot=$auto_reboot delais_reboot=$delais_reboot work=sauve_part.sh hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} type_svg=$type_svg $ajout}" >> $fich
 409                  fi
 410              fi
 411          else
 412              if [ "$dest_part:0:4}" = "smb:" ]; then
 413                  if [ -z "$nom_image" ]; then
 414                      echo "   append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp src_part=$src_part dest_part=$dest_part/$mac auto_reboot=$auto_reboot delais_reboot=$delais_reboot nom_machine=$pc mac_machine=$mac work=sauve_part.sh hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} type_svg=$type_svg $ajout}" >> $fich
 415                  else
 416                      echo "   append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp src_part=$src_part dest_part=$dest_part/$mac nom_image=$nom_image auto_reboot=$auto_reboot delais_reboot=$delais_reboot nom_machine=$pc mac_machine=$mac work=sauve_part.sh hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} type_svg=$type_svg $ajout}" >> $fich
 417                  fi
 418              else
 419                  if [ -z "$nom_image" ]; then
 420                      echo "   append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp src_part=$src_part dest_part=$dest_part auto_reboot=$auto_reboot delais_reboot=$delais_reboot work=sauve_part.sh hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} type_svg=$type_svg $ajout}" >> $fich
 421                  else
 422                      echo "   append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp src_part=$src_part dest_part=$dest_part nom_image=$nom_image auto_reboot=$auto_reboot delais_reboot=$delais_reboot work=sauve_part.sh hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} type_svg=$type_svg $ajout}" >> $fich
 423                  fi
 424              fi
 425          fi
 426  
 427          echo "
 428  # Choix de boot par dfaut:
 429  default sysrcdsvg
 430  
 431  # On boote aprs 6 secondes:
 432  timeout 60
 433  
 434  # Permet-on  l'utilisateur de choisir l'option de boot?
 435  # Si on ne permet pas, le timeout n'est pas pris en compte.
 436  prompt 1
 437  " >> $fich
 438      ;;
 439  
 440      "sysresccd_restaure")
 441          #mac=$(echo "$2" | sed -e "s/:/-/g")
 442          #ip=$3
 443          #pc=$4
 444          #nom_image=$(echo "$5" | tr "[]" "[AAAEEEEIIOOUUUCcaaaeeeeiioouuu]" | sed -e "s/[^A-Za-z0-9_.]//g")
 445          #src_part=$6
 446          #dest_part=$7
 447          #auto_reboot=$8
 448          #delais_reboot=$9
 449  
 450          mac=$(echo "$*" | sed -e "s| |\n|g"|grep "^mac="|cut -d"=" -f2 | sed -e "s/:/-/g")
 451          ip=$(echo "$*" | sed -e "s| |\n|g"|grep "^ip="|cut -d"=" -f2)
 452          pc=$(echo "$*" | sed -e "s| |\n|g"|grep "pc="|cut -d"=" -f2)
 453          nom_image=$(echo "$*" | sed -e "s| |\n|g"|grep "^nom_image="|cut -d"=" -f2 | tr "[]" "[AAAEEEEIIOOUUUCcaaaeeeeiioouuu]" | sed -e "s/[^A-Za-z0-9_.]//g")
 454          src_part=$(echo "$*" | sed -e "s| |\n|g"|grep "^src_part="|cut -d"=" -f2)
 455          dest_part=$(echo "$*" | sed -e "s| |\n|g"|grep "dest_part="|cut -d"=" -f2)
 456          auto_reboot=$(echo "$*" | sed -e "s| |\n|g"|grep "auto_reboot="|cut -d"=" -f2)
 457          delais_reboot=$(echo "$*" | sed -e "s| |\n|g"|grep "delais_reboot="|cut -d"=" -f2)
 458  
 459          #type_svg=$(echo "$*" | sed -e "s| |\n|g"|grep "type_svg="|cut -d"=" -f2)
 460          #if [ -z "$type_svg" ]; then
 461          #    type_svg="partimage"
 462          #else
 463          #    if [ "$type_svg" != "partimage" -a "$type_svg" != "ntfsclone" -a "$type_svg" != "fsarchiver" ]; then
 464          #        type_svg="partimage"
 465          #    fi
 466          #fi
 467  
 468          kernel=$(echo "$*" | sed -e "s| |\n|g"|grep "^kernel="|cut -d"=" -f2)
 469          if [ "$kernel" = "rescuecd" -a ! -e "/tftpboot/rescuecd" -a -e "/tftpboot/rescue32" ]; then
 470              kernel="rescue32"
 471          fi
 472          if [ "$kernel" = "rescue32" -a ! -e "/tftpboot/rescue32" -a -e "/tftpboot/rescuecd" ]; then
 473              kernel="rescuecd"
 474          fi
 475  
 476          if [ "$kernel" = "auto" ]; then
 477              kernel="ifcpu64.c32"
 478          fi
 479  
 480          url_authorized_keys=$(echo "$*" | sed -e "s| |\n|g"|grep "^url_authorized_keys="|cut -d"=" -f2)
 481          if [ -n "$url_authorized_keys" ]; then
 482              opt_url_authorized_keys=" url_authorized_keys=$url_authorized_keys"
 483          else
 484              opt_url_authorized_keys=""
 485          fi
 486  
 487          #if [ "$auto_reboot" != "y" ]; then
 488          if [ "$auto_reboot" != "y" -a "$auto_reboot" != "halt" ]; then
 489              auto_reboot="n"
 490          fi
 491  
 492          verif=$(echo "$delais_reboot" | sed -e "s/[0-9]//g")
 493          if [ "x$verif" != "x" ]; then
 494              delais_reboot=60
 495          fi
 496  
 497          fich=/tftpboot/pxelinux.cfg/01-$mac
 498  
 499          echo "# Script de boot de la machine $pc
 500  # MAC=$mac
 501  # IP= $ip
 502  # Date de generation du fichier: $timedate
 503  # Timestamp: $timestamp
 504  
 505  # Echappatoires pour booter sur le DD:
 506  label 0
 507     localboot 0x80
 508  label a
 509     localboot 0x00
 510  label q
 511     localboot -1
 512  label disk1
 513     localboot 0x80
 514  label disk2
 515    localboot 0x81
 516  
 517  # Label de restauration:
 518  label sysrcdrst
 519      kernel $kernel
 520      #initrd initram.igz" > $fich
 521  
 522          if [ "$kernel" = "ifcpu64.c32" ]; then
 523              if [ "$src_part:0:4}" = "smb:" ]; then
 524                  if [ -z "$nom_image" ]; then
 525                      echo "   append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp src_part=$src_part dest_part=$dest_part auto_reboot=$auto_reboot delais_reboot=$delais_reboot work=restaure_part.sh nom_machine=$pc mac_machine=$mac hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp src_part=$src_part dest_part=$dest_part auto_reboot=$auto_reboot delais_reboot=$delais_reboot work=restaure_part.sh nom_machine=$pc mac_machine=$mac hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline}" >> $fich
 526                  else
 527                      echo "   append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp src_part=$src_part dest_part=$dest_part nom_image=$nom_image auto_reboot=$auto_reboot delais_reboot=$delais_reboot work=restaure_part.sh nom_machine=$pc mac_machine=$mac hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp src_part=$src_part dest_part=$dest_part nom_image=$nom_image auto_reboot=$auto_reboot delais_reboot=$delais_reboot work=restaure_part.sh nom_machine=$pc mac_machine=$mac hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline}" >> $fich
 528                  fi
 529              else
 530                  if [ -z "$nom_image" ]; then
 531                      echo "   append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp src_part=$src_part dest_part=$dest_part auto_reboot=$auto_reboot delais_reboot=$delais_reboot work=restaure_part.sh hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp src_part=$src_part dest_part=$dest_part auto_reboot=$auto_reboot delais_reboot=$delais_reboot work=restaure_part.sh hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline}" >> $fich
 532                  else
 533                      echo "   append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp src_part=$src_part dest_part=$dest_part nom_image=$nom_image auto_reboot=$auto_reboot delais_reboot=$delais_reboot work=restaure_part.sh hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp src_part=$src_part dest_part=$dest_part nom_image=$nom_image auto_reboot=$auto_reboot delais_reboot=$delais_reboot work=restaure_part.sh hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline}" >> $fich
 534                  fi
 535              fi
 536          else
 537              if [ "$src_part:0:4}" = "smb:" ]; then
 538                  if [ -z "$nom_image" ]; then
 539                      echo "   append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp src_part=$src_part dest_part=$dest_part auto_reboot=$auto_reboot delais_reboot=$delais_reboot work=restaure_part.sh nom_machine=$pc mac_machine=$mac hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline}" >> $fich
 540                  else
 541                      echo "   append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp src_part=$src_part dest_part=$dest_part nom_image=$nom_image auto_reboot=$auto_reboot delais_reboot=$delais_reboot work=restaure_part.sh nom_machine=$pc mac_machine=$mac hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline}" >> $fich
 542                  fi
 543              else
 544                  if [ -z "$nom_image" ]; then
 545                      echo "   append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp src_part=$src_part dest_part=$dest_part auto_reboot=$auto_reboot delais_reboot=$delais_reboot work=restaure_part.sh hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline}" >> $fich
 546                  else
 547                      echo "   append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp src_part=$src_part dest_part=$dest_part nom_image=$nom_image auto_reboot=$auto_reboot delais_reboot=$delais_reboot work=restaure_part.sh hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline}" >> $fich
 548                  fi
 549              fi
 550          fi
 551  
 552          echo "
 553  # Choix de boot par dfaut:
 554  default sysrcdrst
 555  
 556  # On boote aprs 6 secondes:
 557  timeout 60
 558  
 559  # Permet-on  l'utilisateur de choisir l'option de boot?
 560  # Si on ne permet pas, le timeout n'est pas pris en compte.
 561  prompt 1
 562  " >> $fich
 563      ;;
 564  
 565      "udpcast_emetteur")
 566          #mac=$(echo "$2" | sed -e "s/:/-/g")
 567          # IP ou dhcp
 568          # Comme on dmarre en PXE, on note l'IP pour info dans le CFG, mais on fonctionne en DHCP sur UDPCAST
 569          #ip=$3
 570          #mask=$4
 571          #pc=$4
 572          #compr=$5
 573          #port=$6
 574          #enableDiskmodule=$7
 575          #diskmodule=$8
 576          #netmodule=$9
 577          #disk=${10}
 578          #auto_reboot=${11}
 579          #udpcparam=${12}
 580          #urlse3=${13}
 581          #num_op=${14}
 582          #dhcp=${15}
 583          #dhcp_iface=${16}
 584  
 585  
 586          mac=$(echo "$*" | sed -e "s| |\n|g"|grep "^mac="|cut -d"=" -f2 | sed -e "s/:/-/g")
 587          ip=$(echo "$*" | sed -e "s| |\n|g"|grep "^ip="|cut -d"=" -f2)
 588          pc=$(echo "$*" | sed -e "s| |\n|g"|grep "pc="|cut -d"=" -f2)
 589          compr=$(echo "$*" | sed -e "s| |\n|g"|grep "compr="|cut -d"=" -f2)
 590          port=$(echo "$*" | sed -e "s| |\n|g"|grep "port="|cut -d"=" -f2)
 591          enableDiskmodule=$(echo "$*" | sed -e "s| |\n|g"|grep "enableDiskmodule="|cut -d"=" -f2)
 592          diskmodule=$(echo "$*" | sed -e "s| |\n|g"|grep "diskmodule="|cut -d"=" -f2)
 593          netmodule=$(echo "$*" | sed -e "s| |\n|g"|grep "netmodule="|cut -d"=" -f2)
 594          disk=$(echo "$*" | sed -e "s| |\n|g"|grep "disk="|cut -d"=" -f2)
 595          auto_reboot=$(echo "$*" | sed -e "s| |\n|g"|grep "auto_reboot="|cut -d"=" -f2)
 596          #udpcparam=$(echo "$*" | sed -e "s| |\n|g"|grep "udpcparam="|cut -d"=" -f2)
 597          udpcparam=$(echo "$*" | sed -e "s| |\n|g"|grep "udpcparam="|sed -e "s|^udpcparam=||"|tr "_" " ")
 598          urlse3=$(echo "$*" | sed -e "s| |\n|g"|grep "urlse3="|cut -d"=" -f2)
 599          num_op=$(echo "$*" | sed -e "s| |\n|g"|grep "num_op="|cut -d"=" -f2)
 600          dhcp=$(echo "$*" | sed -e "s| |\n|g"|grep "dhcp="|cut -d"=" -f2)
 601          dhcp_iface=$(echo "$*" | sed -e "s| |\n|g"|grep "dhcp_iface="|cut -d"=" -f2)
 602  
 603  
 604          if echo "$disk" | grep "^/dev/" ; then
 605              disk=$(echo "$disk" | sed -e "s|^/dev/||g")
 606          fi
 607          disk="/dev/$disk"
 608  
 609  
 610          # --min-wait t
 611          #    Even when the necessary amount of receivers do have connected, still wait until t seconds since first receiver connection have passed.
 612          #--max-wait t
 613          #    When not enough receivers have connected (but at least one), start anyways when t seconds since first receiver connection have pased.
 614          # --start-timeout sec
 615          #    receiver aborts at start if it doesn't see a sender within this many seconds. Furthermore, the sender needs to start transmission of data within this delay. Once transmission is started, the timeout no longer applies.
 616  
 617  
 618          #disk=/dev/hda1
 619          #netmodule=AUTO
 620          #udpcparam=--min-receivers=1
 621  
 622          if [ "$auto_reboot" != "always" -a "$auto_reboot" != "success" ]; then
 623              auto_reboot="never"
 624          fi
 625  
 626          fich=/tftpboot/pxelinux.cfg/01-$mac
 627  
 628          echo "# Script de boot de la machine $pc
 629  # MAC=$mac
 630  # IP= $ip
 631  # Date de generation du fichier: $timedate
 632  # Timestamp: $timestamp
 633  
 634  # Echappatoires pour booter sur le DD:
 635  label 0
 636     localboot 0x80
 637  label a
 638     localboot 0x00
 639  label q
 640     localboot -1
 641  label disk1
 642     localboot 0x80
 643  label disk2
 644    localboot 0x81
 645  
 646  # Label d'emission:
 647  label u1auto
 648      kernel vmlu26" > $fich
 649  
 650          if [ "$dhcp" != "no" ]; then
 651              if [ ! -z "$diskmodule" ]; then
 652                  echo "    append initrd=udprd root=01:00 persoparams=oui lang=FR kbmap=FR dhcp=yes compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} udpcparam=\"$udpcparam\"
 653      " >> $fich
 654              else
 655                  echo "    append initrd=udprd root=01:00 persoparams=oui lang=FR kbmap=FR dhcp=yes compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} udpcparam=\"$udpcparam\"
 656      " >> $fich
 657              fi
 658          else
 659              netmask=$(/sbin/ifconfig $dhcp_iface} |/bin/grep "inet " |/usr/bin/cut -d":" -f4 |/usr/bin/cut -d' '  -f1)
 660  
 661              if [ ! -z "$diskmodule" ]; then
 662                  echo "    append initrd=udprd root=01:00 persoparams=oui lang=FR kbmap=FR dhcp=no ip=$ip netmask=$netmask compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} udpcparam=\"$udpcparam\"
 663      " >> $fich
 664              else
 665                  echo "    append initrd=udprd root=01:00 persoparams=oui lang=FR kbmap=FR dhcp=no ip=$ip netmask=$netmask compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} udpcparam=\"$udpcparam\"
 666      " >> $fich
 667              fi
 668          fi
 669  
 670          echo "# Choix de boot par dfaut:
 671  default u1auto
 672  
 673  # On boote aprs 6 secondes:
 674  timeout 60
 675  
 676  # Permet-on  l'utilisateur de choisir l'option de boot?
 677  # Si on ne permet pas, le timeout n'est pas pris en compte.
 678  prompt 1
 679  " >> $fich
 680      ;;
 681  
 682      "udpcast_recepteur")
 683          #mac=$(echo "$2" | sed -e "s/:/-/g")
 684          # IP ou dhcp
 685          # Comme on dmarre en PXE, on note l'IP pour info dans le CFG, mais on fonctionne en DHCP sur UDPCAST
 686          #ip=$3
 687          #mask=$4
 688          #pc=$4
 689          #compr=$5
 690          #port=$6
 691          #enableDiskmodule=$7
 692          #diskmodule=$8
 693          #netmodule=$9
 694          #disk=${10}
 695          #auto_reboot=${11}
 696          #udpcparam=${12}
 697          #urlse3=${13}
 698          #num_op=${14}
 699          #dhcp=${15}
 700          #dhcp_iface=${16}
 701  
 702          mac=$(echo "$*" | sed -e "s| |\n|g"|grep "^mac="|cut -d"=" -f2 | sed -e "s/:/-/g")
 703          ip=$(echo "$*" | sed -e "s| |\n|g"|grep "^ip="|cut -d"=" -f2)
 704          pc=$(echo "$*" | sed -e "s| |\n|g"|grep "pc="|cut -d"=" -f2)
 705          compr=$(echo "$*" | sed -e "s| |\n|g"|grep "compr="|cut -d"=" -f2)
 706          port=$(echo "$*" | sed -e "s| |\n|g"|grep "port="|cut -d"=" -f2)
 707          enableDiskmodule=$(echo "$*" | sed -e "s| |\n|g"|grep "enableDiskmodule="|cut -d"=" -f2)
 708          diskmodule=$(echo "$*" | sed -e "s| |\n|g"|grep "diskmodule="|cut -d"=" -f2)
 709          netmodule=$(echo "$*" | sed -e "s| |\n|g"|grep "netmodule="|cut -d"=" -f2)
 710          disk=$(echo "$*" | sed -e "s| |\n|g"|grep "disk="|cut -d"=" -f2)
 711          auto_reboot=$(echo "$*" | sed -e "s| |\n|g"|grep "auto_reboot="|cut -d"=" -f2)
 712          #udpcparam=$(echo "$*" | sed -e "s| |\n|g"|grep "udpcparam="|cut -d"=" -f2)
 713          udpcparam=$(echo "$*" | sed -e "s| |\n|g"|grep "udpcparam="|sed -e "s|^udpcparam=||"|tr "_" " ")
 714          urlse3=$(echo "$*" | sed -e "s| |\n|g"|grep "urlse3="|cut -d"=" -f2)
 715          num_op=$(echo "$*" | sed -e "s| |\n|g"|grep "num_op="|cut -d"=" -f2)
 716          dhcp=$(echo "$*" | sed -e "s| |\n|g"|grep "dhcp="|cut -d"=" -f2)
 717          dhcp_iface=$(echo "$*" | sed -e "s| |\n|g"|grep "dhcp_iface="|cut -d"=" -f2)
 718  
 719  
 720          if echo "$disk" | grep "^/dev/" ; then
 721              disk=$(echo "$disk" | sed -e "s|^/dev/||g")
 722          fi
 723          disk="/dev/$disk"
 724  
 725          # --min-wait t
 726          #    Even when the necessary amount of receivers do have connected, still wait until t seconds since first receiver connection have passed.
 727          #--max-wait t
 728          #    When not enough receivers have connected (but at least one), start anyways when t seconds since first receiver connection have pased.
 729          # --start-timeout sec
 730          #    receiver aborts at start if it doesn't see a sender within this many seconds. Furthermore, the sender needs to start transmission of data within this delay. Once transmission is started, the timeout no longer applies.
 731  
 732  
 733          #disk=/dev/hda1
 734          #netmodule=AUTO
 735          #udpcparam=--min-receivers=1
 736  
 737          if [ "$auto_reboot" != "always" -a "$auto_reboot" != "success" ]; then
 738              auto_reboot="never"
 739          fi
 740  
 741          fich=/tftpboot/pxelinux.cfg/01-$mac
 742  
 743          echo "# Script de boot de la machine $pc
 744  # MAC=$mac
 745  # IP= $ip
 746  # Date de generation du fichier: $timedate
 747  # Timestamp: $timestamp
 748  
 749  # Echappatoires pour booter sur le DD:
 750  label 0
 751     localboot 0x80
 752  label a
 753     localboot 0x00
 754  label q
 755     localboot -1
 756  label disk1
 757     localboot 0x80
 758  label disk2
 759    localboot 0x81
 760  
 761  # Label de reception:
 762  label u2auto
 763      kernel vmlu26" > $fich
 764  
 765          if [ "$dhcp" != "no" ]; then
 766              if [ ! -z "$diskmodule" ]; then
 767                  #echo "    append initrd=udprd root=01:00 persoparams=oui lang=FR kbmap=FR dhcp=yes compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule udpcparam=\"$udpcparam\"
 768                  echo "    append initrd=udprd root=01:00 persoparams=oui lang=FR kbmap=FR dhcp=yes compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} udpcparam=\"$udpcparam\"
 769      " >> $fich
 770              else
 771                  #echo "    append initrd=udprd root=01:00 persoparams=oui lang=FR kbmap=FR dhcp=yes compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule udpcparam=\"$udpcparam\"
 772                  echo "    append initrd=udprd root=01:00 persoparams=oui lang=FR kbmap=FR dhcp=yes compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} udpcparam=\"$udpcparam\"
 773      " >> $fich
 774              fi
 775          else
 776              netmask=$(/sbin/ifconfig $dhcp_iface} |/bin/grep "inet " |/usr/bin/cut -d":" -f4 |/usr/bin/cut -d' '  -f1)
 777  
 778              if [ ! -z "$diskmodule" ]; then
 779                  echo "    append initrd=udprd root=01:00 persoparams=oui lang=FR kbmap=FR dhcp=no ip=$ip netmask=$netmask compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} udpcparam=\"$udpcparam\"
 780      " >> $fich
 781              else
 782                  echo "    append initrd=udprd root=01:00 persoparams=oui lang=FR kbmap=FR dhcp=no ip=$ip netmask=$netmask compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} udpcparam=\"$udpcparam\"
 783      " >> $fich
 784              fi
 785          fi
 786  
 787          echo "# Choix de boot par dfaut:
 788  default u2auto
 789  
 790  # On boote aprs 6 secondes:
 791  timeout 60
 792  
 793  # Permet-on  l'utilisateur de choisir l'option de boot?
 794  # Si on ne permet pas, le timeout n'est pas pris en compte.
 795  prompt 1
 796  " >> $fich
 797      ;;
 798  
 799  
 800      "sysresccd_udpcast_emetteur")
 801          #mac=$(echo "$2" | sed -e "s/:/-/g")
 802          # IP ou dhcp
 803          # Comme on dmarre en PXE, on note l'IP pour info dans le CFG, mais on fonctionne en DHCP sur UDPCAST
 804          #ip=$3
 805          #mask=$4
 806          #pc=$4
 807          #compr=$5
 808          #port=$6
 809          # Non utilises avec SysRescCD
 810              #enableDiskmodule=$7
 811              #diskmodule=$8
 812              #netmodule=$9
 813          #disk=${10}
 814          #auto_reboot=${11}
 815          #udpcparam=${12}
 816          #urlse3=${13}
 817          #num_op=${14}
 818          #dhcp=${15}
 819          #dhcp_iface=${16}
 820  
 821  
 822          mac=$(echo "$*" | sed -e "s| |\n|g"|grep "^mac="|cut -d"=" -f2 | sed -e "s/:/-/g")
 823          ip=$(echo "$*" | sed -e "s| |\n|g"|grep "^ip="|cut -d"=" -f2)
 824          pc=$(echo "$*" | sed -e "s| |\n|g"|grep "pc="|cut -d"=" -f2)
 825          compr=$(echo "$*" | sed -e "s| |\n|g"|grep "compr="|cut -d"=" -f2)
 826          port=$(echo "$*" | sed -e "s| |\n|g"|grep "port="|cut -d"=" -f2)
 827          disk=$(echo "$*" | sed -e "s| |\n|g"|grep "disk="|cut -d"=" -f2)
 828          auto_reboot=$(echo "$*" | sed -e "s| |\n|g"|grep "auto_reboot="|cut -d"=" -f2)
 829          #udpcparam=$(echo "$*" | sed -e "s| |\n|g"|grep "udpcparam="|cut -d"=" -f2)
 830          udpcparam=$(echo "$*" | sed -e "s| |\n|g"|grep "udpcparam="|sed -e "s|^udpcparam=||"|tr "_" " ")
 831          urlse3=$(echo "$*" | sed -e "s| |\n|g"|grep "urlse3="|cut -d"=" -f2)
 832          num_op=$(echo "$*" | sed -e "s| |\n|g"|grep "num_op="|cut -d"=" -f2)
 833          dhcp=$(echo "$*" | sed -e "s| |\n|g"|grep "dhcp="|cut -d"=" -f2)
 834          dhcp_iface=$(echo "$*" | sed -e "s| |\n|g"|grep "dhcp_iface="|cut -d"=" -f2)
 835  
 836          kernel=$(echo "$*" | sed -e "s| |\n|g"|grep "kernel="|cut -d"=" -f2)
 837          if [ "$kernel" = "rescuecd" -a ! -e "/tftpboot/rescuecd" -a -e "/tftpboot/rescue32" ]; then
 838              kernel="rescue32"
 839          fi
 840          if [ "$kernel" = "rescue32" -a ! -e "/tftpboot/rescue32" -a -e "/tftpboot/rescuecd" ]; then
 841              kernel="rescuecd"
 842          fi
 843  
 844          if [ "$kernel" = "auto" ]; then
 845              kernel="ifcpu64.c32"
 846          fi
 847  
 848          url_authorized_keys=$(echo "$*" | sed -e "s| |\n|g"|grep "^url_authorized_keys="|cut -d"=" -f2)
 849          if [ -n "$url_authorized_keys" ]; then
 850              opt_url_authorized_keys=" url_authorized_keys=$url_authorized_keys"
 851          else
 852              opt_url_authorized_keys=""
 853          fi
 854  
 855          if echo "$disk" | grep "^/dev/" ; then
 856              disk=$(echo "$disk" | sed -e "s|^/dev/||g")
 857          fi
 858          #disk="/dev/$disk"
 859  
 860  
 861          # --min-wait t
 862          #    Even when the necessary amount of receivers do have connected, still wait until t seconds since first receiver connection have passed.
 863          #--max-wait t
 864          #    When not enough receivers have connected (but at least one), start anyways when t seconds since first receiver connection have pased.
 865          # --start-timeout sec
 866          #    receiver aborts at start if it doesn't see a sender within this many seconds. Furthermore, the sender needs to start transmission of data within this delay. Once transmission is started, the timeout no longer applies.
 867  
 868  
 869          #disk=/dev/hda1
 870          #netmodule=AUTO
 871          #udpcparam=--min-receivers=1
 872  
 873          if [ "$auto_reboot" != "always" -a "$auto_reboot" != "success" ]; then
 874              auto_reboot="never"
 875          fi
 876  
 877          fich=/tftpboot/pxelinux.cfg/01-$mac
 878  
 879          echo "# Script de boot de la machine $pc
 880  # MAC=$mac
 881  # IP= $ip
 882  # Date de generation du fichier: $timedate
 883  # Timestamp: $timestamp
 884  
 885  # Echappatoires pour booter sur le DD:
 886  label 0
 887     localboot 0x80
 888  label a
 889     localboot 0x00
 890  label q
 891     localboot -1
 892  label disk1
 893     localboot 0x80
 894  label disk2
 895    localboot 0x81
 896  
 897  # Label d'emission:
 898  label srcdu1
 899      kernel $kernel
 900      #initrd initram.igz" > $fich
 901  # A revoir: On peut avoir besoin de altker32,... au lieu de rescuecd
 902  
 903  # kernel rescuecd
 904  # initrd initram.igz
 905  # APPEND scandelay=1 setkmap=fr autoruns=0 ar_nowait vga=791
 906  # 
 907  
 908          if [ "$kernel" = "ifcpu64.c32" ]; then
 909              if [ "$dhcp" != "no" ]; then
 910                  if [ ! -z "$diskmodule" ]; then
 911                      echo "    append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=udpcast3.sh compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\" -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=udpcast3.sh compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
 912          " >> $fich
 913                  else
 914                      echo "    append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=udpcast3.sh compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\" -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=udpcast3.sh compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
 915          " >> $fich
 916                  fi
 917              else
 918                  netmask=$(/sbin/ifconfig $dhcp_iface} |/bin/grep "inet " |/usr/bin/cut -d":" -f4 |/usr/bin/cut -d' '  -f1)
 919  
 920                  #ethx=ip
 921                  if [ ! -z "$diskmodule" ]; then
 922                      echo "    append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait work=udpcast3.sh ip=$ip netmask=$netmask compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\" -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait work=udpcast3.sh ip=$ip netmask=$netmask compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
 923          " >> $fich
 924                  else
 925                      echo "    append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait work=udpcast3.sh ip=$ip netmask=$netmask compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\" -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait work=udpcast3.sh ip=$ip netmask=$netmask compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
 926          " >> $fich
 927                  fi
 928              fi
 929          else
 930              if [ "$dhcp" != "no" ]; then
 931                  if [ ! -z "$diskmodule" ]; then
 932                      echo "    append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=udpcast3.sh compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
 933          " >> $fich
 934                  else
 935                      echo "    append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=udpcast3.sh compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
 936          " >> $fich
 937                  fi
 938              else
 939                  netmask=$(/sbin/ifconfig $dhcp_iface} |/bin/grep "inet " |/usr/bin/cut -d":" -f4 |/usr/bin/cut -d' '  -f1)
 940  
 941                  #ethx=ip
 942                  if [ ! -z "$diskmodule" ]; then
 943                      echo "    append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait work=udpcast3.sh ip=$ip netmask=$netmask compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
 944          " >> $fich
 945                  else
 946                      echo "    append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait work=udpcast3.sh ip=$ip netmask=$netmask compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
 947          " >> $fich
 948                  fi
 949              fi
 950          fi
 951  
 952          echo "# Choix de boot par dfaut:
 953  default srcdu1
 954  
 955  # On boote aprs 6 secondes:
 956  timeout 60
 957  
 958  # Permet-on  l'utilisateur de choisir l'option de boot?
 959  # Si on ne permet pas, le timeout n'est pas pris en compte.
 960  prompt 1
 961  " >> $fich
 962      ;;
 963  
 964      "sysresccd_udpcast_recepteur")
 965          #mac=$(echo "$2" | sed -e "s/:/-/g")
 966          # IP ou dhcp
 967          # Comme on dmarre en PXE, on note l'IP pour info dans le CFG, mais on fonctionne en DHCP sur UDPCAST
 968          #ip=$3
 969          #mask=$4
 970          #pc=$4
 971          #compr=$5
 972          #port=$6
 973          # Non utilises avec SysRescCD
 974              #enableDiskmodule=$7
 975              #diskmodule=$8
 976              #netmodule=$9
 977          #disk=${10}
 978          #auto_reboot=${11}
 979          #udpcparam=${12}
 980          #urlse3=${13}
 981          #num_op=${14}
 982          #dhcp=${15}
 983          #dhcp_iface=${16}
 984  
 985  
 986          mac=$(echo "$*" | sed -e "s| |\n|g"|grep "^mac="|cut -d"=" -f2 | sed -e "s/:/-/g")
 987          ip=$(echo "$*" | sed -e "s| |\n|g"|grep "^ip="|cut -d"=" -f2)
 988          pc=$(echo "$*" | sed -e "s| |\n|g"|grep "pc="|cut -d"=" -f2)
 989          compr=$(echo "$*" | sed -e "s| |\n|g"|grep "compr="|cut -d"=" -f2)
 990          port=$(echo "$*" | sed -e "s| |\n|g"|grep "port="|cut -d"=" -f2)
 991          disk=$(echo "$*" | sed -e "s| |\n|g"|grep "disk="|cut -d"=" -f2)
 992          auto_reboot=$(echo "$*" | sed -e "s| |\n|g"|grep "auto_reboot="|cut -d"=" -f2)
 993          #udpcparam=$(echo "$*" | sed -e "s| |\n|g"|grep "udpcparam="|cut -d"=" -f2)
 994          udpcparam=$(echo "$*" | sed -e "s| |\n|g"|grep "udpcparam="|sed -e "s|^udpcparam=||"|tr "_" " ")
 995          urlse3=$(echo "$*" | sed -e "s| |\n|g"|grep "urlse3="|cut -d"=" -f2)
 996          num_op=$(echo "$*" | sed -e "s| |\n|g"|grep "num_op="|cut -d"=" -f2)
 997          dhcp=$(echo "$*" | sed -e "s| |\n|g"|grep "dhcp="|cut -d"=" -f2)
 998          dhcp_iface=$(echo "$*" | sed -e "s| |\n|g"|grep "dhcp_iface="|cut -d"=" -f2)
 999  
1000          kernel=$(echo "$*" | sed -e "s| |\n|g"|grep "kernel="|cut -d"=" -f2)
1001          if [ "$kernel" = "rescuecd" -a ! -e "/tftpboot/rescuecd" -a -e "/tftpboot/rescue32" ]; then
1002              kernel="rescue32"
1003          fi
1004          if [ "$kernel" = "rescue32" -a ! -e "/tftpboot/rescue32" -a -e "/tftpboot/rescuecd" ]; then
1005              kernel="rescuecd"
1006          fi
1007  
1008          if [ "$kernel" = "auto" ]; then
1009              kernel="ifcpu64.c32"
1010          fi
1011  
1012          url_authorized_keys=$(echo "$*" | sed -e "s| |\n|g"|grep "^url_authorized_keys="|cut -d"=" -f2)
1013          if [ -n "$url_authorized_keys" ]; then
1014              opt_url_authorized_keys=" url_authorized_keys=$url_authorized_keys"
1015          else
1016              opt_url_authorized_keys=""
1017          fi
1018  
1019  
1020          if echo "$disk" | grep "^/dev/" ; then
1021              disk=$(echo "$disk" | sed -e "s|^/dev/||g")
1022          fi
1023          #disk="/dev/$disk"
1024  
1025  
1026          # --min-wait t
1027          #    Even when the necessary amount of receivers do have connected, still wait until t seconds since first receiver connection have passed.
1028          #--max-wait t
1029          #    When not enough receivers have connected (but at least one), start anyways when t seconds since first receiver connection have pased.
1030          # --start-timeout sec
1031          #    receiver aborts at start if it doesn't see a sender within this many seconds. Furthermore, the sender needs to start transmission of data within this delay. Once transmission is started, the timeout no longer applies.
1032  
1033  
1034          #disk=/dev/hda1
1035          #netmodule=AUTO
1036          #udpcparam=--min-receivers=1
1037  
1038          if [ "$auto_reboot" != "always" -a "$auto_reboot" != "success" ]; then
1039              auto_reboot="never"
1040          fi
1041  
1042          fich=/tftpboot/pxelinux.cfg/01-$mac
1043  
1044          echo "# Script de boot de la machine $pc
1045  # MAC=$mac
1046  # IP= $ip
1047  # Date de generation du fichier: $timedate
1048  # Timestamp: $timestamp
1049  
1050  # Echappatoires pour booter sur le DD:
1051  label 0
1052     localboot 0x80
1053  label a
1054     localboot 0x00
1055  label q
1056     localboot -1
1057  label disk1
1058     localboot 0x80
1059  label disk2
1060    localboot 0x81
1061  
1062  # Label de reception:
1063  label srcdu2
1064      kernel $kernel
1065      #initrd initram.igz" > $fich
1066  # A revoir: On peut avoir besoin de altker32,... au lieu de rescuecd
1067  
1068          if [ "$kernel" = "ifcpu64.c32" ]; then
1069              if [ "$dhcp" != "no" ]; then
1070                  if [ ! -z "$diskmodule" ]; then
1071                      echo "    append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=udpcast3.sh compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\" -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=udpcast3.sh compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
1072          " >> $fich
1073                  else
1074                      echo "    append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=udpcast3.sh compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\" -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=udpcast3.sh compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
1075          " >> $fich
1076                  fi
1077              else
1078                  netmask=$(/sbin/ifconfig $dhcp_iface} |/bin/grep "inet " |/usr/bin/cut -d":" -f4 |/usr/bin/cut -d' '  -f1)
1079  
1080                  if [ ! -z "$diskmodule" ]; then
1081                      echo "    append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait ip=$ip netmask=$netmask work=udpcast3.sh compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\" -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait ip=$ip netmask=$netmask work=udpcast3.sh compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
1082          " >> $fich
1083                  else
1084                      echo "    append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait ip=$ip netmask=$netmask work=udpcast3.sh compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\" -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait ip=$ip netmask=$netmask work=udpcast3.sh compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
1085          " >> $fich
1086                  fi
1087              fi
1088          else
1089              if [ "$dhcp" != "no" ]; then
1090                  if [ ! -z "$diskmodule" ]; then
1091                      #echo "    append initrd=udprd root=01:00 persoparams=oui lang=FR kbmap=FR dhcp=yes compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule udpcparam=\"$udpcparam\"
1092                      echo "    append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=udpcast3.sh compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
1093          " >> $fich
1094                  else
1095                      #echo "    append initrd=udprd root=01:00 persoparams=oui lang=FR kbmap=FR dhcp=yes compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule udpcparam=\"$udpcparam\"
1096                      echo "    append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=udpcast3.sh compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
1097          " >> $fich
1098                  fi
1099              else
1100                  netmask=$(/sbin/ifconfig $dhcp_iface} |/bin/grep "inet " |/usr/bin/cut -d":" -f4 |/usr/bin/cut -d' '  -f1)
1101  
1102                  if [ ! -z "$diskmodule" ]; then
1103                      echo "    append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait ip=$ip netmask=$netmask work=udpcast3.sh compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
1104          " >> $fich
1105                  else
1106                      echo "    append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait ip=$ip netmask=$netmask work=udpcast3.sh compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
1107          " >> $fich
1108                  fi
1109              fi
1110          fi
1111  
1112          echo "# Choix de boot par dfaut:
1113  default srcdu2
1114  
1115  # On boote aprs 6 secondes:
1116  timeout 60
1117  
1118  # Permet-on  l'utilisateur de choisir l'option de boot?
1119  # Si on ne permet pas, le timeout n'est pas pris en compte.
1120  prompt 1
1121  " >> $fich
1122      ;;
1123  
1124      "rapport")
1125          #mac=$(echo "$2" | sed -e "s/:/-/g")
1126          #ip=$3
1127          #pc=$4
1128              #nom_image=$(echo "$5" | tr "[]" "[AAAEEEEIIOOUUUCcaaaeeeeiioouuu]" | sed -e "s/[^A-Za-z0-9_.]//g")
1129              #src_part=$6
1130              #dest_part=$7
1131          #auto_reboot=$5
1132          #delais_reboot=$6
1133  
1134          mac=$(echo "$*" | sed -e "s| |\n|g"|grep "^mac="|cut -d"=" -f2 | sed -e "s/:/-/g")
1135          ip=$(echo "$*" | sed -e "s| |\n|g"|grep "^ip="|cut -d"=" -f2)
1136          pc=$(echo "$*" | sed -e "s| |\n|g"|grep "pc="|cut -d"=" -f2)
1137          auto_reboot=$(echo "$*" | sed -e "s| |\n|g"|grep "auto_reboot="|cut -d"=" -f2)
1138          delais_reboot=$(echo "$*" | sed -e "s| |\n|g"|grep "delais_reboot="|cut -d"=" -f2)
1139  
1140          #if [ "$auto_reboot" != "y" ]; then
1141          if [ "$auto_reboot" != "y" -a "$auto_reboot" != "halt" ]; then
1142              auto_reboot="n"
1143          fi
1144  
1145          verif=$(echo "$delais_reboot" | sed -e "s/[0-9]//g")
1146          if [ "x$verif" != "x" ]; then
1147              delais_reboot=60
1148          fi
1149  
1150  
1151          fich=/tftpboot/pxelinux.cfg/01-$mac
1152  
1153          chaine_modules=""
1154          if [ -e /var/www/se3/includes/config.inc.php ]; then
1155              dbhost=`cat /var/www/se3/includes/config.inc.php | grep "dbhost=" | cut -d = -f 2 |cut -d \" -f 2`
1156              dbname=`cat /var/www/se3/includes/config.inc.php | grep "dbname=" | cut -d = -f 2 |cut -d \" -f 2`
1157              dbuser=`cat /var/www/se3/includes/config.inc.php | grep "dbuser=" | cut -d = -f 2 |cut -d \" -f 2`
1158              dbpass=`cat /var/www/se3/includes/config.inc.php | grep "dbpass=" | cut -d = -f 2 |cut -d \" -f 2`
1159  
1160              tmp_mac=$(echo "$mac"|tr "-" ":")
1161              tmp_module=($(echo "SELECT valeur FROM se3_tftp_infos WHERE mac='$tmp_mac';"|mysql -N -h $dbhost -u $dbuser -p$dbpass $dbname| tr "[A-Z]" "[a-z]"))
1162              nbmodules=${#tmp_module[*]}
1163  
1164              if [ $nbmodules -gt 0 ]; then
1165                  chaine_modules="modprobe="
1166                  index=0
1167                  while [ $index -lt $nbmodules ]
1168                  do
1169                      if [ $index -gt 0 ]; then
1170                          chaine_modules="$chaine_modules,"
1171                      fi
1172                      chaine_modules="$chaine_modules}$tmp_module[$index]}"
1173                      index=$(($index+1))
1174                  done
1175                  chaine_modules="$chaine_modules "
1176              fi
1177          fi
1178  
1179          echo "# Script de boot de la machine $pc
1180  # MAC=$mac
1181  # IP= $ip
1182  # Date de generation du fichier: $timedate
1183  # Timestamp: $timestamp
1184  
1185  # Echappatoires pour booter sur le DD:
1186  label 0
1187     localboot 0x80
1188  label a
1189     localboot 0x00
1190  label q
1191     localboot -1
1192  label disk1
1193     localboot 0x80
1194  label disk2
1195    localboot 0x81
1196  
1197  # Label distribution SliTaz:
1198  label taz
1199     kernel bzImage
1200     append initrd=rootfs.gz rw root=/dev/null lang=fr_FR kmap=fr-latin1 vga=normal sound=no screen=text
1201  
1202  # Label de rapport
1203  label tazrap
1204     kernel bzImage" > $fich
1205  
1206          echo "   append initrd=rootfs.gz rw root=/dev/null lang=fr_FR kmap=fr-latin1 vga=normal sound=no screen=text auto_reboot=$auto_reboot delais_reboot=$delais_reboot work=/root/bin/rapport.sh $chaine_modules} $tftp_slitaz_cmdline}" >> $fich
1207  
1208          echo "
1209  # Choix de boot par dfaut:
1210  default tazrap
1211  
1212  # On boote aprs 6 secondes:
1213  timeout 60
1214  
1215  # Permet-on  l'utilisateur de choisir l'option de boot?
1216  # Si on ne permet pas, le timeout n'est pas pris en compte.
1217  prompt 1
1218  " >> $fich
1219      ;;
1220  
1221      "sysresccd_rapport")
1222          #mac=$(echo "$2" | sed -e "s/:/-/g")
1223          #ip=$3
1224          #pc=$4
1225              #nom_image=$(echo "$5" | tr "[]" "[AAAEEEEIIOOUUUCcaaaeeeeiioouuu]" | sed -e "s/[^A-Za-z0-9_.]//g")
1226              #src_part=$6
1227              #dest_part=$7
1228          #auto_reboot=$5
1229          #delais_reboot=$6
1230  
1231          mac=$(echo "$*" | sed -e "s| |\n|g"|grep "^mac="|cut -d"=" -f2 | sed -e "s/:/-/g")
1232          ip=$(echo "$*" | sed -e "s| |\n|g"|grep "^ip="|cut -d"=" -f2)
1233          pc=$(echo "$*" | sed -e "s| |\n|g"|grep "pc="|cut -d"=" -f2)
1234          auto_reboot=$(echo "$*" | sed -e "s| |\n|g"|grep "auto_reboot="|cut -d"=" -f2)
1235          delais_reboot=$(echo "$*" | sed -e "s| |\n|g"|grep "delais_reboot="|cut -d"=" -f2)
1236  
1237          kernel=$(echo "$*" | sed -e "s| |\n|g"|grep "kernel="|cut -d"=" -f2)
1238          if [ "$kernel" = "rescuecd" -a ! -e "/tftpboot/rescuecd" -a -e "/tftpboot/rescue32" ]; then
1239              kernel="rescue32"
1240          fi
1241          if [ "$kernel" = "rescue32" -a ! -e "/tftpboot/rescue32" -a -e "/tftpboot/rescuecd" ]; then
1242              kernel="rescuecd"
1243          fi
1244  
1245          if [ "$kernel" = "auto" ]; then
1246              kernel="ifcpu64.c32"
1247          fi
1248  
1249          #if [ "$auto_reboot" != "y" ]; then
1250          if [ "$auto_reboot" != "y" -a "$auto_reboot" != "halt" ]; then
1251              auto_reboot="n"
1252          fi
1253  
1254          verif=$(echo "$delais_reboot" | sed -e "s/[0-9]//g")
1255          if [ "x$verif" != "x" ]; then
1256              delais_reboot=60
1257          fi
1258  
1259          url_authorized_keys=$(echo "$*" | sed -e "s| |\n|g"|grep "^url_authorized_keys="|cut -d"=" -f2)
1260          if [ -n "$url_authorized_keys" ]; then
1261              opt_url_authorized_keys=" url_authorized_keys=$url_authorized_keys"
1262          else
1263              opt_url_authorized_keys=""
1264          fi
1265  
1266          fich=/tftpboot/pxelinux.cfg/01-$mac
1267  
1268          echo "# Script de boot de la machine $pc
1269  # MAC=$mac
1270  # IP= $ip
1271  # Date de generation du fichier: $timedate
1272  # Timestamp: $timestamp
1273  
1274  # Echappatoires pour booter sur le DD:
1275  label 0
1276     localboot 0x80
1277  label a
1278     localboot 0x00
1279  label q
1280     localboot -1
1281  label disk1
1282     localboot 0x80
1283  label disk2
1284    localboot 0x81
1285  
1286  # Label de rapport
1287  label sysrcdrap
1288      kernel $kernel
1289      #initrd initram.igz" > $fich
1290  
1291          if [ "$kernel" = "ifcpu64.c32" ]; then
1292              echo "append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp auto_reboot=$auto_reboot delais_reboot=$delais_reboot work=rapport.sh hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp auto_reboot=$auto_reboot delais_reboot=$delais_reboot work=rapport.sh hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline}" >> $fich
1293          else
1294              echo "append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp auto_reboot=$auto_reboot delais_reboot=$delais_reboot work=rapport.sh hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline}" >> $fich
1295          fi
1296  
1297          echo "
1298  # Choix de boot par dfaut:
1299  default sysrcdrap
1300  
1301  # On boote aprs 6 secondes:
1302  timeout 60
1303  
1304  # Permet-on  l'utilisateur de choisir l'option de boot?
1305  # Si on ne permet pas, le timeout n'est pas pris en compte.
1306  prompt 1
1307  " >> $fich
1308      ;;
1309  
1310      "unattend_xp")
1311          mac=$(echo "$2" | sed -e "s/:/-/g")
1312          ip=$3
1313          pc=$4
1314  
1315          # on regenere unattend.csv
1316          /usr/share/se3/scripts/unattended_generate.sh -u > /dev/null
1317  
1318          fich=/tftpboot/pxelinux.cfg/01-$mac
1319  
1320          echo "# Script de boot de la machine $pc
1321  # MAC=$mac
1322  # IP= $ip
1323  # Date de generation du fichier: $timedate
1324  # Timestamp: $timestamp
1325  
1326  # Echappatoires pour booter sur le DD:
1327  label 0
1328     localboot 0x80
1329  label a
1330     localboot 0x00
1331  label q
1332     localboot -1
1333  label disk1
1334     localboot 0x80
1335  label disk2
1336    localboot 0x81
1337  
1338  # Label d'install unattend:
1339  label install
1340      kernel bzImageunattend
1341      # Add options (z_user=..., z_path=..., etc.) to this line.
1342      append initrd=initrdunattend
1343  
1344  # Choix de boot par dfaut:
1345  default install
1346  
1347  # On boote aprs 6 secondes:
1348  timeout 60
1349  
1350  # Permet-on  l'utilisateur de choisir l'option de boot?
1351  # Si on ne permet pas, le timeout n'est pas pris en compte.
1352  prompt 1
1353  " >> $fich
1354      ;;
1355      "seven64")
1356          mac=$(echo "$2" | sed -e "s/:/-/g")
1357          ip=$3
1358          pc=$4
1359  
1360          # on regenere unattend.csv
1361          /usr/share/se3/scripts/unattended_generate.sh -u > /dev/null
1362  
1363          fich=/tftpboot/pxelinux.cfg/01-$mac
1364  
1365          echo "# Script de boot de la machine $pc
1366  # MAC=$mac
1367  # IP= $ip
1368  # Date de generation du fichier: $timedate
1369  # Timestamp: $timestamp
1370  
1371  # Echappatoires pour booter sur le DD:
1372  label 0
1373     localboot 0x80
1374  label a
1375     localboot 0x00
1376  label q
1377     localboot -1
1378  label disk1
1379     localboot 0x80
1380  label disk2
1381    localboot 0x81
1382  
1383  # Label d'install seven:
1384  label seven64
1385      kernel seven64/wdsnbp.0
1386  label seven32
1387      kernel seven32/wdsnbp.0
1388  
1389  
1390  # Choix de boot par dfaut:
1391  default seven64
1392  
1393  # On boote aprs 6 secondes:
1394  timeout 60
1395  
1396  # Permet-on  l'utilisateur de choisir l'option de boot?
1397  # Si on ne permet pas, le timeout n'est pas pris en compte.
1398  prompt 1
1399  " >> $fich
1400      ;;
1401      "seven32")
1402          mac=$(echo "$2" | sed -e "s/:/-/g")
1403          ip=$3
1404          pc=$4
1405  
1406          # on regenere unattend.csv
1407          /usr/share/se3/scripts/unattended_generate.sh -u > /dev/null
1408  
1409          fich=/tftpboot/pxelinux.cfg/01-$mac
1410  
1411          echo "# Script de boot de la machine $pc
1412  # MAC=$mac
1413  # IP= $ip
1414  # Date de generation du fichier: $timedate
1415  # Timestamp: $timestamp
1416  
1417  # Echappatoires pour booter sur le DD:
1418  label 0
1419     localboot 0x80
1420  label a
1421     localboot 0x00
1422  label q
1423     localboot -1
1424  label disk1
1425     localboot 0x80
1426  label disk2
1427    localboot 0x81
1428  
1429  # Label d'install seven:
1430  label seven32
1431      kernel seven32/wdsnbp.0
1432  label seven64
1433      kernel seven64/wdsnbp.0
1434  
1435  # Choix de boot par dfaut:
1436  default seven32
1437  
1438  # On boote aprs 6 secondes:
1439  timeout 60
1440  
1441  # Permet-on  l'utilisateur de choisir l'option de boot?
1442  # Si on ne permet pas, le timeout n'est pas pris en compte.
1443  prompt 1
1444  " >> $fich
1445      ;;
1446      "memtest")
1447  
1448          mac=$(echo "$2" | sed -e "s/:/-/g")
1449          ip=$3
1450          pc=$4
1451  
1452          fich=/tftpboot/pxelinux.cfg/01-$mac
1453  
1454          echo "# Script de boot de la machine $pc
1455  # MAC=$mac
1456  # IP= $ip
1457  # Date de generation du fichier: $timedate
1458  # Timestamp: $timestamp
1459  
1460  # Echappatoires pour booter sur le DD:
1461  label 0
1462     localboot 0x80
1463  label a
1464     localboot 0x00
1465  label q
1466     localboot -1
1467  label disk1
1468     localboot 0x80
1469  label disk2
1470    localboot 0x81
1471  
1472  # Label de memtest
1473  label memtest
1474    kernel memtp
1475  
1476  # Choix de boot par dfaut:
1477  default memtest
1478  
1479  # On boote aprs 6 secondes:
1480  timeout 60
1481  
1482  # Permet-on  l'utilisateur de choisir l'option de boot?
1483  # Si on ne permet pas, le timeout n'est pas pris en compte.
1484  prompt 1
1485  " >> $fich
1486  
1487      ;;
1488  
1489  
1490  
1491  
1492      "sysresccd_ntfsclone_udpcast_emetteur")
1493          #mac=$(echo "$2" | sed -e "s/:/-/g")
1494          # IP ou dhcp
1495          # Comme on dmarre en PXE, on note l'IP pour info dans le CFG, mais on fonctionne en DHCP sur UDPCAST
1496          #ip=$3
1497          #mask=$4
1498          #pc=$4
1499          #compr=$5
1500          #port=$6
1501          # Non utilises avec SysRescCD
1502              #enableDiskmodule=$7
1503              #diskmodule=$8
1504              #netmodule=$9
1505          #disk=${10}
1506          #auto_reboot=${11}
1507          #udpcparam=${12}
1508          #urlse3=${13}
1509          #num_op=${14}
1510          #dhcp=${15}
1511          #dhcp_iface=${16}
1512  
1513  
1514          mac=$(echo "$*" | sed -e "s| |\n|g"|grep "^mac="|cut -d"=" -f2 | sed -e "s/:/-/g")
1515          ip=$(echo "$*" | sed -e "s| |\n|g"|grep "^ip="|cut -d"=" -f2)
1516          pc=$(echo "$*" | sed -e "s| |\n|g"|grep "pc="|cut -d"=" -f2)
1517          compr=$(echo "$*" | sed -e "s| |\n|g"|grep "compr="|cut -d"=" -f2)
1518          port=$(echo "$*" | sed -e "s| |\n|g"|grep "port="|cut -d"=" -f2)
1519          disk=$(echo "$*" | sed -e "s| |\n|g"|grep "disk="|cut -d"=" -f2)
1520          auto_reboot=$(echo "$*" | sed -e "s| |\n|g"|grep "auto_reboot="|cut -d"=" -f2)
1521          #udpcparam=$(echo "$*" | sed -e "s| |\n|g"|grep "udpcparam="|cut -d"=" -f2)
1522          udpcparam=$(echo "$*" | sed -e "s| |\n|g"|grep "udpcparam="|sed -e "s|^udpcparam=||"|tr "_" " ")
1523          urlse3=$(echo "$*" | sed -e "s| |\n|g"|grep "urlse3="|cut -d"=" -f2)
1524          num_op=$(echo "$*" | sed -e "s| |\n|g"|grep "num_op="|cut -d"=" -f2)
1525          dhcp=$(echo "$*" | sed -e "s| |\n|g"|grep "dhcp="|cut -d"=" -f2)
1526          dhcp_iface=$(echo "$*" | sed -e "s| |\n|g"|grep "dhcp_iface="|cut -d"=" -f2)
1527  
1528          kernel=$(echo "$*" | sed -e "s| |\n|g"|grep "kernel="|cut -d"=" -f2)
1529          if [ "$kernel" = "rescuecd" -a ! -e "/tftpboot/rescuecd" -a -e "/tftpboot/rescue32" ]; then
1530              kernel="rescue32"
1531          fi
1532          if [ "$kernel" = "rescue32" -a ! -e "/tftpboot/rescue32" -a -e "/tftpboot/rescuecd" ]; then
1533              kernel="rescuecd"
1534          fi
1535  
1536          if [ "$kernel" = "auto" ]; then
1537              kernel="ifcpu64.c32"
1538          fi
1539  
1540          id_microtime=$(echo "$*" | sed -e "s| |\n|g"|grep "id_microtime="|cut -d"=" -f2)
1541  
1542  
1543          url_authorized_keys=$(echo "$*" | sed -e "s| |\n|g"|grep "^url_authorized_keys="|cut -d"=" -f2)
1544          if [ -n "$url_authorized_keys" ]; then
1545              opt_url_authorized_keys=" url_authorized_keys=$url_authorized_keys"
1546          else
1547              opt_url_authorized_keys=""
1548          fi
1549  
1550          if echo "$disk" | grep "^/dev/" ; then
1551              disk=$(echo "$disk" | sed -e "s|^/dev/||g")
1552          fi
1553          #disk="/dev/$disk"
1554  
1555  
1556          # --min-wait t
1557          #    Even when the necessary amount of receivers do have connected, still wait until t seconds since first receiver connection have passed.
1558          #--max-wait t
1559          #    When not enough receivers have connected (but at least one), start anyways when t seconds since first receiver connection have pased.
1560          # --start-timeout sec
1561          #    receiver aborts at start if it doesn't see a sender within this many seconds. Furthermore, the sender needs to start transmission of data within this delay. Once transmission is started, the timeout no longer applies.
1562  
1563  
1564          #disk=/dev/hda1
1565          #netmodule=AUTO
1566          #udpcparam=--min-receivers=1
1567  
1568          if [ "$auto_reboot" != "always" -a "$auto_reboot" != "success" ]; then
1569              auto_reboot="never"
1570          fi
1571  
1572          mkdir -p "/var/www/clonage"
1573          echo $ip >> /var/www/clonage/serveur_ntfsclone_udpcast_$num_op}_$id_microtime}.txt
1574          chown www-data:www-data /var/www/clonage/serveur_ntfsclone_udpcast_$num_op}_$id_microtime}.txt
1575  
1576          fich=/tftpboot/pxelinux.cfg/01-$mac
1577  
1578          echo "# Script de boot de la machine $pc
1579  # MAC=$mac
1580  # IP= $ip
1581  # Date de generation du fichier: $timedate
1582  # Timestamp: $timestamp
1583  
1584  # Echappatoires pour booter sur le DD:
1585  label 0
1586     localboot 0x80
1587  label a
1588     localboot 0x00
1589  label q
1590     localboot -1
1591  label disk1
1592     localboot 0x80
1593  label disk2
1594    localboot 0x81
1595  
1596  # Label d'emission:
1597  label srcdu1
1598      kernel $kernel
1599      #initrd initram.igz" > $fich
1600  # A revoir: On peut avoir besoin de altker32,... au lieu de rescuecd
1601  
1602  # kernel rescuecd
1603  # initrd initram.igz
1604  # APPEND scandelay=1 setkmap=fr autoruns=0 ar_nowait vga=791
1605  # 
1606  
1607          if [ "$kernel" = "ifcpu64.c32" ]; then
1608              if [ "$dhcp" != "no" ]; then
1609                  if [ ! -z "$diskmodule" ]; then
1610                      echo "    append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=ntfsclone_udpcast.sh compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} se3ip=$se3ip id_microtime=$id_microtime} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\" -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=ntfsclone_udpcast.sh compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} se3ip=$se3ip id_microtime=$id_microtime} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
1611          " >> $fich
1612                  else
1613                      echo "    append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=ntfsclone_udpcast.sh compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} se3ip=$se3ip id_microtime=$id_microtime} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\" -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=ntfsclone_udpcast.sh compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} se3ip=$se3ip id_microtime=$id_microtime} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
1614          " >> $fich
1615                  fi
1616              else
1617                  netmask=$(/sbin/ifconfig $dhcp_iface} |/bin/grep "inet " |/usr/bin/cut -d":" -f4 |/usr/bin/cut -d' '  -f1)
1618  
1619                  #ethx=ip
1620                  if [ ! -z "$diskmodule" ]; then
1621                      echo "    append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait work=ntfsclone_udpcast.sh ip=$ip netmask=$netmask compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} se3ip=$se3ip id_microtime=$id_microtime} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\" -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait work=ntfsclone_udpcast.sh ip=$ip netmask=$netmask compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} se3ip=$se3ip id_microtime=$id_microtime} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
1622          " >> $fich
1623                  else
1624                      echo "    append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait work=ntfsclone_udpcast.sh ip=$ip netmask=$netmask compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} se3ip=$se3ip id_microtime=$id_microtime} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\" -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait work=ntfsclone_udpcast.sh ip=$ip netmask=$netmask compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} se3ip=$se3ip id_microtime=$id_microtime} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
1625          " >> $fich
1626                  fi
1627              fi
1628          else
1629              if [ "$dhcp" != "no" ]; then
1630                  if [ ! -z "$diskmodule" ]; then
1631                      echo "    append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=ntfsclone_udpcast.sh compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} se3ip=$se3ip id_microtime=$id_microtime} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
1632          " >> $fich
1633                  else
1634                      echo "    append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=ntfsclone_udpcast.sh compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} se3ip=$se3ip id_microtime=$id_microtime} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
1635          " >> $fich
1636                  fi
1637              else
1638                  netmask=$(/sbin/ifconfig $dhcp_iface} |/bin/grep "inet " |/usr/bin/cut -d":" -f4 |/usr/bin/cut -d' '  -f1)
1639  
1640                  #ethx=ip
1641                  if [ ! -z "$diskmodule" ]; then
1642                      echo "    append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait work=ntfsclone_udpcast.sh ip=$ip netmask=$netmask compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} se3ip=$se3ip id_microtime=$id_microtime} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
1643          " >> $fich
1644                  else
1645                      echo "    append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait work=ntfsclone_udpcast.sh ip=$ip netmask=$netmask compr=$compr port=$port umode=snd disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} se3ip=$se3ip id_microtime=$id_microtime} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
1646          " >> $fich
1647                  fi
1648              fi
1649          fi
1650  
1651          echo "# Choix de boot par dfaut:
1652  default srcdu1
1653  
1654  # On boote aprs 6 secondes:
1655  timeout 60
1656  
1657  # Permet-on  l'utilisateur de choisir l'option de boot?
1658  # Si on ne permet pas, le timeout n'est pas pris en compte.
1659  prompt 1
1660  " >> $fich
1661      ;;
1662  
1663      "sysresccd_ntfsclone_udpcast_recepteur")
1664          #mac=$(echo "$2" | sed -e "s/:/-/g")
1665          # IP ou dhcp
1666          # Comme on dmarre en PXE, on note l'IP pour info dans le CFG, mais on fonctionne en DHCP sur UDPCAST
1667          #ip=$3
1668          #mask=$4
1669          #pc=$4
1670          #compr=$5
1671          #port=$6
1672          # Non utilises avec SysRescCD
1673              #enableDiskmodule=$7
1674              #diskmodule=$8
1675              #netmodule=$9
1676          #disk=${10}
1677          #auto_reboot=${11}
1678          #udpcparam=${12}
1679          #urlse3=${13}
1680          #num_op=${14}
1681          #dhcp=${15}
1682          #dhcp_iface=${16}
1683  
1684  
1685          mac=$(echo "$*" | sed -e "s| |\n|g"|grep "^mac="|cut -d"=" -f2 | sed -e "s/:/-/g")
1686          ip=$(echo "$*" | sed -e "s| |\n|g"|grep "^ip="|cut -d"=" -f2)
1687          pc=$(echo "$*" | sed -e "s| |\n|g"|grep "pc="|cut -d"=" -f2)
1688          compr=$(echo "$*" | sed -e "s| |\n|g"|grep "compr="|cut -d"=" -f2)
1689          port=$(echo "$*" | sed -e "s| |\n|g"|grep "port="|cut -d"=" -f2)
1690          disk=$(echo "$*" | sed -e "s| |\n|g"|grep "disk="|cut -d"=" -f2)
1691          auto_reboot=$(echo "$*" | sed -e "s| |\n|g"|grep "auto_reboot="|cut -d"=" -f2)
1692          #udpcparam=$(echo "$*" | sed -e "s| |\n|g"|grep "udpcparam="|cut -d"=" -f2)
1693          udpcparam=$(echo "$*" | sed -e "s| |\n|g"|grep "udpcparam="|sed -e "s|^udpcparam=||"|tr "_" " ")
1694          urlse3=$(echo "$*" | sed -e "s| |\n|g"|grep "urlse3="|cut -d"=" -f2)
1695          num_op=$(echo "$*" | sed -e "s| |\n|g"|grep "num_op="|cut -d"=" -f2)
1696          dhcp=$(echo "$*" | sed -e "s| |\n|g"|grep "dhcp="|cut -d"=" -f2)
1697          dhcp_iface=$(echo "$*" | sed -e "s| |\n|g"|grep "dhcp_iface="|cut -d"=" -f2)
1698  
1699          kernel=$(echo "$*" | sed -e "s| |\n|g"|grep "kernel="|cut -d"=" -f2)
1700          if [ "$kernel" = "rescuecd" -a ! -e "/tftpboot/rescuecd" -a -e "/tftpboot/rescue32" ]; then
1701              kernel="rescue32"
1702          fi
1703          if [ "$kernel" = "rescue32" -a ! -e "/tftpboot/rescue32" -a -e "/tftpboot/rescuecd" ]; then
1704              kernel="rescuecd"
1705          fi
1706  
1707          if [ "$kernel" = "auto" ]; then
1708              kernel="ifcpu64.c32"
1709          fi
1710  
1711          id_microtime=$(echo "$*" | sed -e "s| |\n|g"|grep "id_microtime="|cut -d"=" -f2)
1712  
1713          url_authorized_keys=$(echo "$*" | sed -e "s| |\n|g"|grep "^url_authorized_keys="|cut -d"=" -f2)
1714          if [ -n "$url_authorized_keys" ]; then
1715              opt_url_authorized_keys=" url_authorized_keys=$url_authorized_keys"
1716          else
1717              opt_url_authorized_keys=""
1718          fi
1719  
1720          if echo "$disk" | grep "^/dev/" ; then
1721              disk=$(echo "$disk" | sed -e "s|^/dev/||g")
1722          fi
1723          #disk="/dev/$disk"
1724  
1725  
1726          # --min-wait t
1727          #    Even when the necessary amount of receivers do have connected, still wait until t seconds since first receiver connection have passed.
1728          #--max-wait t
1729          #    When not enough receivers have connected (but at least one), start anyways when t seconds since first receiver connection have pased.
1730          # --start-timeout sec
1731          #    receiver aborts at start if it doesn't see a sender within this many seconds. Furthermore, the sender needs to start transmission of data within this delay. Once transmission is started, the timeout no longer applies.
1732  
1733  
1734          #disk=/dev/hda1
1735          #netmodule=AUTO
1736          #udpcparam=--min-receivers=1
1737  
1738          if [ "$auto_reboot" != "always" -a "$auto_reboot" != "success" ]; then
1739              auto_reboot="never"
1740          fi
1741  
1742          mkdir -p "/var/www/clonage"
1743          echo $ip >> /var/www/clonage/liste_clients_ntfsclone_udpcast_$num_op}_$id_microtime}.txt
1744          chown www-data:www-data /var/www/clonage/liste_clients_ntfsclone_udpcast_$num_op}_$id_microtime}.txt
1745  
1746          fich=/tftpboot/pxelinux.cfg/01-$mac
1747  
1748          echo "# Script de boot de la machine $pc
1749  # MAC=$mac
1750  # IP= $ip
1751  # Date de generation du fichier: $timedate
1752  # Timestamp: $timestamp
1753  
1754  # Echappatoires pour booter sur le DD:
1755  label 0
1756     localboot 0x80
1757  label a
1758     localboot 0x00
1759  label q
1760     localboot -1
1761  label disk1
1762     localboot 0x80
1763  label disk2
1764    localboot 0x81
1765  
1766  # Label de reception:
1767  label srcdu2
1768      kernel $kernel
1769      #initrd initram.igz" > $fich
1770  # A revoir: On peut avoir besoin de altker32,... au lieu de rescuecd
1771  
1772          if [ "$kernel" = "ifcpu64.c32" ]; then
1773              if [ "$dhcp" != "no" ]; then
1774                  if [ ! -z "$diskmodule" ]; then
1775                      echo "    append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=ntfsclone_udpcast.sh compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} se3ip=$se3ip id_microtime=$id_microtime} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\" -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=ntfsclone_udpcast.sh compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} se3ip=$se3ip id_microtime=$id_microtime} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
1776          " >> $fich
1777                  else
1778                      echo "    append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=ntfsclone_udpcast.sh compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} se3ip=$se3ip id_microtime=$id_microtime} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\" -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=ntfsclone_udpcast.sh compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} se3ip=$se3ip id_microtime=$id_microtime} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
1779          " >> $fich
1780                  fi
1781              else
1782                  netmask=$(/sbin/ifconfig $dhcp_iface} |/bin/grep "inet " |/usr/bin/cut -d":" -f4 |/usr/bin/cut -d' '  -f1)
1783  
1784                  if [ ! -z "$diskmodule" ]; then
1785                      echo "    append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait ip=$ip netmask=$netmask work=ntfsclone_udpcast.sh compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} se3ip=$se3ip id_microtime=$id_microtime} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\" -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait ip=$ip netmask=$netmask work=ntfsclone_udpcast.sh compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} se3ip=$se3ip id_microtime=$id_microtime} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
1786          " >> $fich
1787                  else
1788                      echo "    append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait ip=$ip netmask=$netmask work=ntfsclone_udpcast.sh compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} se3ip=$se3ip id_microtime=$id_microtime} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\" -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait ip=$ip netmask=$netmask work=ntfsclone_udpcast.sh compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} se3ip=$se3ip id_microtime=$id_microtime} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
1789          " >> $fich
1790                  fi
1791              fi
1792          else
1793              if [ "$dhcp" != "no" ]; then
1794                  if [ ! -z "$diskmodule" ]; then
1795                      #echo "    append initrd=udprd root=01:00 persoparams=oui lang=FR kbmap=FR dhcp=yes compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule udpcparam=\"$udpcparam\"
1796                      echo "    append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=ntfsclone_udpcast.sh compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} se3ip=$se3ip id_microtime=$id_microtime} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
1797          " >> $fich
1798                  else
1799                      #echo "    append initrd=udprd root=01:00 persoparams=oui lang=FR kbmap=FR dhcp=yes compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule udpcparam=\"$udpcparam\"
1800                      echo "    append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=ntfsclone_udpcast.sh compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} se3ip=$se3ip id_microtime=$id_microtime} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
1801          " >> $fich
1802                  fi
1803              else
1804                  netmask=$(/sbin/ifconfig $dhcp_iface} |/bin/grep "inet " |/usr/bin/cut -d":" -f4 |/usr/bin/cut -d' '  -f1)
1805  
1806                  if [ ! -z "$diskmodule" ]; then
1807                      echo "    append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait ip=$ip netmask=$netmask work=ntfsclone_udpcast.sh compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule diskmodule=$diskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} se3ip=$se3ip id_microtime=$id_microtime} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
1808          " >> $fich
1809                  else
1810                      echo "    append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait ip=$ip netmask=$netmask work=ntfsclone_udpcast.sh compr=$compr port=$port umode=rcv disk=$disk auto_reboot=$auto_reboot enableDiskmodule=$enableDiskmodule netmodule=$netmodule remontee_info=y page_remontee=$urlse3}/tftp/remontee_udpcast.php mac=$mac num_op=$num_op} se3ip=$se3ip id_microtime=$id_microtime} hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} udpcparam=\"$udpcparam\"
1811          " >> $fich
1812                  fi
1813              fi
1814          fi
1815  
1816          echo "# Choix de boot par dfaut:
1817  default srcdu2
1818  
1819  # On boote aprs 6 secondes:
1820  timeout 60
1821  
1822  # Permet-on  l'utilisateur de choisir l'option de boot?
1823  # Si on ne permet pas, le timeout n'est pas pris en compte.
1824  prompt 1
1825  " >> $fich
1826      ;;
1827  
1828      "chg_mdp_bootloader_sysresccd")
1829  
1830          mac=$(echo "$*" | sed -e "s| |\n|g"|grep "^mac="|cut -d"=" -f2 | sed -e "s/:/-/g")
1831          ip=$(echo "$*" | sed -e "s| |\n|g"|grep "^ip="|cut -d"=" -f2)
1832          pc=$(echo "$*" | sed -e "s| |\n|g"|grep "pc="|cut -d"=" -f2)
1833  
1834          options_mdp="change_mdp=auto "
1835  
1836          changer_mdp_linux=$(echo "$*" | sed -e "s| |\n|g"|grep "mdp_linux=")
1837          if [ -n "$changer_mdp_linux" ]; then
1838              mdp_linux=$(echo "$changer_mdp_linux" |cut -d"=" -f2)
1839              options_mdp="$options_mdp mdp_linux=$mdp_linux"
1840          fi
1841  
1842          changer_mdp_sauve=$(echo "$*" | sed -e "s| |\n|g"|grep "mdp_sauve=")
1843          if [ -n "$changer_mdp_sauve" ]; then
1844              mdp_sauve=$(echo "$changer_mdp_sauve" |cut -d"=" -f2)
1845              options_mdp="$options_mdp mdp_sauve=$mdp_sauve"
1846          fi
1847  
1848          changer_mdp_restaure=$(echo "$*" | sed -e "s| |\n|g"|grep "mdp_restaure=")
1849          if [ -n "$changer_mdp_restaure" ]; then
1850              mdp_restaure=$(echo "$changer_mdp_restaure" |cut -d"=" -f2)
1851              options_mdp="$options_mdp mdp_restaure=$mdp_restaure"
1852          fi
1853  
1854          auto_reboot=$(echo "$*" | sed -e "s| |\n|g"|grep "auto_reboot="|cut -d"=" -f2)
1855  
1856          kernel=$(echo "$*" | sed -e "s| |\n|g"|grep "kernel="|cut -d"=" -f2)
1857          if [ "$kernel" = "rescuecd" -a ! -e "/tftpboot/rescuecd" -a -e "/tftpboot/rescue32" ]; then
1858              kernel="rescue32"
1859          fi
1860          if [ "$kernel" = "rescue32" -a ! -e "/tftpboot/rescue32" -a -e "/tftpboot/rescuecd" ]; then
1861              kernel="rescuecd"
1862          fi
1863  
1864          if [ "$kernel" = "auto" ]; then
1865              kernel="ifcpu64.c32"
1866          fi
1867  
1868          t_delais_reboot=$(echo "$*" | sed -e "s| |\n|g"|grep "delais_reboot=")
1869          if [ -n "$t_delais_reboot" ]; then
1870              delais_reboot=$(echo "$t_delais_reboot" | cut -d"=" -f2)
1871              opt_delais_reboot=" delais_reboot=$delais_reboot"
1872          fi
1873  
1874          url_authorized_keys=$(echo "$*" | sed -e "s| |\n|g"|grep "^url_authorized_keys="|cut -d"=" -f2)
1875          if [ -n "$url_authorized_keys" ]; then
1876              opt_url_authorized_keys=" url_authorized_keys=$url_authorized_keys"
1877          else
1878              opt_url_authorized_keys=""
1879          fi
1880  
1881          if [ "$auto_reboot" != "y" ]; then
1882              auto_reboot="n"
1883          fi
1884  
1885          fich=/tftpboot/pxelinux.cfg/01-$mac
1886  
1887          echo "# Script de boot de la machine $pc
1888  # MAC=$mac
1889  # IP= $ip
1890  # Date de generation du fichier: $timedate
1891  # Timestamp: $timestamp
1892  
1893  # Echappatoires pour booter sur le DD:
1894  label 0
1895     localboot 0x80
1896  label a
1897     localboot 0x00
1898  label q
1899     localboot -1
1900  label disk1
1901     localboot 0x80
1902  label disk2
1903    localboot 0x81
1904  
1905  # Label de reception:
1906  label srcdmdp
1907      kernel $kernel
1908      #initrd initram.igz" > $fich
1909  
1910          # A revoir: On peut avoir besoin de altker32,... au lieu de rescuecd
1911  
1912          if [ "$kernel" = "ifcpu64.c32" ]; then
1913              echo "    append rescue64 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=change_mdp_boot_loader.sh $options_mdp auto_reboot=$auto_reboot $opt_delais_reboot hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline} -- rescue32 initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=change_mdp_boot_loader.sh $options_mdp auto_reboot=$auto_reboot $opt_delais_reboot hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline}
1914          " >> $fich
1915          else
1916              echo "    append initrd=initram.igz scandelay=5 setkmap=fr netboot=http://$www_sysrcd_ip/sysresccd/sysrcd.dat autoruns=2,3 ar_source=http://$www_sysrcd_ip/sysresccd/ ar_nowait dodhcp work=change_mdp_boot_loader.sh $options_mdp auto_reboot=$auto_reboot $opt_delais_reboot hostname=$pc $opt_url_authorized_keys} $tftp_slitaz_cmdline}
1917          " >> $fich
1918          fi
1919  
1920          echo "# Choix de boot par dfaut:
1921  default srcdmdp
1922  
1923  # On boote aprs 6 secondes:
1924  timeout 60
1925  
1926  # Permet-on  l'utilisateur de choisir l'option de boot?
1927  # Si on ne permet pas, le timeout n'est pas pris en compte.
1928  prompt 1
1929  " >> $fich
1930      ;;
1931  
1932      "menage_tftpboot_pxelinux_cfg")
1933  
1934          mac=$(echo "$*" | sed -e "s| |\n|g"|grep "^mac="|cut -d"=" -f2 | sed -e "s/:/-/g" | sed -e "s|[^0-9A-Za-z\-]||g")
1935  
1936          fichier="/tftpboot/pxelinux.cfg/01-$mac"
1937          if [ -e "$fichier" ]; then
1938              echo -e "Suppression de $fichier \c";
1939              type_action=$(grep "^default " "$fichier" | sed -e "s|^default ||")
1940              if [ -n "$type_action" ]; then
1941                  echo "($type_action)";
1942              fi
1943              rm -f "$fichier"
1944          fi
1945      ;;
1946  
1947  esac


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1