wok view get-opera/stuff/get-opera @ rev 5901

Up: xorg-xf86-input-plpevtch (0.5.0)
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Fri Jul 23 23:11:30 2010 +0200 (2010-07-23)
parents de9dd0fa3388
children 0edf44a4a7be
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/' | head -n 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 RELEASE=$(rpm -qip $FILE | awk '/^Release/ { print $3 }')
45 VERSION=$(rpm -qip $FILE | awk '/^Version/ { print $3 }')-$RELEASE
47 mkdir -p opera-$VERSION/fs
49 # Extract files
50 cd opera-$VERSION/fs
51 rpm -qip ../../$FILE > description.txt
52 rpm2cpio < ../../$FILE | cpio -idm
53 # extracted pkg can be removed: Save RAM
54 rm -f ../../$FILE
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="opera"
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 cp -a opera-$VERSION/fs/usr/share/opera/locale-full/en \
110 opera-$VERSION/fs/usr/share/opera/locale-full/fr \
111 opera-$VERSION/fs/usr/share/opera/locale-full/pt \
112 opera-$VERSION/fs/usr/share/opera/locale-full/de \
113 opera-$VERSION/fs/usr/share/opera/locale-full/zh-cn \
114 opera-$VERSION/fs/usr/share/opera/locale
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
128 # Clean
129 cd $CUR_DIR
130 rm -rf $TMP_DIR