Pet by fredx181 Tested in Tahr 32bit today Thu Aug 13, 2020
Code: Select all
#!/bin/bash
# By Geoffrey, do with as you please.......
# 15052017
# Update Flash v1.8
# Used sed in place of perl as suggested by sfs
# yad no longer a dependency, uses gtkdialog
# fixed url not found "get.adobe.com/flashplayer/" from some locale's, get update version info from alternate url "adobe.com/software/flash/about" rg66
# fix linux detection by sfs
# 14122016 final, Linux flashplayer now follows Firefox - NPAPI
# 20022017 reverted back to using busybox strings to get libflashplayer.so version number
# now only looks for new version @ adobe.com/software/flash/about
# URL fix 15052017
# fredx181, 27102019, fix: change "about" url: 'adobe.com/software/flash/about/' to 'get.adobe.com/flashplayer/about/'
FLASH_UPDATER="$(readlink -e "$0")"
sleep 0.3
if [ `pidof "$(basename "$FLASH_UPDATER")" -o %PPID | wc -w` -gt 1 ]; then
gtkdialog-splash -icon "/usr/share/pixmaps/flash-player-properties.png" -timeout 6 -fontsize x-large -text "
Flash Updater is running.
" &
exit 1
fi
if [ ! -f ~/.flash_update/index.html ]; then
IFCONFIG="`ifconfig | grep '^[pwe]' | grep -v 'wmaster'`"
while [ "$IFCONFIG" != "" ]; do
sleep 1
ping -c 1 8.8.8.8
if [ $? -eq 0 ];then
break
else
ping -c 1 www.google.com
if [ $? -eq 0 ];then
break
fi
fi
done &> /dev/null
fi
function DOWNLOAD_FLASH(){
URL='fpdownload.adobe.com/get/flashplayer/pdc/'$LATEST_VERSION'/flash_player_npapi_linux.i386.tar.gz'
wget -t 2 -T 20 --waitretry=20 --spider -S "$URL" > ~/.flash_update/filesize 2>&1
SIZE=`echo $(awk '/^Length: / {print $3}' ~/.flash_update/filesize) | sed 's/^.\(.*\).$/\1/'`
export DOWNLOADER_GUI='
<window title="Download Flash Player Update" icon-name="flash-player-properties" border-width="10" resizable="false">
<vbox>
<progressbar width-request="300">
<label>Please Wait...</label>
<input>wget --no-check-certificate -4 -c -t 5 -w 5 -P ~/.flash_update '$URL' 2>&1 | sed -nru "s|.* ([0-9]+%) +([^ ]+).*$|\1\nDownloading \1 of '$SIZE' @ \2B/sec |p" 2>/dev/null</input>
<action type="exit">Ready</action>
</progressbar>
<hbox homogeneous="true">
<button use-underline="true">
<label>"_Cancel "</label>
<input file stock="gtk-close"></input>
<action>func_terminate_service</action>
<action>EXIT:exit</action>
</button>
</hbox>
</vbox>
</window>'
I=$IFS; IFS=""
for STATEMENTS in $(gtkdialog --program=DOWNLOADER_GUI); do
eval $STATEMENTS
done
IFS=$I
[ $EXIT = exit ] && exit 1
cd ~/.flash_update/
tar -zxvf flash_player_npapi_linux.i386.tar.gz libflashplayer.so &> /dev/null
chown root:root libflashplayer.so
cd /
rm /usr/lib/mozilla/plugins/libflashplayer.so
mv ~/.flash_update/libflashplayer.so /usr/lib/mozilla/plugins/libflashplayer.so
export INSTALLED_VERSION=$(busybox strings -n13 /usr/lib/mozilla/plugins/libflashplayer.so | grep 'FlashPlayer_' | cut -d '_' -f2-5| tr '_' '.')
gtkdialog-splash -icon "/usr/share/pixmaps/flash-player-properties.png" -timeout 6 -fontsize x-large -text "Flash Player has now been updated
Version $INSTALLED_VERSION"
[ "$LATEST_VERSION" = "$INSTALLED_VERSION" ] && rm -r ~/.flash_update
func_terminate_service
}
export -f DOWNLOAD_FLASH
func_terminate_service(){
PID_UPDATE_FLASH=$(pidof update_flash)
GUI=$(ps -ef | grep program=FLASH_UPDATER_GUI | grep -v grep | awk '{ print $2 }')
kill "$PID_UPDATE_FLASH"
kill "$GUI"
}
export -f func_terminate_service
[ ! -f ~/Startup/update_flash ] && echo false > ~/.update_flash
if grep -q true ~/.update_flash 2> /dev/null;then
CHECKBOX='<default>true</default>'
else
CHECKBOX='<default>false</default>'
fi
mkdir -p ~/.flash_update
if [ ! -f ~/.flash_update/index.html ]; then
# fredx181, changed about url to "get.adobe.com/flashplayer/about/"
wget --no-check-certificate -O- --spider get.adobe.com/flashplayer/about/ > ~/.flash_update/flash_url 2>&1
if grep -q '200 OK' ~/.flash_update/flash_url 2> /dev/null; then
wget -q -N -P ~/.flash_update get.adobe.com/flashplayer/about/
else
gtkdialog-splash -icon "/usr/share/pixmaps/flash-player-properties.png" -timeout 8 -fontsize x-large -text "The Adobe web site appears
to unavailable at this time
Please try again......."
rm -r ~/.flash_update && func_terminate_service
fi;fi
export LATEST_VERSION=`cat /root/.flash_update/index.html | grep -A3 Linux | grep [0-9] | awk -F '[><]' '{print $3}' | tr -d "\n"` #rg66
export INSTALLED_VERSION=$(busybox strings -n13 /usr/lib/mozilla/plugins/libflashplayer.so | grep 'FlashPlayer_' | cut -d '_' -f2-5| tr '_' '.')
if [ "$LATEST_VERSION" = "$INSTALLED_VERSION" ]; then
TEXT="<b><span size='"'large'"'>Adobe Flash is up to date...</span></b>"
TEXT_VERSION="<b><span size='"'x-large'"'>Current Version $INSTALLED_VERSION</span></b>"
TEXT_LINE1="$TEXT"
TEXT_LINE2="$TEXT_VERSION"
BUTTON1='<button use-underline="true">
<label>" _About"</label>
<input file stock="gtk-info"></input>
<action>disable:TIMER</action>
<action>launch:UPDATER_ABOUT</action>
</button>'
TIMER='<timer seconds="true" interval="8" visible="false">
<variable>TIMER</variable>
<action>EXIT:exit</action>
</timer>'
rm -r ~/.flash_update
else
if [ -f ~/.flash_update/flash_player_npapi_linux.i386.tar.gz ]; then
TEXT="<b><span size='"'large'"'>Adobe Flash update has already started...</span></b>"
TEXT_VERSION="<b><span size='"'x-large'"'>New Version $LATEST_VERSION</span></b>"
TEXT_LINE1="$TEXT"
TEXT_LINE2="$TEXT_VERSION"
BUTTON1='<button use-underline="true">
<label>" _About"</label>
<input file stock="gtk-info"></input>
<action>launch:UPDATER_ABOUT</action>
</button>'
BUTTON2='<button use-underline="true">
<label>"_Resume"</label>
<input file stock="gtk-apply"></input>
<action>DOWNLOAD_FLASH</action>
</button>'
else
TEXT="<b><span size='"'large'"'>A New Adobe Flash update is Available</span></b>"
TEXT_VERSION="<b><span size='"'x-large'"'>New Version $LATEST_VERSION</span></b>"
TEXT_LINE1="$TEXT"
TEXT_LINE2="$TEXT_VERSION"
BUTTON1='<button use-underline="true">
<label>" _About"</label>
<input file stock="gtk-info"></input>
<action>launch:UPDATER_ABOUT</action>
</button>'
BUTTON2='<button use-underline="true">
<label>"_Update"</label>
<input file stock="gtk-apply"></input>
<action>DOWNLOAD_FLASH</action>
</button>'
fi;fi
LINK="<b><u><span color='"'blue'"'>Update Flash 1.8 By Geoffrey 15th May 2017</span></u></b>"
ABOUT="<b><span size='"'x-large'"'>Adobe Flash Updater</span></b>"
export UPDATER_ABOUT='
<window title="Flash Player Updater" icon-name="gtk-about">
<vbox>
<text wrap="false" justify="2" use-markup="true"><label>"'$ABOUT'"</label></text>
<eventbox tooltip-text=" Adobe Flash Player Auto Updater " hover-selection="true" homogeneous="true">
<text justify="2" use-markup="true"><label>"'$LINK'"</label></text>
<action signal="button-press-event">defaultbrowser http://www.murga-linux.com/puppy/viewtopic.php?t=100523 &</action>
</eventbox>
<text><label>""</label></text>
<text wrap="false" justify="2" use-markup="true"><label>"Updates only the flash player plugin libflashplayer.so"</label></text>
<text><label>""</label></text>
<hbox space-fill="false" space-expand="true" homogeneous="true">
<button ok>
<action>closewindow:UPDATER_ABOUT</action>
</button>
</hbox>
</vbox>
<variable>UPDATER_ABOUT</variable>
</window>'
export FLASH_UPDATER_GUI='
<window title="Flash Player Updater" icon-name="flash-player-properties" border-width="10" resizable="false">
<vbox>
<hbox>
<vbox>
<pixmap>
<input file icon="flash-player-properties"></input>
<height>48</height><width>48</width>
</pixmap>
</vbox>
<vbox>
<text wrap="false" xalign="0" use-markup="true"><label>"'$TEXT_LINE1'"</label></text>
<text wrap="false" xalign="0" use-markup="true"><label>"'$TEXT_LINE2'"</label></text>
<checkbox use-underline="true">
'$CHECKBOX'
<label>_Run Flash Player Updater at startup</label>
<variable>STARTUP</variable>
<action>echo $STARTUP > ~/.update_flash</action>
<action>if true ln -s /usr/bin/update_flash ~/Startup/update_flash &> /dev/null</action>
<action>if false rm ~/Startup/update_flash &> /dev/null</action>
</checkbox>
</vbox>
</hbox>
<hbox homogeneous="true">
<hbox>
'$TIMER'
'$BUTTON1'
'$BUTTON2'
<button use-underline="true">
<label>"_Cancel "</label>
<input file stock="gtk-close"></input>
<action>EXIT:exit</action>
</button>
</hbox>
</hbox>
</vbox>
</window>'
gtkdialog --program=FLASH_UPDATER_GUI >/dev/null 2>&1