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