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