wok-current view get-opera/stuff/get-opera @ rev 5753

get-opera: fix URL
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Jul 02 23:42:13 2010 +0200 (2010-07-02)
parents 112c7cb6ae86
children d97529779044
line source
1 #!/bin/sh -e
3 URL=http://mirrors.dedipower.com/opera/linux/
4 ROOT="$1"
6 if test $(id -u) != 0 ; then
7 echo -e "\nYou must be root to run `basename $0`."
8 echo -e "Please type 'su' and root password to become super-user.\n"
9 exit 0
10 fi
12 if [ -d $ROOT/var/lib/tazpkg/installed/opera ]; then
13 [ -n "$ROOT" ] && exit 1
14 tazpkg remove opera
15 [ -d /var/lib/tazpkg/installed/opera ] && exit 1
16 fi
18 TMP_DIR=/tmp/get-opera-$$-$RANDOM
19 CUR_DIR=$(pwd)
20 mkdir -p $TMP_DIR && cd $TMP_DIR
22 get_releases()
23 {
24 wget -O - "$URL?C=M;O=D" 2>/dev/null | awk '/folder/ { print $5 }' | \
25 sed -e 's/href="\(.*\)">.*/\1/' -e 's|/||'
26 }
28 # Download rpm
29 for RELEASE in $(get_releases); do
30 [ -n "$RELEASE" ] || continue
31 FILE=$(wget -O - "$URL$RELEASE/" 2> /dev/null | grep i386.rpm | sed 's/.*href="\(.*\)">.*/\1/')
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. Exiting."
41 exit 1
42 fi
44 VERSION=$(rpm -qip $FILE | awk '/^Version/ { print $3 }')-$RELEASE
46 mkdir -p opera-$VERSION/fs
48 # Extract files
49 cd opera-$VERSION/fs
50 rpm2cpio < ../../$FILE | cpio -idm
51 # extracted pkg can be removed: Save RAM
52 rm -f ../../$FILE
54 # Create menu
55 mkdir -p usr/share/applications
56 cat > usr/share/applications/opera.desktop <<EOT
57 [Desktop Entry]
58 Version=1.0
59 TryExec=opera
60 Encoding=UTF-8
61 Name=Opera
62 Name[af]=opera
63 Name[eo]=Opero
64 Name[zu]=I Opera
65 GenericName=Web browser
66 GenericName[bs]=Web preglednik
67 GenericName[de]=Web-Browser
68 GenericName[eo]=TTT-rigardilo
69 GenericName[es]=Navegador web
70 GenericName[et]=Veebibrauser
71 GenericName[eu]=Web arakatzailea
72 GenericName[fi]=WWW-selain
73 GenericName[fr]=Un navigateur web
74 GenericName[is]=Vafri
75 GenericName[it]=Browser Web
76 GenericName[nl]=webbrowser
77 GenericName[nn]=Nettlesar
78 GenericName[pt]=Navegador Web
79 GenericName[pt_BR]=Navegador
80 GenericName[ro]=Navigator de web
81 GenericName[sl]=Spletni brskalnik
82 GenericName[ven]=Buronza ya Webu
83 GenericName[xh]=Umkhangeli Zincwadi Zokubhaliweyo
84 GenericName[zu]=Umkhangeli zincwadi we Web
85 Exec=opera %u
86 Terminal=false
87 Categories=Application;Qt;Network;WebBrowser;X-Ximian-Main;X-Ximian-Toplevel
88 Icon=opera.png
89 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
90 Comment=Web Browser
91 Type=Application
92 EOT
93 cd ../..
95 cat > opera-$VERSION/receipt <<EOT
96 PACKAGE="opera"
97 VERSION="$VERSION"
98 CATEGORY="non-free"
99 SHORT_DESC="Opera Web browser."
100 DEPENDS="libQtGui"
101 WEB_SITE="http://www.opera.com/"
102 EOT
104 # Remove unwanted locale
105 mv opera-$VERSION/fs/usr/share/opera/locale opera-$VERSION/fs/usr/share/opera/locale-full
106 mkdir -p opera-$VERSION/fs/usr/share/opera/locale
107 cp -a opera-$VERSION/fs/usr/share/opera/locale-full/en \
108 opera-$VERSION/fs/usr/share/opera/locale-full/fr \
109 opera-$VERSION/fs/usr/share/opera/locale-full/pt \
110 opera-$VERSION/fs/usr/share/opera/locale-full/de \
111 opera-$VERSION/fs/usr/share/opera/locale-full/zh-cn \
112 opera-$VERSION/fs/usr/share/opera/locale
113 rm -rf opera-$VERSION/fs/usr/share/opera/locale-full
114 rm -rf opera-$VERSION/fs/usr/share/pixmaps
117 # Pack
118 tazpkg pack opera-$VERSION
120 # Clean to save RAM memory
121 rm -rf opera-$VERSION
123 # Install pseudo package
124 tazpkg install opera-$VERSION.tazpkg --root=$ROOT
126 # Clean
127 cd $CUR_DIR
128 rm -rf $TMP_DIR