[Udpcast] Giving options through boot cmdline and udpcparam

Stephane Boireau stephane.boireau at free.fr
Sun Sep 21 19:35:20 CEST 2008


Hi,

Le samedi 20 septembre 2008 08:50, vous avez écrit :
> Stephane Boireau wrote:
> > ======================
> > I already sent this message, but I get troubles using the other email...
> > ======================
> >
> > I don't succeed in giving two options through apend boot cmdline.
> > Here is my cmdline:
> >
> > label u1auto
> >     kernel vmlu26
> >     append initrd=udprd root=01:00 persoparams=oui lang=FR kbmap=FR
> > dhcp=yes compr=lzop port=9002 umode=snd disk=/dev/hda1 auto_reboot=always
> > enableDiskmodule=yes diskmodule=AUTO netmodule=AUTO
> > udpcparam=--max-wait=300--min-receivers=2
> >
> > A script is launched using predialog.
> > It writes the /udpcfg.txt file.
> >
> > With the above cmdline, I get:
> >
> > 	udpsender -p lzop --file /dev/hda1 -P 9002 -i
> > eth0 --max-wait=300--min-receiver=2
>
> Yes, that's what you typed... see above.

I know.
But
	udpcparam=--max-wait=300 --min-receiver=2
doesn't work in boot cmdline.


> > instead of
> >
> > 	udpsender -p lzop --file /dev/hda1 -P 9002 -i
> > eth0 --max-wait=300 --min-receiver=2
> >
> > And it doesn't work.
>
> Makes sense.
>
> > ===========================
> >
> > I've tried:
> >
> > label u1auto
> >     kernel vmlu26
> >     append initrd=udprd root=01:00 persoparams=oui lang=FR kbmap=FR
> > dhcp=yes compr=lzop port=9002 umode=snd disk=/dev/hda1 auto_reboot=always
> > enableDiskmodule=yes diskmodule=AUTO netmodule=AUTO
> > udpcparam=--max-wait=300|--min-receivers=2
>
>                           ^
> You need a space there. Try putting the parameter between quotes to
> avoid it being interpreted as two parameters:
> udpcparam="--max-wait=300 --min-receivers=2"

I'll try...


> > And my predialog script does:
> >
> > 	udpcparam=`echo "$udpcparam" | sed -e "s/|/ /g"`
> > 	echo "udpcparam=$udpcparam" >> /udpcfg.txt
>
> Why don't you put this directly into udpcfg.txt?

I can't.
The boot cmdline is put in /tftpboot/pxelinux.cfg/01-ADDRESS_MAC
PHP web interface is used to build 01-ADDRESS_MAC the way I wan't to clone 
this or this.

It's a part of sambaedu3 project.
I use udpcast in se3-clonage package.


> > But it doesn't work.
> > /udpcfg.txt contains
> > ...
> > umode=snd
> > udpcparam=--max-wait=300 --min-receivers=2
>
> correct (no need for quotes here, as the different parameters are
> line-separated)
>
> > And I get
> >
> > Udp-sender 2007-12-28
> > --min-receivers=2: not found
> > Using mcast address 232.168.52.210
> > Compressed UDP sender for /dev/hda1 at 192.168.52.210 on eth0
> > Broadcasting control to 192.168.52.255
> >
> > and it fails.
>
> Works for me (just tried it out by editing the SYSLINUX.CFG on a floppy
> image)

Argh?

You're right.
It's OK if I put:
	udpcparam="--max-wait=300 --min-receivers=2"
in 01-ADDRESS_MAC


Regards.
-- 
Stephane Boireau.

PS:
Here is my udpcfg_txt.sh scripts launched in predialog script:
========================================
#!/bin/sh

# Script de recuperation de parametres de l'isolinux.cfg
# pour renseigner le fichier udpcfg.txt avant lancement de udpc_dialog
# L'objectif est d'eviter le stockage de 3 initrd pour le mode standard,
# le mode preselectionne en emission
# et le mode preselectionne en reception.
# Auteur: Stephane Boireau
# Derniere modification: 15/09/2008

#Couleurs
COLTITRE='\033[1;35m'
# Rose
COLPARTIE='\033[1;34m'
# Bleu

COLTXT='\033[0;37m'
# Gris
COLCHOIX='\033[1;33m'
# Jaune
COLDEFAUT='\033[0;33m'
# Brun-jaune
COLSAISIE='\033[1;32m'
# Vert

COLCMD='\033[1;37m'
# Blanc

COLERREUR='\033[1;31m'
# Rouge
COLINFO='\033[0;36m'
# Cyan



echo -e "$COLTITRE"
echo "********************"
echo "* Preconfiguration *"
echo "********************"

echo -e "$COLTXT"
echo "Recuperation des parametres d'isolinux..."
echo -e "$COLCMD"
# On devrait recuperer des choses comme:
#       initrd=linux/udpcast/udprd root=01:00
# Et eventuellement en plus les autres parametres ajoutes à 'append'.
cat /proc/cmdline
sleep 1
sh /proc/cmdline

if [ "$persoparams" = "oui" ]; then
        echo -e "$COLTXT"
        echo "Regeneration de l'udpcfg.txt"
        #echo -e "$COLCMD"
        echo "auto=yes" > /udpcfg.txt

        if [ "$lang" = "" ]; then
                echo "lang=FR" >> /udpcfg.txt
        else
                echo "lang=$lang" >> /udpcfg.txt
        fi

        if [ "$kbmap" = "" ]; then
                echo "kbmap=FR" >> /udpcfg.txt
        else
                echo "kbmap=$kbmap" >> /udpcfg.txt
        fi

        if [ "$netmodule" = "" ]; then
                echo "Pas de module reseau predefini."
        else
                echo "netmodule=$netmodule" >> /udpcfg.txt
                echo "netmodparm=$netmodparm" >> /udpcfg.txt
        fi

        if [ "$dhcp" = "" ]; then
                #echo -e "$COLTXT"
                echo "Pas de preselection du mode DHCP."
        else
                echo "dhcp=$dhcp" >> /udpcfg.txt
        fi

        if [ "$enableDiskmodule" = "yes" ]; then
                echo "enableDiskmodule=yes" >> /udpcfg.txt
                echo "diskmodule=$diskmodule" >> /udpcfg.txt
                echo "diskmodparm=$diskmodparm" >> /udpcfg.txt
        fi

        if [ "$port" = "" ]; then
                #echo -e "$COLTXT"
                echo "Pas de port defini."
        else
                echo "port=$port" >> /udpcfg.txt
        fi

        if [ "$compr" = "" ]; then
                #echo -e "$COLTXT"
                echo "Pas de niveau de compression defini."
        else
                echo "compr=$compr" >> /udpcfg.txt
        fi

        if [ "$disk" = "" ]; then
                #echo -e "$COLTXT"
                echo "Pas de disque dur preselectionne."
        else
                echo "disk=$disk" >> /udpcfg.txt
        fi

        echo "mode=0" >> /udpcfg.txt

        echo "umode=$umode" >> /udpcfg.txt
        #echo "udpcparam=$udpcparam" >> /udpcfg.txt
        #echo "udpcparam=`echo $udpcparam | tr '?' ' '  | tr '.' '-'`" 
>> /udpcfg.txt
        #echo "udpcparam=$udpcparam" >> /udpcfg.txt
        udpcparam=`echo "$udpcparam" | sed -e "s/|/ /g"`
        echo "udpcparam=$udpcparam" >> /udpcfg.txt

        #echo "udpcparam=`echo $udpcparam | tr '_' ' '`" >> /udpcfg.txt
fi

if [ "$kusb" = "1" -o "$kusb" = "o" -o "$kusb" = "y" ]; then
        echo -e "$COLTXT"
        echo "Chargement des pilotes pour le support d'un clavier USB."
        echo -e "$COLCMD"
        modprobe uhci-hcd
        modprobe ohci-hcd
        modprobe usbkbd
fi


#echo "$COLTXT"
#echo "Tentative d'ejection du CD..."
#echo "$COLCMD"
#modprobe ide-cd
#/bin/udpc_dialog init
#( cd /proc/ide ; for i in hd? ; do if fgrep -q cdrom $i/media ; then 
eject /dev/$i ; echo ejecting /dev/$i ; fi ; done)

echo -e "$COLTITRE"
echo "Fin"
#read PAUSE
if [ -e "/bin/date" ]; then
        datedebut=`/bin/date "+%Y-%m-%d %H:%M:%S"`
else
        datedebut=`date "+%Y-%m-%d %H:%M:%S"`
fi
echo "Debut: $datedebut" > /tmp/dates.txt
sleep 1

# u1 netmodule=AUTO enableDiskmodule=no disk=/dev/hda udpcparam=..autostart?12

#echo "Appuyez sur une touche pour poursuivre"
#read PAUSE
========================================


My predialog script:
========================================
#!/bin/sh

# Script Udpcast (genere par Cast-o-matic et modifie par Stephane Boireau)
# Dernière modification: 20080111

# Chargement du module:
modprobe ide-cd

# Preparation du dialogue de fin de boot:
/bin/udpc_dialog init

#       # Tentative d ejection du CD:
#       modprobe ide-cd
#       #( cd /proc/ide ; for i in hd? ; do if fgrep -q cdrom $i/media ; then 
eject /dev/$i ; echo ejecting /dev/$i ; fi ; done)
#       # Le support /proc/ide n'est plus dans le noyau
#       #periph_cd=`fgrep -l cdrom /sys/block/*/device/media | 
sed 's/\/sys\/block\/\(.*\)\/device\/media/\1/'`
#       periph_cd=`fgrep -l cdrom /sys/block/*/device/media | cut -d"/" -f4`
#       if [ ! -z "$periph_cd" ]; then
#               echo ""
#               echo "Ejection du cdrom: /dev/$periph_cd"
#               ls -l /dev/$periph_cd
#               eject /dev/$periph_cd
#               if [ "$?" != 0 ]; then
#                       ls /dev/
#                       read PAUSE
#               fi
#       fi

# Generation du fichier de preferences /udpcfg.txt
sh /bin/udpcfg_txt.sh
# Apres ce predialog, l'interface du menu udpcast est affichee...
========================================


My prescript:
========================================
#!/bin/sh

# Tentative d ejection du CD:
#/bin/eject_cd.sh
modprobe ide-cd
#( cd /proc/ide ; for i in hd? ; do if fgrep -q cdrom $i/media ; then 
eject /dev/$i ; echo ejecting /dev/$i ; fi ; done)
# Le support /proc/ide n'est plus dans le noyau
#periph_cd=`fgrep -l cdrom /sys/block/*/device/media | 
sed 's/\/sys\/block\/\(.*\)\/device\/media/\1/'`
periph_cd=`fgrep -l cdrom /sys/block/*/device/media | cut -d"/" -f4`
if [ ! -z "$periph_cd" ]; then
        echo ""
        echo "Ejection du cdrom: /dev/$periph_cd"
        #ls -l /dev/$periph_cd
        eject /dev/$periph_cd
        #if [ "$?" != 0 ]; then
        #        ls /dev/
        #        read PAUSE
        #fi
fi

# Prevenir l extinction de l ecran
#/bin/no_blank_screen.sh
echo -e '\033[9;0]'
========================================


And postscript:
========================================
#!/bin/sh

# Script d affichage des dates de debut et de fin
# Auteur: Stephane Boireau
# Derniere modification: 19/01/2008

#echo "Variables: $*"

# Resultat du clonage:
resultat=$1

#Couleurs
COLTITRE='\033[1;35m'
# Rose
COLPARTIE='\033[1;34m'
# Bleu

COLTXT='\033[0;37m'
# Gris
COLCHOIX='\033[1;33m'
# Jaune
COLDEFAUT='\033[0;33m'
# Brun-jaune
COLSAISIE='\033[1;32m'
# Vert

COLCMD='\033[1;37m'
# Blanc

COLERREUR='\033[1;31m'
# Rouge
COLINFO='\033[0;36m'
# Cyan


echo -e "$COLTITRE"
echo "***********************"
echo "* Resultat du clonage *"
echo "***********************"

succes=""
if [ -z "$resultat" ]; then
        echo -e "$COLTXT"
        echo "Le clonage n a pas retourne de resultat (succes ou echec)."
else
        if [ "$resultat" = "0" ]; then
                echo -e "$COLTXT"
                echo "SUCCES."
                succes="y"
        else
                echo -e "$COLERREUR"
                echo "ECHEC."
                succes="n"
        fi
fi

echo -e "$COLTITRE"
echo "*****************"
echo "* Duree ecoulee *"
echo "*****************"

echo -e "$COLTXT"
echo "Voici les dates relevees..."
echo -e "$COLCMD"
if [ -e "/bin/date" ]; then
        datefin=`/bin/date "+%Y-%m-%d %H:%M:%S"`
else
        datefin=`date "+%Y-%m-%d %H:%M:%S"`
fi
echo "Fin:   $datefin" >> /tmp/dates.txt
cat /tmp/dates.txt
echo -e "$COLINFO"
echo "Ces dates peuvent etre incorrectes si les machines n etaient pas a l 
heure."
echo "Mais la difference entre les heures de debut et de fin donne le temps 
de"
echo "clonage."

#test=$(grep reboot /proc/cmdline)
#if [ ! -z "$test" ]; then
#       IFS=" "
#       while read A
#       do
#               B=$(echo "$A" | grep reboot | cut -d"=" -f2)
#               if [ ! -z "$B" ]; then
#                       sleep $B
#                       reboot
#               fi
#       done < /proc/cmdline

if grep "auto_reboot=always" /proc/cmdline > /dev/null; then
        sleep 5
        reboot
else
        if grep "auto_reboot=success" /proc/cmdline > /dev/null; then
                if [ "$succes" = "y" ]; then
                        sleep 5
                        reboot
                else
                        echo -e "$COLERREUR"
                        echo "Un probleme s est produit lors du clonage."
                        read PAUSE
                fi
        else
                echo -e "$COLTXT"
                echo "Vous pouvez rebooter..."
                read PAUSE
        fi
fi
========================================





More information about the Udpcast mailing list