wok view get-flash-plugin/stuff/get-flash-plugin @ rev 16374

Up: slitaz-configs (5.4) Getting ready for 5.0-RC1
author Christophe Lincoln <pankso@slitaz.org>
date Mon Apr 14 19:59:46 2014 +0200 (2014-04-14)
parents cdd889b7f8a7
children 0c6db931437a
line source
1 #!/bin/sh -e
3 [ -f /etc/slitaz/slitaz.conf ] && . /etc/slitaz/slitaz.conf
4 [ $INSTALLED ] || INSTALLED=/var/lib/tazpkg/installed
6 PACKAGE="flash-plugin"
7 WEB_SITE="http://www.adobe.com/products/flash/"
8 SHORT_DESC="Adobe Flash Player."
9 ROOT="$1"
10 [ -d "$ROOT" ] || ROOT=""
12 if test $(id -u) != 0 ; then
13 echo -e "\nYou must be root to run `basename $0`."
14 echo -e "Please type 'su' and root password to become super-user.\n"
15 exit 0
16 fi
18 if [ -d ${ROOT}${INSTALLED}/$PACKAGE ]; then
19 [ -n "$ROOT" ] && exit 1
20 tazpkg remove $PACKAGE
21 [ -d $INSTALLED/$PACKAGE ] && exit 1
22 fi
24 VERSION=$(echo " $@ " | sed '/ [0-9]* /!d;s/.* \([0-9]*\) .*/\1/')
25 [ -n "$VERSION" ] && [ $VERSION -lt 100 ] && VERSION=${VERSION}0
27 URL=
28 for i in ${VERSION/./} $(seq 111 999); do
29 n="$(busybox wget -O - "http://get.adobe.com/fr/flashplayer/completion/?installer=Flash_Player_${i:0:2}.${i:2:1}_for_other_Linux_(.tar.gz)_32-bit" | \
30 sed "/gz/!d;s/.* '//;s/'.*//")"
31 [ -n "$n" ] && URL="$n" && [ "$i" != "${VERSION/./}" ] && continue
32 [ -n "$URL" ] && break
33 done
34 [ -z "$URL" ] && for i in ${VERSION:0:2} $(seq 11 99); do
35 n="$(busybox wget -O - "http://get.adobe.com/fr/flashplayer/completion/?installer=Flash_Player_${i}_for_other_Linux_(.tar.gz)_32-bit" | \
36 sed "/gz/!d;s/.* '//;s/'.*//")"
37 [ -n "$n" ] && URL="$n" && [ "$i" != "${VERSION:0:2}" ] && continue
38 [ -n "$URL" ] && break
39 done
41 if [ -z "$URL" ]; then
42 echo "Could not find url. Exiting."
43 exit 1
44 fi
46 TMP_DIR=/tmp/get-$PACKAGE-$$-$RANDOM
47 CUR_DIR=$(pwd)
48 mkdir -p $TMP_DIR && cd $TMP_DIR
49 TARBALL="$(basename $URL)"
50 busybox wget -O $TARBALL $URL
51 if [ ! -f $TARBALL ]; then
52 echo "Could not download $TARBALL. Exiting."
53 exit 1
54 fi
56 tar xzf $TARBALL
58 VERSION="$(strings libflashplayer.so | grep ^LNX | sed -e 's/LNX //' -e 's/,/./g')"
60 # Install files
61 chmod 755 libflashplayer.so
62 chown root.root libflashplayer.so
63 dir=$PACKAGE-$VERSION/fs
64 mkdir -p $dir/usr/share/flash
65 mv libflashplayer.so $dir/usr/share/flash
66 mv usr/bin $dir/usr
67 mv usr/share/icons $dir/usr/share
68 mv usr/share/pixmaps $dir/usr/share
70 # Sanity Check: Reexport firefox libraries if they don't exist
71 dir=$PACKAGE-$VERSION/fs/usr/lib
72 mkdir -p $dir
73 for i in /usr/lib/firefox/*.so ; do
74 [ -f $i ] && [ -z "`ls /usr/lib/$(basename $i)`" ] && ln -s $i $dir
75 done
77 # Create pseudo package
78 cat > $PACKAGE-$VERSION/receipt <<EOT
79 PACKAGE="$PACKAGE"
80 VERSION="$VERSION"
81 CATEGORY="non-free"
82 SHORT_DESC="$SHORT_DESC"
83 WEB_SITE="$WEB_SITE"
84 DEPENDS="libfirefox curl atk cairo expat fontconfig freetype glib gtk+ libpng \
85 nss pango pixman xorg-libICE xorg-libSM xorg-libX11 xorg-libXau xorg-libXcomposite \
86 xorg-libXcursor xorg-libXdamage xorg-libXdmcp xorg-libXext xorg-libXfixes \
87 xorg-libXinerama xorg-libXrandr xorg-libXrender xorg-libXt zlib"
89 post_install()
90 {
91 echo -n "Processing post install commands..."
93 [ -d \$1/usr/lib/mozilla/plugins ] || mkdir -p \$1/usr/lib/mozilla/plugins
94 ln -s /usr/share/flash/libflashplayer.so \$1/usr/lib/mozilla/plugins
95 [ -d \$1/opt/google/chrome/plugins ] || mkdir -p \$1/opt/google/chrome/plugins
96 ln -s /usr/share/flash/libflashplayer.so \$1/opt/google/chrome/plugins/libgcflashplayer.so
97 [ -d \$1/usr/lib/opera/plugins ] || mkdir -p \$1/usr/lib/opera/plugins
98 ln -s /usr/share/flash/libflashplayer.so \$1/usr/lib/opera/plugins/libflashplayer.so
99 status
100 }
102 post_remove()
103 {
104 echo -n "Processing post remove commands..."
105 rm -f \$1/usr/lib/mozilla/plugins/libflashplayer.so
106 rm -f \$1/opt/google/chrome/plugins/libgcflashplayer.so
107 rm -f \$1/usr/lib/opera/plugins/libflashplayer.so
108 status
109 }
110 EOT
112 # Pack
113 tazpkg pack $PACKAGE-$VERSION
115 # Install pseudo package
116 tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
117 case " $@ " in
118 *\ --k*) mv $PACKAGE-$VERSION.tazpkg $CUR_DIR ;;
119 esac
121 # Clean
122 cd $CUR_DIR
123 rm -rf $TMP_DIR