wok annotate get-opera/stuff/get-opera @ rev 13864

get-opera: new up-to-date mirror,remove depends
author Richard Dunbar <mojo@slitaz.org>
date Sun Jan 13 04:11:25 2013 +0000 (2013-01-13)
parents 58dfbeca564f
children 7dd1b2864868
rev   line source
pascal@1619 1 #!/bin/sh -e
pascal@1619 2
pascal@9657 3 PACKAGE="opera"
pascal@13330 4 WEB_SITE="http://www.opera.com/"
pascal@13332 5 CATEGORY="non-free"
mojo@13864 6 DEPENDS=""
mojo@13864 7 URL=http://mirror.switch.ch/ftp/mirror/opera/linux/
pascal@13330 8
pascal@1713 9 ROOT="$1"
pascal@9657 10 [ -d "$ROOT" ] || ROOT=""
pascal@1619 11
pascal@1619 12 if test $(id -u) != 0 ; then
pascal@1619 13 echo -e "\nYou must be root to run `basename $0`."
pascal@1619 14 echo -e "Please type 'su' and root password to become super-user.\n"
pascal@1619 15 exit 0
pascal@1619 16 fi
pascal@1619 17
pascal@9657 18 if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
pascal@9657 19 [ -n "$ROOT" ] && exit 1
pascal@9657 20 tazpkg remove $PACKAGE
pascal@9657 21 [ -d /var/lib/tazpkg/installed/$PACKAGE ] && exit 1
pascal@1619 22 fi
pascal@1619 23
pascal@9657 24 TMP_DIR=/tmp/get-$PACKAGE-$$-$RANDOM
pascal@1619 25 CUR_DIR=$(pwd)
pascal@1619 26 mkdir -p $TMP_DIR && cd $TMP_DIR
pascal@1619 27
pascal@5753 28 get_releases()
pascal@5753 29 {
pascal@9657 30 wget -qO- "$URL?C=M;O=D" | sed 's|.*[Ff]="\([^"/]*\).*|\1|;/[^0-9b]/d'
pascal@5753 31 }
pascal@5753 32
pascal@7754 33 # Download deb
pascal@9657 34 for RELEASE in $@ $(get_releases); do
mojo@13864 35 FILE=$(wget -O- "$URL$RELEASE/" 2>/dev/null |sed 's|.*[Ff]="\(.*\)".*|\1|;/6.d/!d;q'|sed 's/".*//')
pascal@9657 36 [ -n "$FILE" ] || continue
pascal@9657 37 wget $URL$RELEASE/$FILE
pascal@9657 38 [ -s $FILE ] && break
pascal@3397 39 done
pascal@5753 40
pascal@3893 41 if [ ! -f $FILE ]; then
pascal@3893 42 cd $CUR_DIR
pascal@3893 43 rm -rf $TMP_DIR
pascal@9657 44 echo "Could not download $FILE from $URL. Exiting."
pascal@3893 45 exit 1
pascal@3893 46 fi
pascal@1619 47
pascal@13330 48 mkdir $PACKAGE
pascal@13330 49 dpkg-deb -e $FILE $PACKAGE/meta
pascal@13330 50 dpkg-deb -x $FILE $PACKAGE/fs
pascal@7754 51 # extracted pkg can be removed: Save RAM
pascal@7754 52 rm -f $FILE
pascal@7754 53 sed '/^Description:/,$!d;s/^Description://' \
pascal@13330 54 < $PACKAGE/meta/control > $PACKAGE/description.txt
pascal@1619 55
pascal@13330 56 SHORT_DESC="$(sed '/^Description:/!d;s/.*: //' $PACKAGE/meta/control)"
pascal@13330 57 MAINTAINER="$(sed '/^Maintainer:/!d;s/.*: //' $PACKAGE/meta/control)"
pascal@13330 58 VERSION="$(sed '/^Version:/!d;s/.*: //' $PACKAGE/meta/control)"
pascal@13330 59 mv $PACKAGE $PACKAGE-$VERSION
pascal@13330 60 cd $PACKAGE-$VERSION/fs
pascal@1619 61
pascal@1619 62 # Create menu
pascal@1619 63 mkdir -p usr/share/applications
ben@5756 64 cat > usr/share/applications/opera-browser.desktop <<EOT
pascal@1619 65 [Desktop Entry]
pascal@1619 66 Version=1.0
pascal@1619 67 TryExec=opera
pascal@1619 68 Encoding=UTF-8
pascal@1619 69 Name=Opera
pascal@1619 70 Name[af]=opera
pascal@1619 71 Name[eo]=Opero
pascal@1619 72 Name[zu]=I Opera
pascal@1619 73 GenericName=Web browser
pascal@1619 74 GenericName[bs]=Web preglednik
pascal@1619 75 GenericName[de]=Web-Browser
pascal@1619 76 GenericName[eo]=TTT-rigardilo
pascal@1619 77 GenericName[es]=Navegador web
pascal@1619 78 GenericName[et]=Veebibrauser
pascal@1619 79 GenericName[eu]=Web arakatzailea
pascal@1619 80 GenericName[fi]=WWW-selain
pascal@1619 81 GenericName[fr]=Un navigateur web
pascal@1619 82 GenericName[is]=Vafri
pascal@1619 83 GenericName[it]=Browser Web
pascal@1619 84 GenericName[nl]=webbrowser
pascal@1619 85 GenericName[nn]=Nettlesar
pascal@1619 86 GenericName[pt]=Navegador Web
pascal@1619 87 GenericName[pt_BR]=Navegador
pascal@1619 88 GenericName[ro]=Navigator de web
pascal@1619 89 GenericName[sl]=Spletni brskalnik
pascal@1619 90 GenericName[ven]=Buronza ya Webu
pascal@1619 91 GenericName[xh]=Umkhangeli Zincwadi Zokubhaliweyo
pascal@1619 92 GenericName[zu]=Umkhangeli zincwadi we Web
pascal@1619 93 Exec=opera %u
pascal@1619 94 Terminal=false
pascal@1619 95 Categories=Application;Qt;Network;WebBrowser;X-Ximian-Main;X-Ximian-Toplevel
samuel_trassare@11989 96 Icon=opera-browser
pascal@1619 97 MimeType=text/html;text/xml;application/xhtml+xml;application/x-mimearchive;application/xml;application/rss+xml;application/rdf+xml;image/svg+xml;image/gif;image/jpeg;image/png;image/x-bmp;image/x-xbm;application/mime
pascal@1619 98 Comment=Web Browser
pascal@1619 99 Type=Application
pascal@1619 100 EOT
pascal@1619 101 cd ../..
pascal@1619 102
pascal@13330 103 cat > $PACKAGE-$VERSION/receipt <<EOT
pascal@9657 104 PACKAGE="$PACKAGE"
pascal@1619 105 VERSION="$VERSION"
pascal@13332 106 CATEGORY="$CATEGORY"
pascal@13330 107 SHORT_DESC="$SHORT_DESC"
pascal@13330 108 MAINTAINER="$MAINTAINER"
pascal@13332 109 DEPENDS="$DEPENDS"
pascal@13330 110 WEB_SITE="$WEB_SITE"
pascal@1619 111 EOT
pascal@1619 112
jozee@4980 113 # Remove unwanted locale
pascal@13330 114 mv $PACKAGE-$VERSION/fs/usr/share/opera/locale $PACKAGE-$VERSION/fs/usr/share/opera/locale-full
pascal@13330 115 mkdir -p $PACKAGE-$VERSION/fs/usr/share/opera/locale
pascal@7741 116 . /etc/locale.conf
pascal@9657 117 for i in $LANG ${LANG/_/-} ${LANG:0:2} fr pt de zh-cn ; do
pascal@13330 118 [ -d $PACKAGE-$VERSION/fs/usr/share/opera/locale-full/$i ] &&
pascal@13330 119 cp -a $PACKAGE-$VERSION/fs/usr/share/opera/locale-full/$i \
pascal@13330 120 $PACKAGE-$VERSION/fs/usr/share/opera/locale
pascal@7741 121 done
pascal@13330 122 rm -rf $PACKAGE-$VERSION/fs/usr/share/opera/locale-full
pascal@13330 123 rm -rf $PACKAGE-$VERSION/fs/usr/share/pixmaps
jozee@4980 124
jozee@4980 125
pascal@1619 126 # Pack
pascal@13330 127 tazpkg pack $PACKAGE-$VERSION
pascal@1619 128
jozee@4980 129 # Clean to save RAM memory
pascal@13330 130 rm -rf $PACKAGE-$VERSION
jozee@4980 131
pascal@1619 132 # Install pseudo package
pascal@13330 133 tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
pascal@9657 134 case " $@ " in
pascal@13330 135 *\ --k*) mv $PACKAGE-$VERSION.tazpkg $CUR_DIR ;;
pascal@9657 136 esac
pascal@1619 137
pascal@1619 138 # Clean
pascal@1619 139 cd $CUR_DIR
pascal@1619 140 rm -rf $TMP_DIR
pascal@1619 141