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

Up: firefox-official (62.0)
author Christophe Lincoln <pankso@slitaz.org>
date Tue Sep 11 20:02:56 2018 +0200 (2018-09-11)
parents a97709a29fd3
children
line source
1 #!/bin/sh -e
3 PACKAGE="opera"
4 WEB_SITE="http://www.opera.com/"
5 CATEGORY="non-free"
6 DEPENDS=""
7 URL=https://ftp.opera.com/pub/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" | sed 's|.*[Ff]="\([^"/]*\).*|\1|;/[^0-9b]/d' | tac
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 sed "s|sh$|&\nexport XMODIFIERS=\"@im=none\"|" -i usr/bin/opera
64 # Create menu
65 mkdir -p usr/share/applications
66 cat > usr/share/applications/opera-browser.desktop <<EOT
67 [Desktop Entry]
68 Version=1.0
69 TryExec=opera
70 Encoding=UTF-8
71 Name=Opera
72 Name[af]=opera
73 Name[eo]=Opero
74 Name[zu]=I Opera
75 GenericName=Web browser
76 GenericName[bs]=Web preglednik
77 GenericName[de]=Web-Browser
78 GenericName[eo]=TTT-rigardilo
79 GenericName[es]=Navegador web
80 GenericName[et]=Veebibrauser
81 GenericName[eu]=Web arakatzailea
82 GenericName[fi]=WWW-selain
83 GenericName[fr]=Un navigateur web
84 GenericName[is]=Vafri
85 GenericName[it]=Browser Web
86 GenericName[nl]=webbrowser
87 GenericName[nn]=Nettlesar
88 GenericName[pt]=Navegador Web
89 GenericName[pt_BR]=Navegador
90 GenericName[ro]=Navigator de web
91 GenericName[sl]=Spletni brskalnik
92 GenericName[ven]=Buronza ya Webu
93 GenericName[xh]=Umkhangeli Zincwadi Zokubhaliweyo
94 GenericName[zu]=Umkhangeli zincwadi we Web
95 Exec=opera %u
96 Terminal=false
97 Categories=Application;Qt;Network;WebBrowser;X-Ximian-Main;X-Ximian-Toplevel
98 Icon=opera-browser
99 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
100 Comment=Web Browser
101 Type=Application
102 EOT
103 cd ../..
105 cat > $PACKAGE-$VERSION/receipt <<EOT
106 PACKAGE="$PACKAGE"
107 VERSION="$VERSION"
108 CATEGORY="$CATEGORY"
109 SHORT_DESC="$SHORT_DESC"
110 MAINTAINER="$MAINTAINER"
111 DEPENDS="$DEPENDS"
112 WEB_SITE="$WEB_SITE"
113 EOT
115 # Remove unwanted locale
116 mv $PACKAGE-$VERSION/fs/usr/share/opera/locale $PACKAGE-$VERSION/fs/usr/share/opera/locale-full
117 mkdir -p $PACKAGE-$VERSION/fs/usr/share/opera/locale
118 . /etc/locale.conf
119 for i in $LANG ${LANG/_/-} ${LANG:0:2} en fr ru pt de zh-cn ; do
120 [ -d $PACKAGE-$VERSION/fs/usr/share/opera/locale-full/$i ] &&
121 cp -a $PACKAGE-$VERSION/fs/usr/share/opera/locale-full/$i \
122 $PACKAGE-$VERSION/fs/usr/share/opera/locale
123 done
124 rm -rf $PACKAGE-$VERSION/fs/usr/share/opera/locale-full
125 rm -rf $PACKAGE-$VERSION/fs/usr/share/pixmaps
128 # Pack
129 tazpkg pack $PACKAGE-$VERSION
131 # Clean to save RAM memory
132 rm -rf $PACKAGE-$VERSION
134 # Install pseudo package
135 tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
136 case " $@ " in
137 *\ --k*) mv $PACKAGE-$VERSION.tazpkg $CUR_DIR ;;
138 esac
140 # Clean
141 cd $CUR_DIR
142 rm -rf $TMP_DIR