summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 34d20175aea596f3e57e12e406ab95c2443058c6 (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
# Maintainer: hawkeye116477 <hawkeye116477 at gmail dot com>

pkgname=waterfox-kde-bin
pkgver=56.2.13
pkgrel=0
pkgdesc="Free, open and private browser with openSUSE's patches for better integration with KDE"
arch=('x86_64')
url="https://www.waterfox.net/"
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}-${pkgrel}-x86_64.pkg.tar.xz::https://download.opensuse.org/repositories/home:/hawkeye116477:/waterfox/Arch/x86_64/waterfox-kde-${pkgver}-${pkgrel}-x86_64.pkg.tar.xz")
sha256sums=('303daf0ddcfe7d78abc93c58220c4f3ca2e25b6a2bce02853a06414a571417a7')

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

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}-${pkgver}-${pkgrel}-x86_64.pkg.tar.xz https://download.opensuse.org/repositories/home:/hawkeye116477:/waterfox/Arch/x86_64/waterfox-i18n-${_chosen_language}-${pkgver}-${pkgrel}-x86_64.pkg.tar.xz;
	msg2 "Extracting locale..."
    bsdtar -xf $srcdir/waterfox-i18n-${_chosen_language}-${pkgver}-${pkgrel}-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}-${pkgver}-${pkgrel}-x86_64.pkg.tar.xz https://download.opensuse.org/repositories/home:/hawkeye116477:/waterfox/Arch/x86_64/waterfox-i18n-${_chosen_language}-${pkgver}-${pkgrel}-x86_64.pkg.tar.xz;
	msg2 "Extracting locale..."
    bsdtar -xf $srcdir/waterfox-i18n-${_chosen_language}-${pkgver}-${pkgrel}-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

}