#!/bin/bash
if [ $# -ne 2 ]
then
echo "La invocacion es: gen_parche.shl version dispositivo (Aura | Clara | One | AuraEd2)"
exit 1
fi
release=$1
device=$2
echo $release
echo $release | grep -E ^[0-9\.]+$ > /dev/null 2> /dev/null
if [ $? -ne 0 ]
then
echo "La version debe estar formada por numeros y ".""
exit 1
fi
case $device in
"Aura" ) dirDest="../"$device"/Parches"
dirFw="../Firmware/Mark 6 (One _ Aura Ed 2)"
;;
"Clara" ) dirDest="../"$device"/Parches"
dirFw="../Firmware/Mark 7 (Clara)"
fichConfig=kobopatch_Clara.yaml
;;
"One" ) dirDest="../Aura One/Parches"
;;
"AuraEd2" ) dirDest="../Aura Ed 2/Parches"
dirFw="../Firmware/Mark 6 (One _ Aura Ed 2)"
;;
*)
echo "La invocacion es: gen_parche.shl version dispositivo (Aura | Clara | One | AuraEd2)"
exit 1
;;
esac
FW="$dirFw""/kobo-update-"$release".zip"
nomFW="kobo-update-"$release".zip"
Patch="kobopatch_"$release".zip"
dirPatch="$dirDest""/kobopatch_"$release
if [ ! -s "$FW" ]
then
echo "No existe el
firmware $FW"
exit 1
fi
if [ ! -s "$Patch" ]
then
echo "No existe el parche $Patch"
exit 1
fi
echo $Patch
cp $Patch "$dirDest""/"$Patch
dirAct="$PWD"
cd "$dirDest"
unzip $Patch
cd $dirAct
sed 's/RELEASE_PATCH/'$release'/g' Configuracion/$fichConfig > "$dirPatch""/kobopatch.yaml"
echo $dirPatch
cp Guiones/hyph_en.dic "$dirPatch""/src"
echo $FW $dirPatch
cp "$FW" "$dirPatch""/src"
rm "$dirDest""/"$Patch
cp "$FW" .
unzip "$nomFW" KoboRoot.tgz
tar xvf KoboRoot.tgz ./usr/local/Kobo/nickel
mv usr/local/Kobo/nickel ../Traducciones
rm -rf usr KoboRoot.tgz "$nomFW"
cp Traducciones/trans_es_$device.ts ../Traducciones/trans_es.ts
cd ../Traducciones
python trans.py << _END
es
trans_es.ts
_END
mv new-trans_es.ts "$dirPatch""/src/trans_es.ts"
cd "$dirAct"