You are not logged in.

#1 2017-11-13 13:44

bin
Member
From: U.K.
Registered: 2016-01-28
Posts: 1,337

A small challenge to create a working Flash installer/updater

As we all know the Debian Jessie flashplugin-nonfree installer doesn't work any more.
That's because it is statically linked to a particular Adobe file which is now out of date and no longer exists.

It seemed to me that all that was needed is a way of querying the Adobe web site and finding the latest .tgz file, downloading, unpacking and copying the bits to the right place.

Handraulically it is of course easy, programmatically not so much.

I came across a very interesting script which actually relates to Chromium 32 bit, but contains the guts of what is needed.

Essentially it parses http://www.adobe.com/software/flash/about/ looking for Linux, finding the version number, creating a variable based on that and then doing a wget inserting that variable where relevant.

From here it gets puzzling as the dl link for 64bit for Firefox is:-
https://get.adobe.com/flashplayer/downl … andalone=1

So, what I'm wondering is whether anyone out there has the skills to take this script apart, bin all the Chromium 32 bit related stuff and use the guts to make a script that could run in cron.xxxx so that one can be sure of always having the latest version.
1 Query for latest version
2 Download
3 Unzip
4 Copy -u bits to /usr and ~/home/.mozilla/plugins

Last edited by bin (2017-12-23 08:17)


Attachments:
flash installer, Size: 8.54 KiB, Downloads: 1,167

Offline

#2 2017-11-13 15:34

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,993

Re: A small challenge to create a working Flash installer/updater

I'll take a look and post here if I can make it work.=)

Offline

#3 2017-11-13 16:24

bin
Member
From: U.K.
Registered: 2016-01-28
Posts: 1,337

Re: A small challenge to create a working Flash installer/updater

smile

Offline

#4 2017-11-13 21:44

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,993

Re: A small challenge to create a working Flash installer/updater

This has been a bit of a problem as I can't find a way to catch the version number using cli methods (curl and wget both fail) so I found a script that will open your browser (currently set to Firefox, must be one of 'google-chrome', 'chromium-browser' or 'firefox') and loads the adobe page, saves it to /tmp and then can extract the version number and downlload the latest flash available, then it extracts the libflashplayer.so file and places it in /usr/lib/flashplayer-mozilla/ then you will have the latest version available.
Be warned though, I have not put error checking into the script so if there is a problem it will attempt to continue and should spit out error messages into the console.
The script also relies on xdotool which can be installed in the usual manner (sudo apt-get instal xdotool)
I have tested it on my system and it worked, but if your browser is slower to load it could fail and if this is the case you can edit the delay time at line 13 (load_wait_time=10) to whatever works with your installation.
I hope this goes part-way to a solution for you.

Just downlload the script and make it executable (chmod +x autoflash) and run it (./autoflash), obviously you can put it into the $PATH to run it from anywhere with the command autoflash

Dai


Attachments:
autoflash, Size: 9.64 KiB, Downloads: 1,173

Offline

#5 2017-11-14 16:14

bin
Member
From: U.K.
Registered: 2016-01-28
Posts: 1,337

Re: A small challenge to create a working Flash installer/updater

Thanks for that Dai - interesting option and worth a go!

Alternatively, looking at Adobe and the archived versions my guess is that the download link will work for any subversion of the current v27 release.

So, running that at daily or weekly interval in a script and using the unpack and copy commands suggested should leave things no worse off than they are now with having to do it manually and still better than broken deb.

If only everyone eveyrwhere would dump Flash the world would be a little simpler I'm sure.... smile

Offline

#6 2017-11-14 19:04

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,993

Re: A small challenge to create a working Flash installer/updater

I have another version you can try, this time it checks installed version before downloading and doesn't require using a browser (not exactly anyway) but does require strings and lynx to be installed, again they are in the repos and can be installed with sudo apt-get install lynx strings or your preferred method. This one is easier and smaller and should work from cron (not tested though).


Attachments:
autoflash2, Size: 861 B, Downloads: 1,201

Offline

#7 2017-11-15 09:04

bin
Member
From: U.K.
Registered: 2016-01-28
Posts: 1,337

Re: A small challenge to create a working Flash installer/updater

Thanks for that Dai.
Stepping through the file you:-
Check libflashplayer.so for its version and set that as instver
Use lynx to dump the contents of the Adobe Archived page
Locate the top of the Release list and set that version as the newver variable
Compare the 2 and if not equal download the version locates in newver.

The only thing I can see with this is obviously we get the last version rather than the current version.
For example 27.0.0.183 is now top of Release and latest is 27.0.0.187

So, taking your example I tried using lynx -dump on https://get.adobe.com/flashplayer/about/
This produces output that contains the relevant line about Linux Firefox-NPAPI
Using awk I guess that print $3 should provide the info we need to get the latest version number.

I've tried a bit of simple substitution but here I get lost. I don't know how to check if awk is actually finding what we want.
My guess is that one would need to output that line to a file as the Adobe About page is totally dynamic and so doesn't provide an html file to work from.

Does that make any kind of sense?

Offline

#8 2017-11-15 09:26

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,993

Re: A small challenge to create a working Flash installer/updater

bin wrote:

Thanks for that Dai.
Stepping through the file you:-
Check libflashplayer.so for its version and set that as instver

Yes

bin wrote:

Use lynx to dump the contents of the Adobe Archived page

Yes, but have now realised I am using the archived page and not getting the current release (slaps own fore head!)

bin wrote:

Locate the top of the Release list and set that version as the newver variable

Actually it's the bottom of the file after sorting it smile

bin wrote:

Compare the 2 and if not equal download the version locates in newver.

Yes, but only downloads if the $newver is higher

bin wrote:

The only thing I can see with this is obviously we get the last version rather than the current version.
For example 27.0.0.183 is now top of Release and latest is 27.0.0.187

Refer to earlier forehead slap and apply again! big_smile

bin wrote:

So, taking your example I tried using lynx -dump on https://get.adobe.com/flashplayer/about/
This produces output that contains the relevant line about Linux Firefox-NPAPI
Using awk I guess that print $3 should provide the info we need to get the latest version number.

I've tried a bit of simple substitution but here I get lost. I don't know how to check if awk is actually finding what we want.
My guess is that one would need to output that line to a file as the Adobe About page is totally dynamic and so doesn't provide an html file to work from.

Does that make any kind of sense?

I have modified the code and attach here an update, I can now stop slapping my forehead! smile I can give you a breakdown of all the commands and what they are doing if you want to learn a little more of bash scripting, although it might become more obvious what they do as you compare the two files.


Attachments:
autoflash3, Size: 804 B, Downloads: 1,182

Offline

#9 2017-11-15 10:13

bin
Member
From: U.K.
Registered: 2016-01-28
Posts: 1,337

Re: A small challenge to create a working Flash installer/updater

Aha! That does the trick.....

The only change I found I needed is based on the installation instructions that come with the download:-
Installation instructions
-------------------------

Installing using the plugin tar.gz:
    o Unpack the plugin tar.gz and copy the files to the appropriate location. 
    o Save the plugin tar.gz locally and note the location the file was saved to.
    o Launch terminal and change directories to the location the file was saved to.
    o Unpack the tar.gz file.  Once unpacked you will see the following:
        + libflashplayer.so
        + /usr
    o Identify the location of the browser plugins directory, based on your Linux distribution and Firefox version
    o Copy libflashplayer.so to the appropriate browser plugins directory.  At the prompt type:
        + cp libflashlayer.so <BrowserPluginsLocation>
    o Copy the Flash Player Local Settings configurations files to the /usr directory.  At the prompt type:
        + sudo cp -r usr/* /usr

Now, with nothing installed anywhere I just put libflashplayer.so into .mozilla/plugins as it doesn't appear in the /usr folder which is in the download.
The Mozilla installation does create /usr/lib/mozilla/plugins which is probably the more correct method so it may be worth modifying the path in the first line. I think a lot depends on whether one has a previous .deb based installation or not - I don't so, I don't know for sure where it puts it - if that makes sense.

I'll give it a go with /usr/lib/mozilla/plugins as a location for the new file and adjust the copy command accordingly - then I'll play using the existing version just to make sure.

Great work Dai - many thanks!!

Offline

#10 2017-11-15 11:08

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,993

Re: A small challenge to create a working Flash installer/updater

You are welcome smile

When I started this I didn't have flash installed so I installed flashplayer-mozilla and it gave an output line of

update-alternatives: using /usr/lib/flashplayer-mozilla/libflashplayer.so to provide /usr/lib/mozilla/plugins/flash-mozilla.so (flash-mozilla.so) in auto mode

So I used that as the base of my testing as /usr/lib/flashplayer-mozilla/libflashplayer.so was the "base file" and I would imagine it would be used globally.
But I am using Scorpion and Orion might still be using flashplugin-nonfree which could be using a slightly different file structure, but you could easily adjust the code to fit. Enjoy smile

Offline

#11 2017-11-16 09:21

bin
Member
From: U.K.
Registered: 2016-01-28
Posts: 1,337

Re: A small challenge to create a working Flash installer/updater

Tweaked to match my file setup and it works which is great.
Next step will be into cron.daily and here's the icing on the cake puzzle - how to create an informative log file in var/log?
I can make it create a file with the date in but that's about it - and not a lot of use.
I have looked at how other cron jobs create logs and it's double dutch I'm afraid.
Presumably there needs to be a way to test if an update was needed and report either not needed or successful????
It is frustrating as I know the steps I want to take but have always struggled trying to create working scripts - getting too old to learn new tricks smile

Offline

#12 2017-11-16 09:39

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,993

Re: A small challenge to create a working Flash installer/updater

The easiest way to create a log entry from your script would be to use the command logger you can test this in a terminal by typing

 sudo tail -f /var/log/syslog

this will read new entries to your syslog in real-time, and then open another terminal (or split the terminal if using terminator like me smile ) and in the new terminal type

logger "A message from me"

You will then see the message appear in your syslog file.

Nov 16 08:33:40 scorpion dai:  A message from me

You can then press Ctrl-c in the first terminal to stop "tailing" the log file.

It is easier to use the syslog file instead of a separate log file because it is already set up to backup rotate and eventually remove old logs so you don't need to worry too much about any of that stuff and you will always know where to look. There are solutions for using your own log-files i.e. you can simply direct output to a file

echo "Your Flash is up to date ($instver)" >>/path/to/your/logfile.log

but remember to use ">>" to direct the file, if you use ">" it will overwrite the file with each entry, resulting in only the latest entry ever kept in the logfile.

HTH

Last edited by Dai_trying (2017-11-16 09:40)

Offline

#13 2017-11-16 18:22

bin
Member
From: U.K.
Registered: 2016-01-28
Posts: 1,337

Re: A small challenge to create a working Flash installer/updater

Thanks very much Dai - I'll work through that and see what happens.

Offline

#14 2017-12-23 08:12

bin
Member
From: U.K.
Registered: 2016-01-28
Posts: 1,337

Re: A small challenge to create a working Flash installer/updater

Just thought I'd update this after a couple of tweaks due to different versions of Moz products putting stuff in different places - and the fact I use Palemoon mostly. So, having libflashplayer.so in my /home/.mozilla makes more sense.

Works fine - already done one update a week or so back.


#!/bin/bash

flash_file="/home/yourusername/.mozilla/plugins/libflashplayer.so"
instver=$(strings "$flash_file" | grep "LNX" | awk '{print $2}')
instver=${instver//,/.}

newver=`lynx -dump https://get.adobe.com/flashplayer/about/ | grep Linux | awk '{print $

if [[ "$instver" == "$newver" ]]; then
    echo "Flash is the latest version"
    exit 0
elif [[ "$instver" < "$newver" ]]; then
    echo "Instver needs updating"
else
    echo "Sorry I cannot determine versions correctly"
    exit 0
fi

cd /tmp
wget https://fpdownload.adobe.com/get/flashp … pi_linux.x
sleep 2
tar -zxvf /tmp/flash_player_npapi_linux.x86_64.tar.gz libflashplayer.so
mv libflashplayer.so /home/yourusername/.mozilla/plugins/libflashplayer.so
rm flash_player_npapi_linux.x86_64.tar.gz

The mv command didn't need tdesuo as it is running in cron.daily so it gets root permissions.

Once again - thanks Dai - this is just so much better than waiting for debs to be updated!!

Last edited by bin (2017-12-24 07:22)


Attachments:
autoflash4, Size: 928 B, Downloads: 1,190

Offline

#15 2017-12-23 08:35

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,993

Re: A small challenge to create a working Flash installer/updater

Thanks bin, and nice work, a little collaboration can go a long way smile

Offline

Board footer

Powered by FluxBB