blob: 7022a9e132ce5f724fd6a0776e2ed846611ca80a (
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
|
# Maintainer: fansuregrin <quarlong@qq.com>
pkgname=cnkiexpress
_pkgname=$pkgname
pkgver=0.1.22
pkgrel=2
pkgdesc="A software for academic research articles developed by CNKI"
arch=("x86_64")
url="https://cajviewer.cnki.net"
license=('custom')
depends=('hicolor-icon-theme'
'gtk3'
'libnotify'
'nss'
'libxss'
'libxtst'
'xdg-utils'
'at-spi2-core'
'util-linux-libs'
'libappindicator-gtk3'
'libsecret')
makedepends=('sed' 'tar')
source=("https://download.cnki.net/cnkiexpress/cnkiexpress_${pkgver}_amd64.deb")
sha256sums=('e402f22c9e005882b2e97fe1622a8dead7dd82766055f1c073ce023ca2ef877f')
options=(!strip)
prepare() {
tar -xJf data.tar.xz
cd ${srcdir}/opt/${_pkgname}
# making .AppImage file executable
chmod -v +x ${_pkgname}.AppImage
# extract .AppImage file
./${_pkgname}.AppImage --appimage-extract
}
build() {
cd ${srcdir}/opt/${_pkgname}
# modifying .desktop file
sed -i -E "s|Exec=AppRun|Exec=/usr/bin/${_pkgname}|" squashfs-root/${_pkgname}.desktop
sed -i "s/Name/Name[zh_CN]/g" squashfs-root/${_pkgname}.desktop
sed -i "/Name/i\Name=CNKI Express" squashfs-root/${_pkgname}.desktop
}
package() {
cd ${srcdir}
# Copy app files
install -vdm 755 ${pkgdir}/opt/${_pkgname}/
cp -va opt/${_pkgname}/squashfs-root/* ${pkgdir}/opt/${_pkgname}
# Fix permissions
for d in locales resources Resource; do
chmod -v 755 ${pkgdir}/opt/${_pkgname}/${d}
find ${pkgdir}/opt/${_pkgname}/${d} -type d -exec chmod -v 755 {} +
done
chown root:root ${pkgdir}/opt/${_pkgname}/chrome-sandbox
chmod 4755 ${pkgdir}/opt/${_pkgname}/chrome-sandbox
# Install mime file
install -vDm 644 usr/share/mime/packages/${_pkgname}.xml -t ${pkgdir}/usr/share/mime/packages
# Link entry point
install -vdm 755 ${pkgdir}/usr/bin/
ln -vsf /opt/${_pkgname}/${_pkgname} ${pkgdir}/usr/bin/${_pkgname}
# Install LICENSE file
install -Dm644 ${pkgdir}/opt/${_pkgname}/license.txt -t ${pkgdir}/usr/share/licenses/${_pkgname}
# Copy icons files
install -vdm 755 ${pkgdir}/usr/share/icons/
find usr/share/icons -type d -exec chmod -v 755 {} +
cp -va usr/share/icons/* ${pkgdir}/usr/share/icons/
# Copy desktop file
install -vDm 644 opt/${_pkgname}/squashfs-root/${_pkgname}.desktop ${pkgdir}/usr/share/applications/${_pkgname}.desktop
# Remove unused files
rm -vrf ${pkgdir}/opt/${_pkgname}/{usr,swiftshader,AppRun,${pkgname}.{desktop,png}}
}
|