Page 1 of 3
Auto Revert Firmware Back Software
Posted: Thu Jul 22, 2010 7:17 pm
by erdem_ua
Since too many people have this issue,
I decided to make a script that enables older firmware...
How it's looking?
Code: Select all
#I planned thet to detecting partition that needed to enable, used to sense PartitionSwithch file....
if [ -f /mtd_rwarea/PartitionSwitch_1_0 ]
then
mkdir /dtv/test
mount -t auto /dev/tbml8 /dtv/test
#OLDVERS = T-CHL7DEUC-2004.1
OLDVERS=$(/bin/busybox egrep -e 'T-CHL7DEUC-[0-9][0-9][0-9][0-9].[0-9]' /dtv/test/exeDSP)
#OLDVERS=2004
OLDVERS=$(echo $OLDVERS | sed s/.*-//g | sed 's/\..*//g')
echo $(sed 's/_00[0-9][0-9][0-9][0-9]_/_00'$OLDVERS'_/g' Version.1) > Version.0
else
mkdir /dtv/test
mount -t auto /dev/tbml10 /dtv/test
#OLDVERS = T-CHL7DEUC-2004.1
OLDVERS=$(/bin/busybox egrep -e 'T-CHL7DEUC-[0-9][0-9][0-9][0-9].[0-9]' /dtv/test/exeDSP)
#OLDVERS=2004
OLDVERS=$(echo $OLDVERS | sed s/.*-//g | sed 's/\..*//g')
echo $(sed 's/_00[0-9][0-9][0-9][0-9]_/_00'$OLDVERS'_/g' Version.0) > Version.1
fi
Re: Auto Revert Firmware Back Software
Posted: Fri Jul 23, 2010 12:39 am
by erdem_ua
Himmm, there is a problem at script. Because you needed to have Version.1 if you have PartitionSwitch_1_0 file.
Problem is that I forgot to place full path names. I think this script is proper now.
Touch is not required because echo will create the destination file automatically.
Code: Select all
if [ -f /mtd_rwarea/PartitionSwitch_1_0 ]
then
mkdir /dtv/test
mount -t auto /dev/tbml8 /dtv/test
#OLDVERS = T-CHL7DEUC-2004.1
OLDVERS=$(/bin/busybox egrep -e 'T-CHL7DEUC-[0-9][0-9][0-9][0-9].[0-9]' /dtv/test/exeDSP)
#OLDVERS=2004
OLDVERS=$(echo $OLDVERS | sed s/.*-//g | sed 's/\..*//g')
echo $(sed 's/_00[0-9][0-9][0-9][0-9]_/_00'$OLDVERS'_/g' /mtd_rwarea/Version.1) > /mtd_rwarea/Version.0
else
mkdir /dtv/test
mount -t auto /dev/tbml10 /dtv/test
#OLDVERS = T-CHL7DEUC-2004.1
OLDVERS=$(/bin/busybox egrep -e 'T-CHL7DEUC-[0-9][0-9][0-9][0-9].[0-9]' /dtv/test/exeDSP)
#OLDVERS=2004
OLDVERS=$(echo $OLDVERS | sed s/.*-//g | sed 's/\..*//g')
echo $(sed 's/_00[0-9][0-9][0-9][0-9]_/_00'$OLDVERS'_/g' /mtd_rwarea/Version.0) > /mtd_rwarea/Version.1
fi
Moving this to Telnet Enabler app will create auto firmware downgrade application

But before we needed to change "T-CHL7DEUC" string with auto detected firmware name. I think current version file that exits will help us

Re: Auto Revert Firmware Back Software
Posted: Fri Jul 23, 2010 8:20 am
by arris69
erdem_ua wrote:...
Moving this to Telnet Enabler app will create auto firmware downgrade application

But before we needed to change "T-CHL7DEUC" string with auto detected firmware name. I think current version file that exits will help us

think safe way to detect the right firmware-type is from the file /.info
ack?
arris
Re: Auto Revert Firmware Back Software
Posted: Tue Jul 27, 2010 8:53 pm
by juusso
erdem_ua wrote:I think this script is proper now.
Hi, two questions:
1. Do we need paste this script code between:
to have right script file to run it? eg. revert.sh ? (and chmod it to 755 of course)
2. If i understood right, these rows are not important in case if the fw version is different, not 2004.1?
Code: Select all
#OLDVERS = T-CHL7DEUC-2004.1
...
#OLDVERS=2004
...
They are after
#, so they`re just comments?
Tx.
Re: Auto Revert Firmware Back Software
Posted: Tue Jul 27, 2010 11:38 pm
by erdem_ua
arris69 wrote:erdem_ua wrote:...
Moving this to Telnet Enabler app will create auto firmware downgrade application

But before we needed to change "T-CHL7DEUC" string with auto detected firmware name. I think current version file that exits will help us

think safe way to detect the right firmware-type is from the file /.info
ack?
arris
You are right as always

Do you know how could I make it proper? Lines below doesn't look working good...
Code: Select all
FWNAME=$(cat /.info)
OLDVERS=$(/bin/busybox egrep -e '$(FWNAME)-[0-9][0-9][0-9][0-9].[0-9]' /dtv/test/exeDSP)
Re: Auto Revert Firmware Back Software
Posted: Tue Jul 27, 2010 11:41 pm
by erdem_ua
juuso wrote:erdem_ua wrote:I think this script is proper now.
Hi, two questions:
1. Do we need paste this script code between:
to have right script file to run it? eg. revert.sh ? (and chmod it to 755 of course)
2. If i understood right, these rows are not important in case if the fw version is different, not 2004.1?
Code: Select all
#OLDVERS = T-CHL7DEUC-2004.1
...
#OLDVERS=2004
...
They are after
#, so they`re just comments?
Tx.
1. I don't know if bash scripts are terminated with exit

But It's good thing to put #!/bin/sh to header...
2.Those are just for testing, developing

Not important.
Re: Auto Revert Firmware Back Software
Posted: Thu Jul 29, 2010 3:37 pm
by arris69
erdem_ua wrote:
...
Do you know how could I make it proper? Lines below doesn't look working good...
Code: Select all
FWNAME=$(cat /.info)
OLDVERS=$(/bin/busybox egrep -e '$(FWNAME)-[0-9][0-9][0-9][0-9].[0-9]' /dtv/test/exeDSP)
i'm not shure what you need in your variable, but grepping in a binary is a pain
Code: Select all
FWNAME=`head -n 1 /.info`
OLDVERS=$(egrep -a "$FWNAME-[0-9][0-9][0-9][0-9].[0-9]" /dtv/test/exeDSP)
ver=${OLDVERS#*$FWNAME-}
fver="$FWNAME-$ver"
len=$((${#FWNAME} + 7))
rver=${fver:0:len}
echo $rver
hope samy's egrep supports -a option, can't test it
hth
arris
Re: Auto Revert Firmware Back Software
Posted: Wed Aug 04, 2010 8:02 pm
by erdem_ua
arris69 wrote:erdem_ua wrote:
...
hope samy's egrep supports -a option, can't test it
hth
arris
Code: Select all
# OLDVERS=$(egrep -a "$FWNAME-[0-9][0-9][0-9][0-9].[0-9]" /dtv/test/exeDSP)
egrep: invalid option -- a
but
Code: Select all
OLDVERS=$(grep $(echo "$FWNAME-[0-9][0-9][0-9][0-9].[0-9]") /dtv/test/exeDSP)
makes the job.
THE LATEST SCRIPT:
Code: Select all
if [ -f /mtd_rwarea/PartitionSwitch_1_0 ]
then
mkdir /dtv/test
mount -t auto /dev/tbml8 /dtv/test
FWNAME=$(cat /.info)
OLDVERS=$(/bin/busybox egrep -e $(echo "$FWNAME-[0-9][0-9][0-9][0-9].[0-9]") /dtv/test/exeDSP)
OLDVERS=$(echo $OLDVERS | sed s/.*-//g | sed 's/\..*//g')
echo $(sed 's/_00[0-9][0-9][0-9][0-9]_/_00'$OLDVERS'_/g' /mtd_rwarea/Version.1) > /mtd_rwarea/Version.0
else
mkdir /dtv/test
mount -t auto /dev/tbml10 /dtv/test
OLDVERS=$(/bin/busybox egrep -e $(echo "$FWNAME-[0-9][0-9][0-9][0-9].[0-9]") /dtv/test/exeDSP)
OLDVERS=$(echo $OLDVERS | sed s/.*-//g | sed 's/\..*//g')
echo $(sed 's/_00[0-9][0-9][0-9][0-9]_/_00'$OLDVERS'_/g' /mtd_rwarea/Version.0) > /mtd_rwarea/Version.1
fi
Looks working on here
