Siduction Forum

Siduction Forum => Ideas & Improvements => Topic started by: michaa7 on 2014/02/07, 01:36:45

Title: new flash update script (cronjob)
Post by: michaa7 on 2014/02/07, 01:36:45
Thanks absolut for the initial idea and pointing out how to enhance the script.
Thanks to the guys on debianforum.de for helping me with this script.

This script is a replacement for absolut's above mentioned cronjob script to automaticaly check and install "flashplugin-nonfree" whenever a new version is available. As seen repeatedly in the past, a due update may fail, for example in consequence of a not updated checksum on the server.
People using this new script will now get an email (to root!) *if* a new version is available but install did fail. You should then look deeper into it and see whether it is appropriate to file a bug report.
You need to copy it to  /etc/cron.daily/<give it a name> and to make it executable (chmod +x /etc/cron.daily/<name given>).

Quote
#!/bin/sh


# de
##########################################################################################################
# testen ob update-flashplugin-nonfree verfügbar/ausführbar ist
# updater ausführen;
# anschließend den status überprüfen und die entsprechenden zeilen mit grep ausfiltern
# Versionsnummer der installierten und entfernt verfügbare Version einlesen und vergleichen
# Wenn gleich nichts tun, wenn verschieden dann Mail an root.
# (Sinnvollerweise wäre konfiguriert dass root Mails generell an einen echten User weitergeleitet werden)
##########################################################################################################


# en
##########################################################################################################
# test whether update-flashplugin-nonfree is available / executable
# execute updater
# test installation status and grep installed and newest available version
# read installed and remotly available version. If equal do nothing, if different send mail to root
# (you should have configured to forward mails to root to a real user)
##########################################################################################################

test -x /usr/sbin/update-flashplugin-nonfree \
&& /usr/sbin/update-flashplugin-nonfree --install --quiet \
&& update-flashplugin-nonfree --status | grep -o ": [[:digit:]]*.[[:digit:]]*.[[:digit:]]*.[[:digit:]]*"\
| {
   read installed
   read available

   if [ "x$installed" = "x$available" ] ; then

:

else

mail -s "flashupdate fehlgeschlagen / failed" root <<EOM
Hallo Admin,
Das flashupdate ist fehlgeschlagen.
Mit freundlichem Gruss
updatescript
 
Hello admin,
updating flash failed
Bye
updatescript
EOM
 

  fi
}



I am sure this script could be done better. If you enhance it, post it here.



 
Title: Re: new flash update script (cronjob)
Post by: michaa7 on 2015/01/14, 15:24:25
I think a howto-d/l-and-install-flashplugin-nonfree-manually may come handy in the mail you get. So I added it to the script.

Quote
#!/bin/sh


# de
##########################################################################################################
# testen ob update-flashplugin-nonfree verfügbar/ausführbar ist
# updater ausführen;
# anschließend den status überprüfen und die entsprechenden zeilen mit grep ausfiltern
# Versionsnummer der installierten und entfernt verfügbare Version einlesen und vergleichen
# Wenn gleich nichts tun, wenn verschieden dann Mail an root.
# (Sinnvollerweise wäre konfiguriert dass root Mails generell an einen echten User weitergeleitet werden)
##########################################################################################################


# en
##########################################################################################################
# test whether update-flashplugin-nonfree is available / executable
# execute updater
# test installation status and grep installed and newest available version
# read installed and remotly available version. If equal do nothing, if different send mail to root
# (you should have configured to forward mails to root to a real user)
##########################################################################################################

test -x /usr/sbin/update-flashplugin-nonfree \
&& /usr/sbin/update-flashplugin-nonfree --install --quiet \
&& update-flashplugin-nonfree --status | grep -o ": [[:digit:]]*.[[:digit:]]*.[[:digit:]]*.[[:digit:]]*"\
| {
   read installed
   read available

   if [ "x$installed" = "x$available" ] ; then

:

else

mail -s "flashupdate fehlgeschlagen / failed" root <<EOM
Hallo Admin,
Das flashupdate ist fehlgeschlagen.
Manuelles update siehe unten.
Mit freundlichem Gruss
updatescript
 
Hello admin,
updating flash failed
Howto update manually see below.
Bye
updatescript


#****************************************************************************************
#
# manuales update / manual update:
# Gehe zu / go to: http://get.adobe.com/de/flashplayer/
#
# dl tar file (32 or 64 bit in abhängikeit bon deinem system)
#
# dann / then:
#
## 32 bit
# tar -xf install_flash_player_11_linux.i386.tar.gz
# chown root:root libflashplayer.so
# chown -R root:root usr     # no "/" in front of usr
# chown root:root readme.txt    # you won't copy it, so I mention it just for completeness
# cp -r usr/* /usr
# cp libflashplayer.so /usr/lib/flashplugin-nonfree/
#
## 64 bit
# tar -xf install_flash_player_11_linux.x86_64.tar.gz
# chown root:root libflashplayer.so
# chown -R root:root usr     # no "/" in front of usr
# chown root:root readme.txt    # you won't copy it, so I mention it just for completeness
# cp -r usr/* /usr
# cp libflashplayer.so /usr/lib/flashplugin-nonfree/
#
#****************************************************************************************
EOM
 

  fi
}


Copy it to
/etc/cron.daily/<give it a name>
and make it executable:
chmod +x /etc/cron.daily/<name given>
Title: Re: new flash update script (cronjob)
Post by: Lanzi on 2015/01/16, 22:03:55
Thanks, I will install it!
Danke. Werde es installieren!
Title: Re: new flash update script (cronjob)
Post by: Lanzi on 2015/06/29, 16:45:27
Hi Michaa7:

Was muss ich zufügen, um auch Pepperflash zu updaten?
Title: Re: new flash update script (cronjob)
Post by: michaa7 on 2015/09/13, 12:05:19
Das ist nicht machbar, weil das nicht so einfach irgendwo heruntergeladen werden kann:

https://wiki.debian.org/PepperFlashPlayer

Man kann das sicher auch irgendwie scripten, aber ich kenne mich da zu wenig aus.
Title: Re: new flash update script (cronjob)
Post by: Lanzi on 2015/09/13, 20:38:00
hm, schade.
Ich bin da sowas von Laie was das scripten angeht. Hatte die Hoffnung, dass man den apt Befehl integrieren könnte.

update-pepperflashplugin-nonfree --install --unverified


Danke für Deine Zeit und die Antwort!
Title: Re: new flash update script (cronjob)
Post by: michaa7 on 2015/09/13, 22:10:50
Ich habe das script ja auch mit hilfe von anderen zusammengeschustert, bin also was scripte angeht totaler anfänger.
Kennst du eine möglichkeit die neueste version abzufragen?

Wenn überhaupt dann sollte man ein zweites script für pepper zusammenbauen. Ich habe pepper nicht installiert, aber du kannst ja einfach bei dir nachschauen ob der pepper plugin updater die gleichen oder ähnliche kommandos bereithält. Dann könntest du das script mit jedem texteditor selber umarbeiten.
Title: Re: new flash update script (cronjob)
Post by: musca on 2015/09/14, 21:44:06
Hallo,

den Flashplayer benutze ich zwar nicht, kann aber einen Code-Schnipsel für den Download beitragen:
(Das Script testet, ob entweder curl oder wget vorhanden bzw. ausführbar ist):
Code: [Select]
if [[ -x /usr/bin/curl ]] ; then
  printf "downloading "; curl -sS https://www.adobe.com/products/flashplayer/distribution3.html | grep -o 'Flash.*(Linux)'
  curl -So install_flash_player_11_linux.x86_64.tar.gz https://fpdownload.macromedia.com/get/flashplayer/current/licensing/linux/install_flash_player_11_linux.x86_64.tar.gz
elif  [[ -x /usr/bin/wget ]] ; then
  printf "downloading "; wget -qO- https://www.adobe.com/products/flashplayer/distribution3.html | grep -o 'Flash.*(Linux)'
  wget -Nc https://fpdownload.macromedia.com/get/flashplayer/current/licensing/linux/install_flash_player_11_linux.x86_64.tar.gz
else
  printf "Weder curl noch wget sind installiert: Kein Download.\n"
fi

Mit dem grep wird die aktuell verfügbare Version angezeigt.
Hmm, man könnte die Versionsnummer zum Dateinamen hinzufügen ... future extension.

Grüße
musca
Title: Re: new flash update script (cronjob)
Post by: michaa7 on 2015/09/14, 22:07:35
soweit es um Lanzis anliegen geht codeschnippselst du ca. um 100% bis 200% am gesuchten vorbei.

 ;)


aber falls es als erweiterung für mein script gedacht war, dann danke.
Title: Re: new flash update script (cronjob)
Post by: musca on 2015/09/14, 22:45:22
sorry lanzi, das bezieht sich auf michaa7's Script.
Bitte noch diese Variablen vor das erste Codefragment setzen:

Code: [Select]
kernel="$(uname -r)";
arch=${kernel##*-}
if [[ $arch == i386 ]] ; then
  filename="i386"
elif [[ $arch == amd64 ]] ; then
  filename="x86_64"
fi

Nun sind wir architekturunabhängig und können  im ersten Codefragment  überall  x86_64 durch ${filename} ersetzen.
Der Dateiname lautet dannn z.B.
"install_flash_player_11_linux.${filename}.tar.gz"

hmm, die Versionsnummer bleibt noch zu ergänzen.

Grüße
musca
Title: Re: new flash update script (cronjob)
Post by: jure on 2017/06/15, 16:32:58
Hallo (michaa7),

mal abgesehen davon, dass das update zur Zeit kaum funktioniert (manuell schon), hab ich mal ne Frage zum script.

Bei mir bekomme ich immer eine Fehler Meldung
Code: [Select]
/etc/cron.daily# ./flash
./flash: 83: ./flash: Syntax error: end of file unexpected (expecting "fi")

und als Nichtscripter komme ich dahinter, wie das beheben kann....an Ende steht doch fi  ???
Title: Re: new flash update script (cronjob)
Post by: Geier0815 on 2017/06/15, 21:55:02
Da scheint dir beim Kopieren etwas abhanden gekommen zu sein. Ich hab die Datei gerade mal runter geladen und bei mir läuft es (wenn auch mit Fehler wegen wget)
Title: Re: new flash update script (cronjob)
Post by: jure on 2017/06/15, 22:23:35
ja das hatte ich auch gedacht, aber ich sehe da nix was fehlt.

so sah die nicht funktionierende Version aus - auf der Konsole mit vi erstellt
Code: [Select]
cat  /etc/cron.daily/flash
#!/bin/sh


# de
##########################################################################################################
# testen ob update-flashplugin-nonfree verfügbar/ausführbar ist
# updater ausführen;
# anschließend den status überprüfen und die entsprechenden zeilen mit grep ausfiltern
# Versionsnummer der installierten und entfernt verfügbare Version einlesen und vergleichen
# Wenn gleich nichts tun, wenn verschieden dann Mail an root.
# (Sinnvollerweise wäre konfiguriert dass root Mails generell an einen echten User weitergeleitet werden)
##########################################################################################################


# en
##########################################################################################################
# test whether update-flashplugin-nonfree is available / executable
# execute updater
# test installation status and grep installed and newest available version
# read installed and remotly available version. If equal do nothing, if different send mail to root
# (you should have configured to forward mails to root to a real user)
##########################################################################################################

test -x /usr/sbin/update-flashplugin-nonfree \
        && /usr/sbin/update-flashplugin-nonfree --install --quiet \
        && update-flashplugin-nonfree --status | grep -o ": [[:digit:]]*.[[:digit:]]*.[[:digit:]]*.[[:digit:]]*"\
        | {
   read installed
      read available

         if [ "x$installed" = "x$available" ] ; then

                 :

         else

                 mail -s "flashupdate fehlgeschlagen / failed" root <<EOM
                 Hallo Admin,
                 Das flashupdate ist fehlgeschlagen.
                 Manuelles update siehe unten.
                 Mit freundlichem Gruss
                 updatescript
                 
                 Hello admin,
                 updating flash failed
                 Howto update manually see below.
                 Bye
                 updatescript


                 #****************************************************************************************
                 #
                 # manuales update / manual update:
                 # Gehe zu / go to: http://get.adobe.com/de/flashplayer/
                 #
                 # dl tar file (32 or 64 bit in abhängikeit bon deinem system)
                 #
                 # dann / then:
                 #
                 ## 32 bit
                 # tar -xf install_flash_player_11_linux.i386.tar.gz
                 # chown root:root libflashplayer.so
                 # chown -R root:root usr     # no "/" in front of usr
                 # chown root:root readme.txt    # you won't copy it, so I mention it just for completeness
                 # cp -r usr/* /usr
                 # cp libflashplayer.so /usr/lib/flashplugin-nonfree/
                 #
                 ## 64 bit
                 # tar -xf install_flash_player_11_linux.x86_64.tar.gz
                 # chown root:root libflashplayer.so
                 # chown -R root:root usr     # no "/" in front of usr
                 # chown root:root readme.txt    # you won't copy it, so I mention it just for completeness
                 # cp -r usr/* /usr
                 # cp libflashplayer.so /usr/lib/flashplugin-nonfree/
                 #
                 #****************************************************************************************
                 EOM
                 

              fi


           }
           

so funktioniert es, es gibt keinen Fehler mehr -  mit Texteditor (kwrite) neu erstellt  :-\
Code: [Select]
cat  /etc/cron.daily/flash
#!/bin/sh


# de
##########################################################################################################
# testen ob update-flashplugin-nonfree verfügbar/ausführbar ist
# updater ausführen;
# anschließend den status überprüfen und die entsprechenden zeilen mit grep ausfiltern
# Versionsnummer der installierten und entfernt verfügbare Version einlesen und vergleichen
# Wenn gleich nichts tun, wenn verschieden dann Mail an root.
# (Sinnvollerweise wäre konfiguriert dass root Mails generell an einen echten User weitergeleitet werden)
##########################################################################################################


# en
##########################################################################################################
# test whether update-flashplugin-nonfree is available / executable
# execute updater
# test installation status and grep installed and newest available version
# read installed and remotly available version. If equal do nothing, if different send mail to root
# (you should have configured to forward mails to root to a real user)
##########################################################################################################

test -x /usr/sbin/update-flashplugin-nonfree \
&& /usr/sbin/update-flashplugin-nonfree --install --quiet \
&& update-flashplugin-nonfree --status | grep -o ": [[:digit:]]*.[[:digit:]]*.[[:digit:]]*.[[:digit:]]*"\
| {
   read installed
   read available

   if [ "x$installed" = "x$available" ] ; then

:

else

mail -s "flashupdate fehlgeschlagen / failed" root <<EOM
Hallo Admin,
Das flashupdate ist fehlgeschlagen.
Manuelles update siehe unten.
Mit freundlichem Gruss
updatescript
 
Hello admin,
updating flash failed
Howto update manually see below.
Bye
updatescript


#****************************************************************************************
#
# manuales update / manual update:
# Gehe zu / go to: http://get.adobe.com/de/flashplayer/
#
# dl tar file (32 or 64 bit in abhängikeit bon deinem system)
#
# dann / then:
#
## 32 bit
# tar -xf install_flash_player_11_linux.i386.tar.gz
# chown root:root libflashplayer.so
# chown -R root:root usr     # no "/" in front of usr
# chown root:root readme.txt    # you won't copy it, so I mention it just for completeness
# cp -r usr/* /usr
# cp libflashplayer.so /usr/lib/flashplugin-nonfree/
#
## 64 bit
# tar -xf install_flash_player_11_linux.x86_64.tar.gz
# chown root:root libflashplayer.so
# chown -R root:root usr     # no "/" in front of usr
# chown root:root readme.txt    # you won't copy it, so I mention it just for completeness
# cp -r usr/* /usr
# cp libflashplayer.so /usr/lib/flashplugin-nonfree/
#
#****************************************************************************************
EOM
 

  fi
}
Title: Re: new flash update script (cronjob)
Post by: Geier0815 on 2017/06/16, 12:46:14
Hast Du auf die Beiden mal ein diff laufen lassen? So beim groben überfliegen sehe ich nämlich keinen Unterschied bis auf die Formatierung. Evtl. sind ja irgendwelche nicht druckbaren Zeichen mit rein geraten.
Title: Re: new flash update script (cronjob)
Post by: dacorsa on 2017/10/16, 12:03:06
thanks!
Title: Re: new flash update script (cronjob)
Post by: dacorsa on 2018/01/02, 20:49:58
If you want to update to the last adobe flash plugin BETA, you can use this script:

cd /tmp
wget https://fpdownload.macromedia.com/pub/labs/flashruntimes/flashplayer/linux64/flash_player_ppapi_linux.x86_64.tar.gz
tar -zxvf flash_player_ppapi_linux.x86_64.tar.gz
cp ./libpepflashplayer.so /usr/lib/flashplugin-nonfree/
mv ./libpepflashplayer.so /usr/lib/pepperflashplugin-nonfree/
# update-pepperflashplugin-nonfree --install
# update-pepperflashplugin-nonfree --status
wget https://fpdownload.macromedia.com/pub/labs/flashruntimes/flashplayer/linux64/flash_player_npapi_linux.x86_64.tar.gz
tar -zxvf flash_player_npapi_linux.x86_64.tar.gz
mv ./libflashplayer.so /usr/lib/firefox/browser/plugins/