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

get-flash-plugin: Add support to use /etc/slitaz/slitaz.conf file if it exist. If $INSTALLED doesn't exist, assign it to /var/lib/tazpkg/installed.
author Christopher Rogers <slaxemulator@gmail.com>
date Tue Nov 29 11:53:47 2011 +0000 (2011-11-29)
parents 43ed4e348b0d
children c6fbddf69ced
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 URL=
25 for i in $(seq 11 99); do
26 n="$(busybox wget -O - "http://get.adobe.com/fr/flashplayer/completion/?installer=Flash_Player_${i}_for_other_Linux_(.tar.gz)_32-bit" | \
27 sed "/gz/!d;s/.* '//;s/'.*//")"
28 [ -n "$n" ] && URL="$n" && continue
29 break
30 done
32 if [ -z "$URL" ]; then
33 echo "Could not find url. Exiting."
34 exit 1
35 fi
37 TMP_DIR=/tmp/get-$PACKAGE-$$-$RANDOM
38 CUR_DIR=$(pwd)
39 mkdir -p $TMP_DIR && cd $TMP_DIR
40 TARBALL="$(basename $URL)"
41 busybox wget -O $TARBALL $URL
42 if [ ! -f $TARBALL ]; then
43 echo "Could not download $TARBALL. Exiting."
44 exit 1
45 fi
47 tar xzf $TARBALL
49 VERSION="$(strings libflashplayer.so | grep ^LNX | sed -e 's/LNX //' -e 's/,/./g')"
51 # Install files
52 chmod 755 libflashplayer.so
53 chown root.root libflashplayer.so
54 dir=$PACKAGE-$VERSION/fs/usr/share/flash
55 mkdir -p $dir
56 mv libflashplayer.so $dir
58 # Sanity Check: Reexport firefox libraries if they don't exist
59 dir=$PACKAGE-$VERSION/fs/usr/lib
60 mkdir -p $dir
61 for i in /usr/lib/firefox/*.so ; do
62 [ -f $i ] && [ -z "`ls /usr/lib/$(basename $i)`" ] && ln -s $i $dir
63 done
65 # Create pseudo package
66 cat > $PACKAGE-$VERSION/receipt <<EOT
67 PACKAGE="$PACKAGE"
68 VERSION="$VERSION"
69 CATEGORY="non-free"
70 SHORT_DESC="$SHORT_DESC"
71 WEB_SITE="$WEB_SITE"
72 DEPENDS="libfirefox curl atk cairo expat fontconfig freetype glib gtk+ libpng \
73 pango pixman xorg-libICE xorg-libSM xorg-libX11 xorg-libXau xorg-libXcomposite \
74 xorg-libXcursor xorg-libXdamage xorg-libXdmcp xorg-libXext xorg-libXfixes \
75 xorg-libXinerama xorg-libXrandr xorg-libXrender xorg-libXt zlib"
77 post_install()
78 {
79 echo -n "Processing post install commands..."
80 if [ -d \$1/$INSTALLED/firefox ] ; then
81 ln -s /usr/share/flash/libflashplayer.so \$1/usr/lib/firefox/plugins
82 fi
83 mkdir -p \$1/usr/lib/mozilla/plugins
84 ln -s /usr/share/flash/libflashplayer.so \$1/usr/lib/mozilla/plugins
85 status
86 }
88 post_remove()
89 {
90 echo -n "Processing post remove commands..."
91 if [ -d $INSTALLED/firefox ] ; then
92 rm -f /usr/lib/firefox/plugins/libflashplayer.so
93 fi
94 rm -f /usr/lib/mozilla/plugins/libflashplayer.so
95 status
96 }
97 EOT
99 # Pack
100 tazpkg pack $PACKAGE-$VERSION
102 # Install pseudo package
103 tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
104 case " $@ " in
105 *\ --k*) mv $PACKAGE-$VERSION.tazpkg $CUR_DIR ;;
106 esac
108 # Clean
109 cd $CUR_DIR
110 rm -rf $TMP_DIR