-
Notifications
You must be signed in to change notification settings - Fork 0
/
do-install
executable file
·47 lines (39 loc) · 1.16 KB
/
do-install
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
#!/bin/bash
# SPDX-License-Identifier: MIT
# Copyright (c) 2022,2023 Gene C
#
# installer script for dns_tools
# e.g. Call from PKGBUILD:
# ./do-install ${pkgdir}
# gene c (2022)
#
dest="$1"
self="dns_tools"
info="README.rst Docs packaging"
infodir="/usr/share/${self}"
etc="cron scripts conf.d"
etcdir="/etc/dns_tools"
license="Docs/License.rst"
licensedir="/usr/share/licenses/${self}"
# list apps without the ".py" or leave empty string
apps=('dns-tool dns-prod-push dns-serial-bump')
# so can make app link in /usr/bin
sitedir=$(/usr/bin/python3 -c "import site; print(site.getsitepackages()[0])")
if [ ! -d "$dest" ] ; then
echo 'Missing destination directory'
exit 1
else
/usr/bin/rsync --mkpath -a ${etc} ${dest}${etcdir}
/usr/bin/rsync --mkpath -a ${info} ${dest}${infodir}
/usr/bin/rsync --mkpath -a ${license} ${dest}/${licensedir}/
/usr/bin/python -m installer --destdir="$dest" dist/*.whl
# link(s) in /usr/bin/
if [ -v apps ] ; then
/usr/bin/mkdir -p "${dest}/usr/bin"
for app in ${apps[@]}
do
/usr/bin/ln -sf ${sitedir}/${self}/${app}.py ${dest}/usr/bin/${app}
done
fi
exit 0
fi