aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorHao Zhang2021-12-26 12:01:38 -0500
committerHao Zhang2021-12-26 12:01:38 -0500
commitd217984aa053a39bb0d12479387677b1f55e5614 (patch)
treed942323954323ded73aab0355365bbcd34208ec0
parent0d5052d6e7ee7376d7170fb93166ce57a2cef21b (diff)
downloadaur-d217984aa053a39bb0d12479387677b1f55e5614.tar.gz
Dynamically resolve installation file url
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD37
2 files changed, 31 insertions, 10 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 14a339a96249..a743b41b84fc 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = fcitx-sogoupinyin
pkgdesc = Sogou Pinyin for Linux
pkgver = 3.4.0.9700
- pkgrel = 1
+ pkgrel = 2
url = https://pinyin.sogou.com/linux/
arch = x86_64
license = custom
@@ -14,8 +14,6 @@ pkgbase = fcitx-sogoupinyin
depends = qt5-svg
depends = fcitx-qt5
source = sogou-autostart
- source = https://ime.sogouimecdn.com/202112200647/7dfb7989cf723f6ef3e39e9c0c187951/dl/index/1639750479/sogoupinyin_3.4.0.9700_amd64.deb
sha256sums = 4357c28ba35d9441e47cc5c9a4c5f1ccbb8957cb3434212a609201aee485c092
- sha256sums = 0a8de6e87c1402db49869754fa08dd58c448cd44f06b73b825debe7bea27d74d
pkgname = fcitx-sogoupinyin
diff --git a/PKGBUILD b/PKGBUILD
index e6d00f836c90..6cbafad36bde 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -6,22 +6,45 @@
pkgname=fcitx-sogoupinyin
pkgver=3.4.0.9700
-pkgrel=1
+pkgrel=2
+filename=sogoupinyin_${pkgver}_amd64.deb
pkgdesc="Sogou Pinyin for Linux"
arch=("x86_64")
url="https://pinyin.sogou.com/linux/"
license=("custom")
depends=("fcitx" "opencc" "libidn11" "lsb-release" "xorg-xprop" "qt5-declarative" "qt5-svg" "fcitx-qt5")
-source=("sogou-autostart"
- "https://ime.sogouimecdn.com/202112200647/7dfb7989cf723f6ef3e39e9c0c187951/dl/index/1639750479/sogoupinyin_3.4.0.9700_amd64.deb")
-sha256sums=("4357c28ba35d9441e47cc5c9a4c5f1ccbb8957cb3434212a609201aee485c092"
- "0a8de6e87c1402db49869754fa08dd58c448cd44f06b73b825debe7bea27d74d")
+source=("sogou-autostart")
+sha256sums=("4357c28ba35d9441e47cc5c9a4c5f1ccbb8957cb3434212a609201aee485c092")
+sha256sum="0a8de6e87c1402db49869754fa08dd58c448cd44f06b73b825debe7bea27d74d"
+
+prepare(){
+ msg "Retrieving sources..."
+ if [[ -f $startdir/$filename ]]; then
+ msg2 "$(gettext "Found %s")" "$filename"
+ else
+ msg2 "$(gettext "Downloading %s...")" "$filename"
+ curl -s https://pinyin.sogou.com/linux/ | grep -o "https://.*/$filename" | xargs curl -o $startdir/$filename
+ fi
+ ln -s $startdir/$filename
+ msg "Validating source files with sha256sums..."
+ printf ' %s ... ' "$filename" >&2
+ if [[ $sha256sum = $(sha256sum $filename | cut -d' ' -f1) ]]; then
+ printf '%s\n' "$(gettext "Passed")" >&2
+ else
+ printf '%s\n' "$(gettext "FAILED")" >&2
+ error "$(gettext "One or more files did not pass the validity check!")"
+ exit 1
+ fi
+ msg "Extracting sources..."
+ msg2 "Extracting $filename with bsdtar"
+ bsdtar -xf $filename
+}
package(){
- cd ${srcdir}
+ cd $srcdir
- tar -xJvf data.tar.xz -C "${pkgdir}"
+ tar -xJvf data.tar.xz -C "$pkgdir"
mv "$pkgdir"/usr/lib/*-linux-gnu/fcitx "$pkgdir"/usr/lib/
rmdir "$pkgdir"/usr/lib/*-linux-gnu