wok view get-flash-plugin/stuff/get-flash-plugin @ rev 5940
Up gcc (4.5.1)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon Aug 02 14:27:14 2010 +0200 (2010-08-02) |
parents | 15c96f579d5b |
children | 5f75424c73c6 |
line source
1 #!/bin/sh -e
2 : ${DIALOG=tazdialog}
4 ROOT="$1"
6 if test $(id -u) != 0 ; then
7 echo -e "\nYou must be root to run `basename $0`."
8 echo -e "Please type 'su' and root password to become super-user.\n"
9 exit 0
10 fi
12 if [ -d $ROOT/var/lib/tazpkg/installed/flash-plugin ]; then
13 [ -n "$ROOT" ] && exit 1
14 tazpkg remove flash-plugin
15 [ -d /var/lib/tazpkg/installed/flash-plugin ] && exit 1
16 fi
17 WEB_SITE="http://www.adobe.com/products/flash/"
18 URL="http://fpdownload.macromedia.com/get/flashplayer/current/"
20 # Download tarball
21 VERSIONS=""; i=9; while true; do
22 if wget -s ${URL}install_flash_player_${i}_linux.tar.gz 2> /dev/null; then
23 VERSIONS="$VERSIONS $i"
24 [ -n "$ROOT" ] && break
25 elif [ -n "$VERSIONS" ]; then
26 break
27 elif [ $i -gt 20 ]; then
28 exit 1
29 fi
30 i=$(($i + 1))
31 done
33 value="$(echo $VERSIONS)"
34 case "$VERSIONS" in
35 *[0-9]\ [1-9]*)
36 exec 3>&1
37 value=`$DIALOG --clear --colors --title " Install Flash plugin " \
38 --menu "Which version to install" 16 70 5 \
39 $(for i in $VERSIONS; do echo $i; echo "flash-$i"; done) \
40 2>&1 1>&3`
41 retval=$?
42 exec 3>&-
43 [ -n "$value" ] || exit 0
44 [ "$retval" = "1" ] && exit 0
45 esac
46 DIR=install_flash_player_${value}_linux
47 TARBALL=$DIR.tar.gz
48 [ -f $TARBALL ] || wget $URL$TARBALL
49 if [ ! -f $TARBALL ]; then
50 echo "Could not download $TARBALL. Exiting."
51 exit 1
52 fi
55 # Extract
56 mkdir $DIR
57 cd $DIR
58 tar xzf ../$TARBALL
60 [ -d $DIR ] && mv $DIR/* .
61 VERSION="$(strings libflashplayer.so | grep ^LNX | sed -e 's/LNX //' -e 's/,/./g')"
63 # Install files
64 chmod 755 libflashplayer.so
65 chown root.root libflashplayer.so
66 dir=flash-plugin-$VERSION/fs/usr/share/flash
67 mkdir -p $dir
68 mv libflashplayer.so $dir
70 # Sanity Check: Reexport firefox libraries if they don't exist
71 dir=flash-plugin-$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 > flash-plugin-$VERSION/receipt <<EOT
79 PACKAGE="flash-plugin"
80 VERSION="$VERSION"
81 CATEGORY="non-free"
82 SHORT_DESC="Adobe Flash Player."
83 WEB_SITE="$WEB_SITE"
84 DEPENDS="libfirefox curl atk cairo expat fontconfig freetype glib gtk+ libpng \
85 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..."
92 if [ -d \$1/var/lib/tazpkg/installed/firefox ] ; then
93 ln -s /usr/share/flash/libflashplayer.so \$1/usr/lib/firefox*/plugins
94 fi
95 mkdir -p \$1/usr/lib/mozilla/plugins
96 ln -s /usr/share/flash/libflashplayer.so \$1/usr/lib/mozilla/plugins
97 status
98 }
100 post_remove()
101 {
102 echo -n "Processing post remove commands..."
103 if [ -d /var/lib/tazpkg/installed/firefox ] ; then
104 rm -f /usr/lib/firefox*/plugins/libflashplayer.so
105 fi
106 rm -f /usr/lib/mozilla/plugins/libflashplayer.so
107 status
108 }
109 EOT
111 # Pack
112 tazpkg pack flash-plugin-$VERSION
114 # Install pseudo package
115 tazpkg install flash-plugin-$VERSION.tazpkg --root=$ROOT
116 cd ..
118 # Clean
119 rm -rf $DIR $TARBALL