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