Package: flashplugin-nonfree Followup-For: Bug #851066 please use the attached script, it gets and parses vesion directly without sha or checksums
#!/bin/sh
# Copyright (C) 2006-2014 Bart Martens <ba...@knars.be> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. set -e return_0() { return 0 } trap "return_0" 0 die_hard() { echo "ERROR: $1" >&2 echo "More information might be available at:" >&2 echo " http://wiki.debian.org/FlashPlayer" >&2 exit 1 } [ `whoami` = "root" ] || die_hard "must be root" show_usage() { echo "Usage:" echo " update-flashplugin-nonfree --install" echo " update-flashplugin-nonfree --uninstall" echo " update-flashplugin-nonfree --status" echo "Additional options:" echo " --verbose" echo " --quiet" exit 1 } getopt_temp=`getopt -o iusfvqn --long install,uninstall,status,fast,verbose,quiet -n 'update-flashplugin-nonfree' -- "$@"` || show_usage eval set -- "$getopt_temp" || show_usage ACTION=none fast=no verbose=no quiet=no GREP_OPTIONS= if [ -e /proc/cpuinfo ] then hassse2=yes grep -q "^flags.*: .* sse2 " /proc/cpuinfo || grep -q "^flags.*: .* sse2$" /proc/cpuinfo || hassse2=no else hassse2=unknown fi while [ true ] do case "$1" in -i|--install) ACTION="--install" shift ;; -u|--uninstall) ACTION="--uninstall" shift ;; -s|--status) ACTION="--status" shift ;; -f|--fast) fast=yes shift ;; -v|--verbose) verbose=yes shift ;; -q|--quiet) quiet=yes shift ;; --) shift break ;; *) echo "Internal error!" >&2 exit 1 ;; esac done [ "$ACTION" != "none" -a $# -eq 0 ] || show_usage [ "$quiet" != "yes" ] || verbose=no [ "$verbose" != "yes" ] || echo "options : $getopt_temp" UNPACKDIR=`mktemp -d /tmp/flashplugin-nonfree.XXXXXXXXXX` || die_hard "mktemp failed" echo "$UNPACKDIR" | grep -q "^/tmp/flashplugin-nonfree\." || die_hard "paranoia" cd "$UNPACKDIR" || die_hard "cd failed" [ "$verbose" != "yes" ] || echo "temporary directory: $UNPACKDIR" do_cleanup() { [ "$verbose" != "yes" ] || echo "cleaning up temporary directory $UNPACKDIR ..." cd / echo "$UNPACKDIR" | grep -q "^/tmp/flashplugin-nonfree\." || die_hard "paranoia" rm -rf "$UNPACKDIR" } die_hard_with_a_cleanup() { return_0 do_cleanup die_hard "$1" } trap "die_hard_with_a_cleanup interrupted" INT fix_missing_symlink() { LANG=C update-alternatives --display flash-mozilla.so > /dev/null 2>&1 \ || return 0 LANG=C update-alternatives --display flash-mozilla.so \ | grep -q "link currently absent" \ || return 0 [ "$verbose" != "yes" ] || echo "link currently absent, trying to fix" update-alternatives --auto flash-mozilla.so > /dev/null 2>&1 || true } warning_about_alternatives() { letswarn="no" LANG=C update-alternatives --display flash-mozilla.so \ | grep "link currently points to /usr/lib/flashplugin-nonfree/libflashplayer.so" \ > /dev/null 2>&1 || \ cat <<-EOF How to use predefined priorities to automatically select one implementation of "flash" between the multiple installed alternatives : update-alternatives --auto flash-mozilla.so How to manually select one implementation of "flash" between the multiple installed alternatives : update-alternatives --config flash-mozilla.so EOF } cachedir=/var/cache/flashplugin-nonfree wgetquiet=' -nv -q ' wgetfast='-t 3 -T 15 ' wgetalways=' -nd -P . ' wgetprogress=' -v --progress=dot:default ' [ "$verbose" != "yes" ] || echo "importing public key ..." gpg -q --homedir "." --import /usr/lib/flashplugin-nonfree/pubkey.asc > /dev/null 2>&1 \ || die_hard_with_a_cleanup "gpg failed to import /usr/lib/flashplugin-nonfree/pubkey.asc" get_installed_version() { installed=`strings /usr/lib/flashplugin-nonfree/libflashplayer.so 2> /dev/null | grep LNX | cut -d ' ' -f 2 | sed -e "s/,/./g"` } get_upstream_version() { arch_wget=i686 [ `dpkg --print-architecture` != "amd64" ] || arch_wget=x86_64 url="https://get.adobe.com/flashplayer/" upstream=`wget --no-check-certificate \ --tries=1 --timeout=15 \ --user-agent="Mozilla/5.0 (X11; U; Linux $arch_wget; en-us)" \ -nv -qO - $url | perl -n -e'/<strong>Version\s+(\d+\.\d+\.\d+\.\d+)<\/strong>/ && print $1'` } remove_extrafiles() { [ -e /var/lib/flashplugin-nonfree/extrafiles.md5sums ] || touch /var/lib/flashplugin-nonfree/extrafiles.md5sums while read line do sourcefile=`echo $line|cut -d ' ' -f 2` targetfile="/$sourcefile" if [ ! -f $targetfile ] then echo "not found: $targetfile" >&2 else cd / calculated=`md5sum $sourcefile` cd - > /dev/null if [ "$line" != "$calculated" ] then echo "not removing modified $targetfile" >&2 else [ "$verbose" != "yes" ] || echo "removing $targetfile" rm -f $targetfile fi fi done < /var/lib/flashplugin-nonfree/extrafiles.md5sums rm -f /var/lib/flashplugin-nonfree/extrafiles.md5sums } case "$ACTION" in --install) [ "$verbose" != "yes" ] || echo "selected action = $ACTION" get_installed_version [ "$verbose" != "yes" ] || echo "installed version = $installed" get_upstream_version [ "$verbose" != "yes" ] || echo "upstream version = $upstream" if [ "$installed" != "" -a "$upstream" != "" -a "$installed" = "$upstream" ] then [ "$verbose" != "yes" ] || echo "upstream version $upstream is already installed" elif [ "$hassse2" = "no" ] then echo "Version $upstream needs sse2 and this system doesn't have that." >&2 else wgetoptions="$wgetquiet $wgetalways" [ "$verbose" != "yes" ] || wgetoptions="$wgetalways $wgetprogress" [ "$fast" != "yes" ] || wgetoptions="$wgetoptions $wgetfast" [ "$verbose" != "yes" ] || echo "wgetoptions=$wgetoptions" # original script use i686 for arch != amd64 adobe use i386 [ "$arch_wget" != "i686" ] || arch_wget=i386 downloaddir=$upstream downloadfile=flash_player_npapi_linux.$arch_wget.tar.gz downloadurl=https://fpdownload.adobe.com/get/flashplayer/pdc/$downloaddir/$downloadfile wgetoptions="$wgetalways $wgetprogress" [ "$quiet" != "yes" ] || wgetoptions="$wgetquiet $wgetalways" [ "$fast" != "yes" ] || wgetoptions="$wgetoptions $wgetfast" wgetoptions="$wgetoptions -O $UNPACKDIR/$downloadfile" # to change wget's message "Saving to: ..." [ "$verbose" != "yes" ] || echo "wgetoptions=$wgetoptions" [ "$verbose" != "yes" ] || [ ! -f $downloadfile ] || echo "downloading $downloadurl ..." [ -f $downloadfile ] || \ HOME=/root \ wget $wgetoptions $downloadurl \ || die_hard_with_a_cleanup "wget failed to download $downloadurl" [ "$verbose" != "yes" ] || echo "unpacking $downloadfile ..." tar xozf $downloadfile targetdir=/usr/lib/flashplugin-nonfree [ "$verbose" != "yes" ] || echo "moving $UNPACKDIR/libflashplayer.so to $targetdir ..." rm -f $targetdir/flashplayer.xpt mv -f $UNPACKDIR/libflashplayer.so $targetdir [ "$verbose" != "yes" ] || echo "setting permissions and ownership of $targetdir/libflashplayer.so ..." chown root:root $targetdir/libflashplayer.so chmod 644 $targetdir/libflashplayer.so [ "$verbose" != "yes" ] || ( get_installed_version && echo "Flash Player version: $installed" ) [ "$verbose" != "yes" ] || echo "moving $downloadfile to $cachedir ..." mv -f $downloadfile $cachedir fix_missing_symlink || true [ "$verbose" != "yes" ] || \ update-alternatives --display flash-mozilla.so || true [ "$verbose" != "yes" ] || echo "calling update-alternatives ..." update-alternatives --quiet --install \ /usr/lib/mozilla/plugins/flash-mozilla.so flash-mozilla.so \ /usr/lib/flashplugin-nonfree/libflashplayer.so 50 \ || die_hard_with_a_cleanup "update-alternatives failed to install flash-mozilla.so" [ "$verbose" != "yes" ] || \ update-alternatives --display flash-mozilla.so || true [ "$quiet" != "no" ] || \ warning_about_alternatives remove_extrafiles for sourcefile in \ usr/bin/flash-player-properties \ usr/share/applications/flash-player-properties.desktop \ usr/share/icons/hicolor/16x16/apps/flash-player-properties.png \ usr/share/icons/hicolor/22x22/apps/flash-player-properties.png \ usr/share/icons/hicolor/24x24/apps/flash-player-properties.png \ usr/share/icons/hicolor/32x32/apps/flash-player-properties.png \ usr/share/icons/hicolor/48x48/apps/flash-player-properties.png \ usr/share/pixmaps/flash-player-properties.png \ ; do if [ ! -e $sourcefile ] then echo "not found in tarball: $sourcefile" >&2 else targetfile="/$sourcefile" if [ -e $targetfile ] then echo "already exists: $targetfile" >&2 else [ "$verbose" != "yes" ] || echo "installing $targetfile" md5sum $sourcefile >> /var/lib/flashplugin-nonfree/extrafiles.md5sums cp $sourcefile $targetfile chown root:root $targetfile chmod g-w $targetfile fi fi done fi # end if installed != upstream [ "$verbose" != "yes" ] || echo "end of action $ACTION" ;; --uninstall) [ "$verbose" != "yes" ] || echo "selected action = $ACTION" fix_missing_symlink || true [ "$verbose" != "yes" ] || echo "calling update-alternatives ..." update-alternatives --quiet --remove flash-mozilla.so \ /usr/lib/flashplugin-nonfree/libflashplayer.so || true [ "$verbose" != "yes" ] || echo "removing files ..." rm -f /usr/lib/flashplugin-nonfree/flashplayer.xpt rm -f /usr/lib/flashplugin-nonfree/libflashplayer.so remove_extrafiles [ "$verbose" != "yes" ] || echo "end of action $ACTION" ;; --status) [ "$verbose" != "yes" ] || echo "selected action = $ACTION" get_installed_version echo "Flash Player version installed on this system : $installed" get_upstream_version echo "Flash Player version available on upstream site: $upstream" LANG=C update-alternatives --display flash-mozilla.so || true [ "$verbose" != "yes" ] || echo "end of action $ACTION" ;; *) do_cleanup show_usage ;; esac do_cleanup [ "$verbose" != "yes" ] || echo "end of update-flashplugin-nonfree"