summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b551126aa5a85c7840c2841663c6c1704261f9a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# Maintainer: hawkeye116477 <hawkeye116477 at gmail dot com>

pkgname=waterfox-kde-bin
pkgver=56.2.5
pkgrel=1
pkgdesc="Free, open and private browser with openSUSE's patches for better integration with KDE"
arch=('x86_64')
url="https://www.waterfoxproject.org/"
license=('MPL')
depends=('gtk3' 'gtk2' 'libxt' 'startup-notification' 'mime-types' 'dbus-glib' 'ffmpeg'
         'hunspell' 'ttf-font' 'hicolor-icon-theme' 'kwaterfoxhelper')
makedepends=('wget')
optdepends=('networkmanager: Location detection via available WiFi networks'
            'libnotify: Notification integration'
            'speech-dispatcher: Text-to-Speech'
            'pulseaudio: Audio support'
            'alsa-lib: Audio support')
provides=("waterfox=$pkgver")
conflicts=('waterfox')
options=('!emptydirs' '!strip')
install=$pkgname.install
source=("waterfox-kde-${pkgver}-0-x86_64.pkg.tar.xz::https://download.opensuse.org/repositories/home:/hawkeye116477:/waterfox/Arch/x86_64/waterfox-kde-${pkgver}-0-x86_64.pkg.tar.xz")
sha256sums=('67cc09df9888b86266dc06e4271cc35eb1d6d34111430175f1246b29b89fbba5')

package() {
mv $srcdir/usr/ $pkgdir/usr/
# Settings file for language packs
_settings=/usr/lib/waterfox/.installer/settings
_i18n_ver=56.2.4

if [ -f "$_settings" ]; then
echo "Previous settings detected! Do you wish to load them?"
select yn in "Yes" "No"; do
                case $yn in
                    Yes )
    if grep -q download_language=yes "$_settings"; then
    _chosen_language=$(grep -Po 'chosen_language=\K[^ ]+' $_settings)
    wget -O $srcdir/waterfox-i18n-${_chosen_language}-${_i18n_ver}-0-x86_64.pkg.tar.xz https://download.opensuse.org/repositories/home:/hawkeye116477:/waterfox/Arch/x86_64/waterfox-i18n-${_chosen_language}-${_i18n_ver}-0-x86_64.pkg.tar.xz;
	msg2 "Extracting locale..."
    bsdtar -xf $srcdir/waterfox-i18n-${_chosen_language}-${_i18n_ver}-0-x86_64.pkg.tar.xz -C "$pkgdir/"
    rm $pkgdir/.BUILDINFO
    rm $pkgdir/.MTREE
    rm $pkgdir/.PKGINFO    
    fi
    mkdir $pkgdir/usr/lib/waterfox/.installer/
    cp $_settings $pkgdir/usr/lib/waterfox/.installer/
                break;;
No )
echo "Root access is required to remove settings file!"
sudo rm -rvf /usr/lib/waterfox/.installer/
break;;
                    esac
                done
fi

if [ ! -f "$_settings" ]; then
# Download and install language pack
echo "Do you wish to download and install language pack (if you want to have en-US - this is not needed)?"
            select yn in "Yes" "No"; do
                case $yn in
                    Yes )
_download_language=yes
echo -e "Available languages:
  (ach) Acholi; (af) Afrikaans; (an) Aragonese; (ar) Arabic; (as) Assamese;
  (ast) Asturian; (az) Azerbaijani; (bg) Bulgarian; (bn-BD) Bengali - Bangladesh;
  (bn-IN) Bengali - India; (br) Breton; bs) Bosnian; (ca) Catalan; 
  (cak) Maya Kaqchikel; (cs) Czech; (cy) Welsh; (da) Danish; (de) German; 
  (dsb) Lower Sorbian; (el) Greek; (en-GB) English - British;
  (en-ZA) English - South African; (eo) Esperanto; (es-AR) Spanish - Argentina; 
  (es-CL) Spanish - Chile; (es-ES) Spanish - Spain; (es-MX) Spanish
  (et) Estonian; (eu) Basque; (fa) Persian; (ff) Fulah; (fi) Finnish; 
  (fr) French; (fy-NL) Frisian; (ga-IE) Irish; (gd) Gaelic - Scotland; 
  (gl) Galician; (gn) Guarani; (gu-IN) Gujarati - India; (he) Hebrew; 
  (hi-IN) Hindi - India; (hr) Croatian; (hsb) Upper Sorbian; (hu) Hungarian;
  (hy-AM) Armenian; (id) Indonesian; (is) Icelandic; (it) Italian;
  (ja) Japanese; (ka) Georgian; (kab) Kabyle; (kk) Kazakh; (km) Khmer; 
  (kn) Kannada; (ko) Korean; (lij) Ligurian; (lt) Lithuanian; (lv) Latvian; 
  (mai) Maithili; (mk) Macedonian; (ml) Malayalam; (mr) Marathi; (ms) Malay; 
  (nb-NO) Norwegian - Bokmål; (nl) Dutch; (nn-NO) Norwegian - Nynorsk; (or) Oriya; 
  (pa-IN) Punjabi - India; (pl) Polish; (pt-BR) Portuguese - Brazilian; 
  (pt-PT) Portuguese - Portugal; (rm) Romansh; (ro) Romanian; (ru) Russian;
  (si) Sinhala; (sk) Slovak; (sl) Slovenian; (son) Songhai; (sq) Albanian;
  (sr) Serbian; (sv-SE) Swedish; (ta) Tamil; (te) Telugu; (th) Thai;
  (tr) Turkish; (uk) Ukrainian; (uz) Uzbek; (vi) Vietnamese;
  (xh) Xhosa; (zh-CN) Simplified Chinese; (zh-TW) Traditional Chinese
"
printf "Type language code of language you wish to download and install
(language code is acronym that is inside the parentheses () before your language,
for example - for Polish, type pl): "
read _chosen_language

    wget -O $srcdir/waterfox-i18n-${_chosen_language}-${_i18n_ver}-0-x86_64.pkg.tar.xz https://download.opensuse.org/repositories/home:/hawkeye116477:/waterfox/Arch/x86_64/waterfox-i18n-${_chosen_language}-${_i18n_ver}-0-x86_64.pkg.tar.xz;
	msg2 "Extracting locale..."
    bsdtar -xf $srcdir/waterfox-i18n-${_chosen_language}-${_i18n_ver}-0-x86_64.pkg.tar.xz -C "$pkgdir/"
    rm $pkgdir/.BUILDINFO
    rm $pkgdir/.MTREE
    rm $pkgdir/.PKGINFO  
                    break;;
                    No )
                    _download_language=no
                    _chosen_language=en-US
                    break;;
                    esac
                done

echo "Do you wish to save your choice (thanks to this, you don't have to select language again when reinstalling/updating)?"
            select yn in "Yes" "No"; do
                case $yn in
                    Yes )
mkdir $pkgdir/usr/lib/waterfox/.installer/
tee -a $pkgdir/usr/lib/waterfox/.installer/settings <<EOF
download_language=$_download_language
chosen_language=$_chosen_language
EOF
break;;
No ) break;;
                    esac
                done
fi

}