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