wok diff get-flash-plugin/stuff/get-flash-plugin @ rev 24031
updated dialog (1.3_20190211 -> 1.3_20210324)
author | Hans-G?nter Theisgen |
---|---|
date | Tue Apr 06 13:52:57 2021 +0100 (2021-04-06) |
parents | d5999a28461c |
children |
line diff
1.1 --- a/get-flash-plugin/stuff/get-flash-plugin Fri Feb 10 19:24:02 2017 -0500 1.2 +++ b/get-flash-plugin/stuff/get-flash-plugin Tue Apr 06 13:52:57 2021 +0100 1.3 @@ -1,69 +1,190 @@ 1.4 -#!/bin/sh -e 1.5 +#!/bin/sh 1.6 +# 1.7 +# get-flash-plugin - create and install SliTaz package flash-plugin 1.8 +# 1.9 +# (C) 2020 SliTaz - GNU General Public License v3. 1.10 +# Author : Pascal Bellard 1.11 +# modified by HGT on 2020-02-10 1.12 +# 1.13 1.14 -[ -f '/etc/slitaz/slitaz.conf' ] && . /etc/slitaz/slitaz.conf 1.15 -[ -z "$INSTALLED" ] && INSTALLED='/var/lib/tazpkg/installed' 1.16 +# === Initialisations === 1.17 1.18 +PKGS_DB="/var/lib/tazpkg" # packages database directory 1.19 PACKAGE="flash-plugin" 1.20 -WEB_SITE="http://www.adobe.com/products/flash/" 1.21 SHORT_DESC="Adobe Flash Player." 1.22 -ROOT="$1" 1.23 -[ -d "$ROOT" ] || ROOT="" 1.24 +CATEGORY="non-free" 1.25 +LICENSE="non-free" 1.26 +WEB_SITE="https://www.adobe.com/products/flashplayer/" 1.27 1.28 -if [ $(id -u) -ne 0 ]; then 1.29 - echo -e "\nYou must be root to run `basename $0`." 1.30 - echo -e "Please type 'su' and root password to become super-user.\n" 1.31 - exit 0 1.32 +DEPENDS="atk cairo curl expat fontconfig freetype glib gtk+ libfirefox libpng \ 1.33 + nss pango pixman xorg-libICE xorg-libSM xorg-libX11 xorg-libXau xorg-libXcomposite \ 1.34 + xorg-libXcursor xorg-libXdamage xorg-libXdmcp xorg-libXext xorg-libXfixes \ 1.35 + xorg-libXinerama xorg-libXrandr xorg-libXrender xorg-libXt zlib" 1.36 + 1.37 +# Declare functions check_root, status, ... 1.38 +. /lib/libtaz.sh 1.39 +# and make commandline options (if any) available as variables 1.40 + 1.41 +is_installed() 1.42 +{ 1.43 + if [ -d $ROOT$PKGS_DB/installed/$PACKAGE ] 1.44 + then #package is deemed to be installed 1.45 + return 0 1.46 + else 1.47 + return 1 1.48 + fi 1.49 +} 1.50 + 1.51 +# Show commandline options, if requested by --help 1.52 +if [ "$help" == "yes" ] 1.53 + then 1.54 + echo "Commandline options: 1.55 + $0 1.56 + --version=<version> 1.57 + --root=<path-to-root> 1.58 + --install=yes|no 1.59 + --keep=no|yes 1.60 + --tmpdir=<directory-to-build-package>" 1.61 + exit 1.62 fi 1.63 1.64 -if [ -d $ROOT$INSTALLED/$PACKAGE ]; then 1.65 - [ -n "$ROOT" ] && exit 1 1.66 - tazpkg remove $PACKAGE 1.67 - [ -d $INSTALLED/$PACKAGE ] && exit 1 1.68 -fi 1.69 -VERSION="$(wget -q -O - http://www.adobe.com/software/flash/about/ | sed -n '/Linux/,/<\/tr/s/[^>]*>\([0-9].*\)<.*/\1/p')" 1.70 -TARBALL="flash_player_npapi_linux.i386.tar.gz" 1.71 -URL="https://fpdownload.adobe.com/get/flashplayer/pdc/$VERSION/$TARBALL" 1.72 -TMP_DIR="$(mktemp -d)" 1.73 -CUR_DIR=$(pwd) 1.74 -cd $TMP_DIR 1.75 -wget --no-check-certificate -O $TARBALL $URL 1.76 +# Check for system administrator privileges 1.77 +check_root 1.78 1.79 -if [ ! -f $TARBALL ]; then 1.80 - echo "Could not download $TARBALL. Exiting." 1.81 - exit 1 1.82 +title "Package $PACKAGE will be build as SliTaz package and installed" 1.83 + 1.84 +# Fetch latest version, unless version is set by option --version 1.85 +[ -z "$version" ] && version="latest" 1.86 + 1.87 +# Install SliTaz package, unless inhibited by option --install=no 1.88 +[ -z "$install" ] && install="yes" 1.89 + 1.90 +# Delete SliTaz package file $PACKAGE-$VERSION.tazpkg after installation, 1.91 +# unless option --keep=yes is given 1.92 +[ -z "$keep" ] && keep="no" 1.93 + 1.94 +# Directory for temporary files 1.95 +TMP_DIR="$tmpdir" 1.96 +[ -z "$tmpdir" ] && TMP_DIR="/tmp/get-$PACKAGE" 1.97 + 1.98 +# Logging file (unused by now) 1.99 +LOG=$TMP_DIR/get-$PACKAGE.log 1.100 + 1.101 +cat <<EOT 1.102 +Options in use: 1.103 + root : $root/ 1.104 + version : $version 1.105 + install package: $install 1.106 + keep tazpkg : $keep 1.107 + build directory: $TMP_DIR 1.108 + 1.109 +EOT 1.110 + 1.111 +separator; newline 1.112 + 1.113 +# === Remove package, if installed === 1.114 +if is_installed 1.115 + then 1.116 + echo "$PACKAGE is already installed." 1.117 + echo -n "Would you like to remove and reinstall this package [y/n]? " 1.118 + read answer 1.119 + case "$answer" in 1.120 + y|Y) 1.121 + action "Removing installed version..." 1.122 + tazpkg remove $PACKAGE --root="$root/" 1.123 + [ ! is_installed ] && 1.124 + die "Can't remove installed version. Exiting." 1.125 + ;; 1.126 + *) 1.127 + echo "Leaving $PACKAGE untouched." 1.128 + exit 0 1.129 + ;; 1.130 + esac 1.131 fi 1.132 1.133 -tar xzf $TARBALL 1.134 +# === Fetch archive file, if not existing === 1.135 +if [ "$version" == "latest" ] 1.136 + then 1.137 + VERSION="$(wget --no-check-certificate -q -O - \ 1.138 + https://helpx.adobe.com/flash-player/kb/archived-flash-player-versions.html |\ 1.139 + sed -n '/Released /p' | head -1 | sed 's|.*fp_\(.*\)_archive.*|\1|')" 1.140 + else 1.141 + VERSION=$version 1.142 +fi 1.143 +FILE="fp_${VERSION}_archive.zip" 1.144 +WGET_URL="https://fpdownload.macromedia.com/pub/flashplayer/installers/archive/$FILE" 1.145 + 1.146 +CUR_DIR=$(pwd) 1.147 +mkdir -p $TMP_DIR 1.148 +cd $TMP_DIR 1.149 +if [ -f $FILE ] 1.150 + then 1.151 + echo "Using existing archive file $FILE" 1.152 + else 1.153 + action "Fetching the archive" 1.154 + newline 1.155 + wget --no-check-certificate $WGET_URL 1.156 + if [ ! -f $FILE ] 1.157 + then 1.158 + cd $CUR_DIR 1.159 + rm -rf $TMP_DIR 1.160 + echo "Could not transfer $FILE from $WGET_URL. Exiting." 1.161 + exit 1 1.162 + fi 1.163 +fi 1.164 + 1.165 +# === Extract files from archive === 1.166 +action "Extracting the archive" 1.167 +newline 1.168 + 1.169 +mkdir $PACKAGE 1.170 +cd $PACKAGE 1.171 +unzip $TMP_DIR/$FILE *linux.i386.tar.gz 1.172 +tar xf */*linux.i386.tar.gz 1.173 +status 1.174 + 1.175 +# Remove archive file 1.176 +cd $TMP_DIR 1.177 +rm -f $FILE 1.178 1.179 # Install files 1.180 -chmod 755 libflashplayer.so 1.181 -chown root.root libflashplayer.so 1.182 fs=$PACKAGE-$VERSION/fs 1.183 mkdir -p $fs/usr/share/flash 1.184 -mv libflashplayer.so $fs/usr/share/flash 1.185 -mv usr/bin $fs/usr 1.186 -mv usr/share/icons $fs/usr/share 1.187 -mv usr/share/pixmaps $fs/usr/share 1.188 -mv usr/share/applications $fs/usr/share 1.189 + 1.190 +mv $PACKAGE/libflashplayer.so $fs/usr/share/flash 1.191 +chmod 755 $fs/usr/share/flash/libflashplayer.so 1.192 +chown root.root $fs/usr/share/flash/libflashplayer.so 1.193 +mv $PACKAGE/usr/bin $fs/usr 1.194 +mv $PACKAGE/usr/share/icons $fs/usr/share 1.195 +mv $PACKAGE/usr/share/pixmaps $fs/usr/share 1.196 +mv $PACKAGE/usr/share/applications $fs/usr/share 1.197 1.198 # Sanity Check: Reexport firefox libraries if they don't exist 1.199 dir=$PACKAGE-$VERSION/fs/usr/lib 1.200 mkdir -p $dir 1.201 -for i in /usr/lib/firefox/*.so ; do 1.202 - [ -f $i ] && [ -z "$(ls /usr/lib/$(basename $i))" ] && ln -s $i $dir 1.203 -done 1.204 +for i in /usr/lib/firefox/*.so 1.205 + do 1.206 + [ -f $i ] && 1.207 + [ -z "$(ls /usr/lib/$(basename $i))" ] && 1.208 + ln -s $i $dir 1.209 + done 1.210 1.211 -# Create pseudo package 1.212 -cat > $PACKAGE-$VERSION/receipt <<EOT 1.213 +# === Create SliTaz package === 1.214 + 1.215 +cd $PACKAGE-$VERSION 1.216 + 1.217 +# Create recipe for SliTaz package 1.218 +cat > receipt <<EOT 1.219 +# SliTaz package receipt. 1.220 + 1.221 PACKAGE="$PACKAGE" 1.222 VERSION="$VERSION" 1.223 -CATEGORY="non-free" 1.224 +CATEGORY="$CATEGORY" 1.225 SHORT_DESC="$SHORT_DESC" 1.226 +LICENSE="$LICENSE" 1.227 WEB_SITE="$WEB_SITE" 1.228 -DEPENDS="libfirefox curl atk cairo expat fontconfig freetype glib gtk+ libpng \ 1.229 -nss pango pixman xorg-libICE xorg-libSM xorg-libX11 xorg-libXau xorg-libXcomposite \ 1.230 -xorg-libXcursor xorg-libXdamage xorg-libXdmcp xorg-libXext xorg-libXfixes \ 1.231 -xorg-libXinerama xorg-libXrandr xorg-libXrender xorg-libXt zlib" 1.232 + 1.233 +DEPENDS="$DEPENDS" 1.234 1.235 post_install() 1.236 { 1.237 @@ -83,15 +204,24 @@ 1.238 } 1.239 EOT 1.240 1.241 +cd $TMP_DIR 1.242 + 1.243 +action "Creating the package $PACKAGE..." 1.244 # Pack 1.245 tazpkg pack $PACKAGE-$VERSION 1.246 +# Remove package tree 1.247 +rm -rf $PACKAGE-$VERSION 1.248 1.249 -# Install pseudo package 1.250 -tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT 1.251 -case " $@ " in 1.252 -*\ --k*) mv $PACKAGE-$VERSION.tazpkg $CUR_DIR ;; 1.253 -esac 1.254 +# === Install the SliTaz package === 1.255 +[ "$install" == "yes" ] && 1.256 +tazpkg install $PACKAGE-$VERSION.tazpkg --root="$root" 1.257 1.258 -# Clean 1.259 +# === Cleanup === 1.260 +# Preserve package file, if requested 1.261 +[ "$keep" == "yes" ] && 1.262 +( mv $PACKAGE-$VERSION.tazpkg $CUR_DIR && 1.263 + echo Saved $PACKAGE-$VERSION.tazpkg to $CUR_DIR ) 1.264 + 1.265 +# Remove temporary build directory 1.266 cd $CUR_DIR 1.267 -rm -rf "$TMP_DIR" 1.268 +rm -rf $TMP_DIR