Package: flashplugin-nonfree
Version: 1:3.7
Severity: wishlist
Tags: patch

Dear Maintainer,

It would be great if update-flashplugin-nonfree could provide a way for
users to install their preferred version of Flash Player from a
downloaded archive.  This would provide a way for users to install the
latest version without waiting for you to publish an updated checksum
file as well as providing a way to install specific old, modified, or
beta versions as desired by administrators (e.g. #840696).

To this end, I've attached a patch which adds the --install-local action
to install from a user-provided .tgz file.  The patch header includes a
more detailed discussion of the specific implementation details.  If
you'd be open to this idea with a different implementation, let me know
what you might accept.

Thanks for considering,
Kevin


-- Package-specific info:
Debian version: stretch/sid
Architecture: amd64
Package version: 1:3.7
Adobe Flash Player version: LNX 11,2,202,643
MD5 checksums:
        29c85bc8504422120cf89702986ff8e1  
/var/cache/flashplugin-nonfree/get-upstream-version.pl
        5bb834820d1563b2df2ed52fd9986b24  
/var/cache/flashplugin-nonfree/install_flash_player_11_linux.x86_64.tar.gz
        090726e911d189236f50f9823f042e81  
/usr/lib/flashplugin-nonfree/libflashplayer.so
Alternatives:
        flash-mozilla.so - auto mode
          link best version is /usr/lib/flashplugin-nonfree/libflashplayer.so
          link currently points to 
/usr/lib/flashplugin-nonfree/libflashplayer.so
          link flash-mozilla.so is /usr/lib/mozilla/plugins/flash-mozilla.so
        /usr/lib/flashplugin-nonfree/libflashplayer.so - priority 50
        lrwxrwxrwx 1 root root 34 Aug  6 14:42 
/usr/lib/mozilla/plugins/flash-mozilla.so -> /etc/alternatives/flash-mozilla.so
        /usr/lib/mozilla/plugins/flash-mozilla.so: symbolic link to 
/etc/alternatives/flash-mozilla.so

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (101, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.8.1+kevinoid1 (SMP w/4 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages flashplugin-nonfree depends on:
ii  binutils               2.27-9+b1
ii  ca-certificates        20160104
ii  debconf [debconf-2.0]  1.5.59
ii  gnupg                  2.1.15-4
ii  gnupg2                 2.1.15-4
ii  libatk1.0-0            2.22.0-1
ii  libcairo2              1.14.6-1+b1
ii  libcurl3-gnutls        7.50.1-1
ii  libfontconfig1         2.11.0-6.7
ii  libfreetype6           2.6.3-3+b1
ii  libgcc1                1:6.2.0-9
ii  libglib2.0-0           2.50.1-1
ii  libgtk2.0-0            2.24.31-1
ii  libnspr4               2:4.12-2
ii  libnss3                2:3.26-2
ii  libpango1.0-0          1.40.3-2
ii  libstdc++6             6.2.0-9
ii  libx11-6               2:1.6.3-1
ii  libxext6               2:1.3.3-1
ii  libxt6                 1:1.1.5-1
ii  wget                   1.18-4

flashplugin-nonfree recommends no packages.

Versions of packages flashplugin-nonfree suggests:
pn  firefox-esr                <none>
ii  fonts-dejavu               2.37-1
pn  hal-flash                  <none>
pn  iceweasel                  <none>
pn  konqueror-nsplugins        <none>
pn  ttf-mscorefonts-installer  <none>
pn  ttf-xfree86-nonfree        <none>

-- no debconf information
>From f67f8bdb203eec0c2a495a44528d21b344416328 Mon Sep 17 00:00:00 2001
Message-Id: <f67f8bdb203eec0c2a495a44528d21b344416328.1477969879.git.ke...@kevinlocke.name>
From: Kevin Locke <ke...@kevinlocke.name>
Date: Mon, 31 Oct 2016 20:47:45 -0600
Subject: [PATCH] Add action to install from local tarball

This commit adds the --install-local action which installs from a
user-provided gzipped tar file (which is expected, although not
required, to come from https://get.adobe.com/flashplayer/).

This allows users to install their desired version of Flash Player in
the same way that automated updates are installed.  The primary intended
use case is installing new versions before they are reviewed by the
Debian maintainer(s), but it is not limited to this function.

The implementation refactors the installation commands into an
install_archive function which is then called for both --install and
--install-local.  The code changes to the refactored code include:

- Changing "$downloadfile" to "$archivefile" to reduce global state.
- Skipping the checksum check of libflashplayer.so for --install-local.
- Finding libflashplayer.so from the archive for --install-local.
  (And producing an error if not uniquely found.)
- Additional quoting of "$libflashplayerdotso" for safety.
- Only cache downloaded archives to avoid cache contamination.

Signed-off-by: Kevin Locke <ke...@kevinlocke.name>
---
 update-flashplugin-nonfree | 173 ++++++++++++++++++++++++++-------------------
 1 file changed, 101 insertions(+), 72 deletions(-)

diff --git a/update-flashplugin-nonfree b/update-flashplugin-nonfree
index dac8e8f..fc09790 100755
--- a/update-flashplugin-nonfree
+++ b/update-flashplugin-nonfree
@@ -34,6 +34,7 @@ die_hard() {
 show_usage() {
 	echo "Usage:"
 	echo "  update-flashplugin-nonfree --install"
+	echo "  update-flashplugin-nonfree --install-local <installer.tgz>"
 	echo "  update-flashplugin-nonfree --uninstall"
 	echo "  update-flashplugin-nonfree --status"
 	echo "Additional options:"
@@ -42,7 +43,7 @@ show_usage() {
 	exit 1
 }
 
-getopt_temp=`getopt -o iusfvqn --long install,uninstall,status,fast,verbose,quiet -n 'update-flashplugin-nonfree' -- "$@"` || show_usage
+getopt_temp=`getopt -o iI:usfvqn --long install,install-local:,uninstall,status,fast,verbose,quiet -n 'update-flashplugin-nonfree' -- "$@"` || show_usage
 eval set -- "$getopt_temp" || show_usage
 
 ACTION=none
@@ -67,6 +68,11 @@ do
 			ACTION="--install"
 			shift
 			;;
+		-I|--install-local)
+			ACTION="--install-local"
+			installfile="$2"
+			shift 2
+			;;
 		-u|--uninstall)
 			ACTION="--uninstall"
 			shift
@@ -260,6 +266,90 @@ remove_extrafiles() {
 	rm -f /var/lib/flashplugin-nonfree/extrafiles.md5sums
 }
 
+install_archive() {
+	archivefile="$1"
+	checksumfile="${2-}"
+
+	[ "$verbose" != "yes" ] || echo "unpacking $archivefile ..."
+	tar xozf "$archivefile"
+	if [ -n "$checksumfile" ] ; then
+		[ "$verbose" != "yes" ] || echo "verifying checksum contents of $archivefile ..."
+		head -n 2 < checksums.txt | sha512sum -c - > /dev/null 2>&1 \
+			|| die_hard_with_a_cleanup "sha512sum rejected a part of $archivefile"
+		libflashplayerdotso=`grep "  .*libflashplayer\.so$" "$checksumfile" | cut -c 131-`
+	else
+		libflashplayerdotso=`find . -type f -name libflashplayer.so`
+		[ -f "$libflashplayerdotso" ] \
+			|| die_hard_with_a_cleanup "$archivefile must contain one libflashplayer.so file"
+	fi
+
+	targetdir=/usr/lib/flashplugin-nonfree
+	[ "$verbose" != "yes" ] || echo "moving $libflashplayerdotso to $targetdir ..."
+	rm -f $targetdir/flashplayer.xpt
+	mv -f "$libflashplayerdotso" $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" )
+
+	if [ -n "$checksumfile" ] ; then
+		[ "$verbose" != "yes" ] || echo "moving $archivefile to $cachedir ..."
+		mv -f "$archivefile" $cachedir
+	fi
+
+	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
+}
+
 case "$ACTION" in
 
 	--install)
@@ -326,77 +416,7 @@ case "$ACTION" in
 			[ "$verbose" != "yes" ] || echo "verifying checksum $downloadfile ..."
 			grep tar.gz checksums.txt | sha512sum -c - > /dev/null 2>&1 \
 				|| die_hard_with_a_cleanup "sha512sum rejected $downloadfile"
-			[ "$verbose" != "yes" ] || echo "unpacking $downloadfile ..."
-			tar xozf $downloadfile
-			[ "$verbose" != "yes" ] || echo "verifying checksum contents of $downloadfile ..."
-			head -n 2 < checksums.txt | sha512sum -c - > /dev/null 2>&1 \
-				|| die_hard_with_a_cleanup "sha512sum rejected a part of $downloadfile"
-
-			targetdir=/usr/lib/flashplugin-nonfree
-			libflashplayerdotso=`grep "  .*libflashplayer\.so$" checksums.txt | cut -c 131-`
-
-			[ "$verbose" != "yes" ] || echo "moving $libflashplayerdotso to $targetdir ..."
-			rm -f $targetdir/flashplayer.xpt
-			mv -f $libflashplayerdotso $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
+			install_archive "$downloadfile" checksums.txt
 
 		fi # end if installed != upstream
 
@@ -404,6 +424,15 @@ case "$ACTION" in
 
 		;;
 
+	--install-local)
+		[ "$verbose" != "yes" ] || echo "selected action = $ACTION"
+
+		install_archive "$installfile"
+
+		[ "$verbose" != "yes" ] || echo "end of action $ACTION"
+
+		;;
+
 	--uninstall)
 		[ "$verbose" != "yes" ] || echo "selected action = $ACTION"
 
-- 
2.10.1

Reply via email to