Changes

Google Chrome

2,177 bytes added, 10:13, 8 October 2013
update-chrome-xml.sh
=== update-chrome-xml.sh ===
 
Just to get an idea how this can be done using bash scripting if your wpkg share is on linux using samba, here is my script which checks if there is a newer version of google chrome. Only then it copies the msi file and creates new xml file from template. It substitutes the __VERSION__ and __MSIKEY__ strings, which are extracted from the msi file. Seems like a quick hack to get the strings out of the MSI file, at least it works at the moment.
 
<source lang='bash'>
#!/bin/bash
 
# source: http://wpkg.org/Google_Chrome#Automated_Updates_of_Chrome.27s_WPKG_Files
#
 
MAINPATH=/srv/share/install
TMPPATH=$MAINPATH/temp
DESTPATH=$MAINPATH/packages/GoogleChrome
TEMPLATE=$MAINPATH/packages/Templates/googlechrome.xml
FILENAME=googlechrome.xml
TEMPFILE=$TMPPATH/$FILENAME
DESTFILE=$MAINPATH/packages/$FILENAME
 
DLFILE=GoogleChromeStandaloneEnterprise
DLSOURCE=https://dl.google.com/edgedl/chrome/install/$DLFILE.msi
 
 
cd $TMPPATH
rm $DLFILE.msi
/usr/bin/wget --no-check-certificate $DLSOURCE
 
RAWSTRINGS=`/usr/bin/strings $DLFILE.msi | /bin/grep -EC3 "^Installer$" | tr "\n" " " `
 
for k in ${RAWSTRINGS} ; do
unset SUBSTRING1; unset SUBSTRING2 ;
SUBSTRING1=`expr match "$k" '\([[:digit:].]\{12,16\}\)' `
if [ -n "${SUBSTRING1}" ] ; then
GCVERSION="$SUBSTRING1";
break
fi
done
for k in ${RAWSTRINGS} ; do
SUBSTRING2=`expr match "$k" '{\([[:alnum:]-]\{36\}\)}' `
if [ -n "$SUBSTRING2" ] ; then
GCMSIKEY=$SUBSTRING2;
break
fi
done
 
echo Version: $GCVERSION
echo Key: $GCMSIKEY
 
if [ -z "$GCVERSION" ] ; then
echo no version found
exit 2
fi
# create xml file from template
 
sed -e "s/__VERSION__/${GCVERSION}/" <$TEMPLATE | sed -e "s/__MSIKEY__/${GCMSIKEY}/" >$TEMPFILE
 
diff -wB $TEMPLATE $TEMPFILE >/dev/null
 
if [ $? -eq 0 ] ; then
# version not changed
echo string error
exit 1
fi
 
diff -wB $TEMPFILE $DESTFILE >/dev/null
 
if [ $? -eq 0 ] ; then
# no difference
echo not newer
rm $DLFILE.msi
exit 0
fi
 
echo copying files
 
mv $DLFILE.msi $DESTPATH/$DLFILE-$GCVERSION.msi
cp $TEMPFILE $DESTFILE
 
</source>
 
--[[User:Ftrojahn|Ftrojahn]] 12:09, 08 October 2013 (CEST)
== Google Chrome 21 ==
66
edits