Hello

I have created a patch while implement this (see attachment).

This should also fix that it break 
(https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839543), every time Google 
change something regarding the Chrome apt repository.


- Kristian Klausen


________________________________
Fra: Bart Martens <ba...@debian.org>
Sendt: 8. august 2016 18:48
Til: James C; 833...@bugs.debian.org
Emne: Bug#833741: pepperflashplugin-nonfree: Feature request?: Download from 
Adobe instead of Google.

On Mon, Aug 08, 2016 at 11:11:57PM +1200, James C wrote:
> Package: pepperflashplugin-nonfree
> Version: 1.8.1
> Severity: wishlist
>
> Dear Maintainer,
>
> Apparently Adobe now has Pepper Flash available for download from their site.
> This is just Pepper Flash, not the whole Chrome browser.
> Also, an update to the 32-bit version seems to be available.
> See:
> http://forum.mepiscommunity.org/viewtopic.php?t=40254

Indeed.

>
> (This was mentioned in the discussion for #831058,
> but I think it deserves a new bug report.)

I agree, thanks.

>
> I'm not sure if this counts as a bug, so I've marked it wishlist,

Perfect.

> but if it was possible to switch to downloading from the Adobe site,
> it would speed up the download, and make the 32-bit version available again.

Yes, I'm considering that.

Regards,

Bart Martens

--- a/update-pepperflashplugin-nonfree	2016-10-02 16:05:04.678209065 +0200
+++ b/update-pepperflashplugin-nonfree	2016-10-02 16:48:31.644832357 +0200
@@ -30,7 +30,7 @@
 	exit 1
 }
 
-[ `id -u` = "0" ] || die_hard "must be root"
+[ "$(id -u)" = "0" ] || die_hard "must be root"
 
 show_usage() {
 	echo "Usage:"
@@ -43,18 +43,15 @@
 	exit 1
 }
 
-getopt_temp=`getopt -o iusfvq --long install,uninstall,status,fast,verbose,quiet,beta,unstable,unverified \
-	-n 'update-pepperflashplugin-nonfree' -- "$@"` || show_usage
+getopt_temp="$(getopt -o iusfvq --long install,uninstall,status,verbose,quiet \
+	-n 'update-pepperflashplugin-nonfree' -- "$@")" || show_usage
 eval set -- "$getopt_temp" || show_usage
 
 ACTION=none
-fast=no
 verbose=no
 quiet=no
-variant=stable
-verified=yes
 
-while [ true ]
+while true
 do
 	case "$1" in
 		-i|--install)
@@ -69,10 +66,6 @@
 			ACTION="--status"
 			shift
 			;;
-		-f|--fast)
-			fast=yes
-			shift
-			;;
 		-v|--verbose)
 			verbose=yes
 			shift
@@ -81,18 +74,6 @@
 			quiet=yes
 			shift
 			;;
-		--beta)
-			variant=beta
-			shift
-			;;
-		--unstable)
-			variant=unstable
-			shift
-			;;
-		--unverified)
-			verified=no
-			shift
-			;;
 		--)
 			shift
 			break
@@ -104,111 +85,31 @@
 	esac
 done
 
-[ "$ACTION" != "none" -a $# -eq 0 ] || show_usage
+([ "$ACTION" != "none" ] && [ $# -eq 0 ]) || show_usage
 [ "$quiet" != "yes" ] || verbose=no
 
 [ "$verbose" != "yes" ] || echo "options : $getopt_temp"
 
-latestfile=latest-$variant-verified.txt
-[ "$verified" != "no" ] || latestfile=latest-$variant.txt
-
-UNPACKDIR=`mktemp -d /tmp/pepperflashplugin-nonfree.XXXXXXXXXX` || die_hard "mktemp failed"
-echo "$UNPACKDIR" | grep -q "^/tmp/pepperflashplugin-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/pepperflashplugin-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
 
-cachedir=/var/cache/pepperflashplugin-nonfree
-
-wgetquiet=' -q '
-wgetfast='-t 3 -T 15 '
-wgetalways=' -nd -P . '
-wgetprogress=' -v --progress=dot:default '
-
-if [ "$ACTION" = "--install" -o "$ACTION" = "--status" ]
+if [ "$ACTION" = "--install" ] || [ "$ACTION" = "--status" ]
 then
-	installed=`strings /usr/lib/pepperflashplugin-nonfree/libpepflashplayer.so 2> /dev/null | grep LNX | cut -d ' ' -f 2 | sed -e "s/,/./g"`
-
-	[ ! -f $cachedir/$latestfile ] || [ `wc -l $cachedir/$latestfile | cut -f 1 -d ' '` -eq 2 ] || rm $cachedir/$latestfile
-
-	if [ -f $cachedir/$latestfile ]
-	then
-		chromeversion=`head -n 1 $cachedir/$latestfile`
-		flashversion=`tail -n 1 $cachedir/$latestfile`
+	arch=""
+	if [ "$(dpkg --print-architecture)" = "amd64" ]; then
+		arch="x86-64"
+	elif [ "$(dpkg --print-architecture)" = "i386" ]; then
+		arch="x86-32"
 	else
-		chromeversion=0
-		flashversion=0
+		die_hard_with_a_cleanup "unsupported architectures"
 	fi
 
-	mkdir -p var/lib/apt/lists var/cache/apt/archives etc/apt/apt.conf.d etc/apt/preferences.d
-
-	cat > apt.conf <<-EOF
-	Dir ".";
-	Dir::Etc::trusted "pubring.gpg";
-	Debug::NoLocking "true";
-	APT::Sandbox::User "root";
-	Dir::State::Status "/var/lib/dpkg/status";
-	EOF
-
-	arch=`dpkg --print-architecture`
-
-	cat > etc/apt/sources.list <<-EOF
-	deb [arch=$arch] http://dl.google.com/linux/chrome/deb/ stable main
-	EOF
-
-	gpg --quiet --no-permission-warning --homedir "etc/apt" --import /usr/lib/pepperflashplugin-nonfree/pubkey-google.txt
-
-	[ "$verbose" != "yes" ] || echo "doing apt-get update on google repository"
-	stdouterr=`APT_CONFIG=apt.conf apt-get --quiet --quiet update 2>&1 || true`
-	# If there anything other than warnings die:
-	[ -z "$(echo "$stdouterr" | grep -v "^W:")" ] || die_hard_with_a_cleanup "failed to retrieve status information from google : $stdouterr"
-	# Otherwise echo the warnings:
-	[ "$stdouterr" = "" ] || echo "WARNING: $stdouterr"
-
-	newchromeversion=`APT_CONFIG=apt.conf apt-cache show google-chrome-$variant | grep "^Version: " | sed -e "s,^Version: ,,"`
-	poolfile=`APT_CONFIG=apt.conf apt-cache show google-chrome-$variant | grep "^Filename: " | sed -e "s,^Filename: ,,"`
-	deburl="http://dl.google.com/linux/chrome/deb/$poolfile";
-	debfile=`echo $poolfile|sed -e "s,.*/,,"`
-	debsize=`APT_CONFIG=apt.conf apt-cache show google-chrome-$variant | grep "^Size: " | sed -e "s,^Size: ,,"`
-	debsha256=`APT_CONFIG=apt.conf apt-cache show google-chrome-$variant | grep "^SHA256: " | sed -e "s,^SHA256: ,,"`
-	debsha1=`APT_CONFIG=apt.conf apt-cache show google-chrome-$variant | grep "^SHA1: " | sed -e "s,^SHA1: ,,"`
-	debmd5=`APT_CONFIG=apt.conf apt-cache show google-chrome-$variant | grep "^MD5sum: " | sed -e "s,^MD5sum: ,,"`
-
-	if [ "$chromeversion" = "$newchromeversion" ]
-	then
-		upstream=$flashversion
-	else
-		downloadurl="http://people.debian.org/~bartm/pepperflashplugin-nonfree/$latestfile";
-		wgetoptions="$wgetquiet $wgetalways"
-		[ "$fast" != "yes" ] || wgetoptions="$wgetoptions $wgetfast"
-
-		[ "$verbose" != "yes" ] || echo "downloading $downloadurl"
-		HOME=/root wget $wgetoptions $downloadurl || die_hard_with_a_cleanup "wget failed to download $downloadurl"
-
-		[ `wc -l $latestfile | cut -f 1 -d ' '` -eq 2 ] || die_hard_with_a_cleanup "cannot use contents of $downloadurl"
-
-		mv $latestfile $cachedir
-
-		chromeversion=`head -n 1 $cachedir/$latestfile`
-		flashversion=`tail -n 1 $cachedir/$latestfile`
-
-		upstream=$flashversion
-	fi
+	flashversion_upstream="$(wget -q -O - "https://get.adobe.com/flashplayer/webservices/json/?platform_type=Linux&platform_arch=${arch}&browser_dist=Chrome"; | jq -r ".[0].Version")"
+	flashversion_local="$(jq -r ".version" /usr/lib/pepperflashplugin-nonfree/manifest.json)"
 fi
 
 case "$ACTION" in
@@ -216,65 +117,18 @@
 	--install)
 		[ "$verbose" != "yes" ] || echo "selected action = $ACTION"
 
-		[ "$upstream" != "" ] || die_hard_with_a_cleanup "failed to determine upstream version"
+		[ "$flashversion_upstream" != "" ] || die_hard_with_a_cleanup "failed to determine upstream version"
 
-		if [ "$installed" != "" -a "$upstream" != "" -a "$installed" = "$upstream" ]
+		if [ "$flashversion_upstream" != "" ] && [ "$flashversion_local" != "" ] && [ "$flashversion_upstream" = "$flashversion_local" ]
 		then
 
-			[ "$verbose" != "yes" ] || echo "upstream version $upstream is already installed"
+			[ "$verbose" != "yes" ] || echo "upstream version $flashversion_upstream is already installed"
 
 		else
-
-			if [ -f $cachedir/$debfile ]
-			then
-				cp -p $cachedir/$debfile .
-			fi
-	
-			if [ ! -f $debfile ]
-			then
-				wgetoptions="$wgetalways $wgetprogress"
-				[ "$quiet" != "yes" ] || wgetoptions="$wgetquiet $wgetalways"
-				[ "$fast" != "yes" ] || wgetoptions="$wgetoptions $wgetfast"
-				wgetoptions="$wgetoptions -O $UNPACKDIR/$debfile" # to change wget message : Saving to ...
-	
-				HOME=/root wget $wgetoptions $deburl || die_hard_with_a_cleanup "wget failed to download $deburl"
-	
-				[ `stat --format=%s $debfile` = "$debsize" ] || die_hard_with_a_cleanup "rejecting $debfile : wrong size"
-				[ `sha256sum $debfile|sed -e "s, .*,,"` = "$debsha256" ] || die_hard_with_a_cleanup "rejecting $debfile : wrong sha256sum"
-				[ `sha1sum $debfile|sed -e "s, .*,,"` = "$debsha1" ] || die_hard_with_a_cleanup "rejecting $debfile : wrong sha1sum"
-				[ `md5sum $debfile|sed -e "s, .*,,"` = "$debmd5" ] || die_hard_with_a_cleanup "rejecting $debfile : wrong md5sum"
-			fi
-	
-			dpkg-deb -x $debfile unpackchrome
-
-			sofile=unpackchrome/opt/google/chrome/PepperFlash/libpepflashplayer.so
-			[ -e $sofile ] || sofile=unpackchrome/opt/google/chrome-unstable/PepperFlash/libpepflashplayer.so
-			[ -e $sofile ] || sofile=unpackchrome/opt/google/chrome-beta/PepperFlash/libpepflashplayer.so
-			[ -e $sofile ] || sofile=unpackchrome/opt/google/chrome/PepperFlash/libpepflashplayer.so
-
-			mv -f $sofile /usr/lib/pepperflashplugin-nonfree
-			chown root:root /usr/lib/pepperflashplugin-nonfree/libpepflashplayer.so
-			chmod 644 /usr/lib/pepperflashplugin-nonfree/libpepflashplayer.so
-
-			jsonfile=unpackchrome/opt/google/chrome/PepperFlash/manifest.json
-			[ -e $jsonfile ] || jsonfile=unpackchrome/opt/google/chrome-unstable/PepperFlash/manifest.json
-			[ -e $jsonfile ] || jsonfile=unpackchrome/opt/google/chrome-beta/PepperFlash/manifest.json
-			[ -e $jsonfile ] || jsonfile=unpackchrome/opt/google/chrome/PepperFlash/manifest.json
-
-			if [ -e $jsonfile ]
-			then
-				mv -f $jsonfile /usr/lib/pepperflashplugin-nonfree
-				chown root:root /usr/lib/pepperflashplugin-nonfree/manifest.json
-				chmod 644 /usr/lib/pepperflashplugin-nonfree/manifest.json
-			fi
-
-			mv $debfile $cachedir
+			wget -O- 'http://fpdownload.adobe.com/pub/flashplayer/pdc/23.0.0.162/flash_player_ppapi_linux.i386.tar.gz' | tar -xz -C "/usr/lib/pepperflashplugin-nonfree" libpepflashplayer.so manifest.json
 		fi
 
 		[ "$verbose" != "yes" ] || echo "end of action $ACTION"
-
-		ls -1t /var/cache/pepperflashplugin-nonfree/*.deb|tail -n +3|xargs -r rm || true
-
 		;;
 
 	--uninstall)
@@ -291,8 +145,8 @@
 	--status)
 		[ "$verbose" != "yes" ] || echo "selected action = $ACTION"
 
-		echo "Flash Player version installed on this system  : $installed"
-		echo "Flash Player version available on upstream site: $upstream"
+		echo "Flash Player version installed on this system  : $flashversion_local"
+		echo "Flash Player version available on upstream site: $flashversion_upstream"
 
 		[ "$verbose" != "yes" ] || echo "end of action $ACTION"
 
@@ -300,15 +154,10 @@
 
 	*)
 
-		do_cleanup
 		show_usage
 
 		;;
 
 esac
 
-do_cleanup
-
 [ "$verbose" != "yes" ] || echo "end of update-pepperflashplugin-nonfree"
-
-

Reply via email to