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

Update get-flash-plugin
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Nov 29 13:36:45 2011 +0100 (2011-11-29)
parents aef77d974511
children 05ee700100bf
line source
1 #!/bin/sh -e
3 PACKAGE="flash-plugin"
4 WEB_SITE="http://www.adobe.com/products/flash/"
5 SHORT_DESC="Adobe Flash Player."
6 ROOT="$1"
7 [ -d "$ROOT" ] || ROOT=""
9 if test $(id -u) != 0 ; then
10 echo -e "\nYou must be root to run `basename $0`."
11 echo -e "Please type 'su' and root password to become super-user.\n"
12 exit 0
13 fi
15 if [ -d ${ROOT}${INSTALLED}/$PACKAGE ]; then
16 [ -n "$ROOT" ] && exit 1
17 tazpkg remove $PACKAGE
18 [ -d $INSTALLED/$PACKAGE ] && exit 1
19 fi
21 URL=
22 for i in $(seq 11 99); do
23 n="$(busybox wget -O - "http://get.adobe.com/fr/flashplayer/completion/?installer=Flash_Player_${i}_for_other_Linux_(.tar.gz)_32-bit" | \
24 sed "/gz/!d;s/.* '//;s/'.*//")"
25 [ -n "$n" ] && URL="$n" && continue
26 break
27 done
29 if [ -z "$URL" ]; then
30 echo "Could not find url. Exiting."
31 exit 1
32 fi
34 TMP_DIR=/tmp/get-$PACKAGE-$$-$RANDOM
35 CUR_DIR=$(pwd)
36 mkdir -p $TMP_DIR && cd $TMP_DIR
37 TARBALL="$(basename $URL)"
38 busybox wget -O $TARBALL $URL
39 if [ ! -f $TARBALL ]; then
40 echo "Could not download $TARBALL. Exiting."
41 exit 1
42 fi
44 tar xzf $TARBALL
46 VERSION="$(strings libflashplayer.so | grep ^LNX | sed -e 's/LNX //' -e 's/,/./g')"
48 # Install files
49 chmod 755 libflashplayer.so
50 chown root.root libflashplayer.so
51 dir=$PACKAGE-$VERSION/fs/usr/share/flash
52 mkdir -p $dir
53 mv libflashplayer.so $dir
55 # Sanity Check: Reexport firefox libraries if they don't exist
56 dir=$PACKAGE-$VERSION/fs/usr/lib
57 mkdir -p $dir
58 for i in /usr/lib/firefox/*.so ; do
59 [ -f $i ] && [ -z "`ls /usr/lib/$(basename $i)`" ] && ln -s $i $dir
60 done
62 # Create pseudo package
63 cat > $PACKAGE-$VERSION/receipt <<EOT
64 PACKAGE="$PACKAGE"
65 VERSION="$VERSION"
66 CATEGORY="non-free"
67 SHORT_DESC="$SHORT_DESC"
68 WEB_SITE="$WEB_SITE"
69 DEPENDS="libfirefox curl atk cairo expat fontconfig freetype glib gtk+ libpng \
70 pango pixman xorg-libICE xorg-libSM xorg-libX11 xorg-libXau xorg-libXcomposite \
71 xorg-libXcursor xorg-libXdamage xorg-libXdmcp xorg-libXext xorg-libXfixes \
72 xorg-libXinerama xorg-libXrandr xorg-libXrender xorg-libXt zlib"
74 post_install()
75 {
76 echo -n "Processing post install commands..."
77 if [ -d \$1/$INSTALLED/firefox ] ; then
78 ln -s /usr/share/flash/libflashplayer.so \$1/usr/lib/firefox/plugins
79 fi
80 mkdir -p \$1/usr/lib/mozilla/plugins
81 ln -s /usr/share/flash/libflashplayer.so \$1/usr/lib/mozilla/plugins
82 status
83 }
85 post_remove()
86 {
87 echo -n "Processing post remove commands..."
88 if [ -d $INSTALLED/firefox ] ; then
89 rm -f /usr/lib/firefox/plugins/libflashplayer.so
90 fi
91 rm -f /usr/lib/mozilla/plugins/libflashplayer.so
92 status
93 }
94 EOT
96 # Pack
97 tazpkg pack $PACKAGE-$VERSION
99 # Install pseudo package
100 tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
101 case " $@ " in
102 *\ --k*) mv $PACKAGE-$VERSION.tazpkg $CUR_DIR ;;
103 esac
105 # Clean
106 cd $CUR_DIR
107 rm -rf $TMP_DIR