From: Serge L. <ser...@gm...> - 2010-09-06 18:13:37
|
Heiko, actually, I have tested the code before posting, but it will be great to get feedback before I merge this fragment (which converts network interface files only) into upgrade-config. I'm asking because the price of my mistake in this case is quite big - after upgrade the network might be inaccessible. Any volunteers are welcome :) Serge On 09/06/2010 07:04 AM, Heiko Zuerker wrote: > Hey, > > I blame this question on my hangover... > How do you want to me to test, this seems like just a code fragment. > > Heiko > >> -----Original Message----- >> From: Serge Leschinsky [mailto:ser...@gm...] >> Sent: Sunday, September 05, 2010 5:37 PM >> To: dev...@li... >> Subject: Re: [Devil-linux-develop] network configuration script - add >> routes >> >> Please test this code: >> >> # cat upgrade >> >> convert_routes () >> { >> local file=$1 >> grep "^ROUTE=" $file | while read line; >> do >> unset ROUTE net gw >> eval $line >> >> if echo $ROUTE | grep "via\|dev" > /dev/null 2>&1; then >> echo $line; continue ; >> fi >> >> if echo $ROUTE | grep ":" > /dev/null 2>&1; then >> net=$(echo $ROUTE | cut -d':' -f1) >> gw=$(echo $ROUTE | cut -d':' -f2) >> else >> net=$(echo $ROUTE) # to remove spaces >> fi >> >> #echo $net $gw $dev >> >> # fixes >> if echo $net | grep default > /dev/null 2>&1; then >> net="default"; >> fi >> >> if [ x"$gw" == "x" ]; then >> dev="dev \$DEVICE"; >> else >> gw="via $gw"; >> fi >> >> echo "ROUTE=\"$net $gw $dev\"" >> done >> >> } >> >> # convert network interface configuration to new format for iface in >> /etc/sysconfig/nic/*; do >> >> version=$(awk -F "@version:" ' /^#@version:/ { print $2}' $iface) >> >> if [ -n "$version" ]; then >> # conversion from version "x" >> # Versions other then '1' was not released yet" >> continue >> else >> cp $iface $iface.conversion >> echo "#@version: 1" > $iface >> sed -e 's/^ROUTE/#ROUTE/g' $iface.conversion >> $iface >> convert_routes $iface.conversion >> $iface >> rm -f $iface.conversion >> fi >> >> done >> >> >> >> On 09/05/2010 12:08 PM, Heiko Zuerker wrote: >>> Yes that would make sense. >>> >>> H. >>> >> >> > ------------------------------------------------------------------------ > ------ >> This SF.net Dev2Dev email is sponsored by: >> >> Show off your parallel programming skills. >> Enter the Intel(R) Threading Challenge 2010. >> http://p.sf.net/sfu/intel-thread-sfd >> _______________________________________________ >> Devil-linux-develop mailing list >> Dev...@li... >> https://lists.sourceforge.net/lists/listinfo/devil-linux-develop > > > ------------------------------------------------------------------------------ > This SF.net Dev2Dev email is sponsored by: > > Show off your parallel programming skills. > Enter the Intel(R) Threading Challenge 2010. > http://p.sf.net/sfu/intel-thread-sfd > _______________________________________________ > Devil-linux-develop mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/devil-linux-develop > |