-
Notifications
You must be signed in to change notification settings - Fork 1
/
install
executable file
·61 lines (50 loc) · 1.5 KB
/
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh
## Script to write in the config variables
## and copy the files to their install locations,
## using $PREFIX, $DESTDIR, $PYTHON from environment
: ${PREFIX:=/usr/local}
: ${DATADIR:=$PREFIX/share}
: ${BINDIR:=$PREFIX/bin}
: ${DBUSDIR=$DATADIR/dbus-1/services}
: ${DESTDIR:=}
: ${PYTHON:=$(which python3)}
: ${INSTALL:=install -c}
set -e
exec >&2
DBINDIR=$DESTDIR$BINDIR
DDBUSDIR=$DESTDIR$DBUSDIR
DAPPDIR=$DESTDIR$DATADIR/applications
echo "Installing:"
echo "Binary: $DBINDIR"
echo "D-Bus services: $DDBUSDIR"
echo "Using python: $PYTHON"
## Make kzrnote
TMPNAME="kzrnote.$$"
echo "#!$PYTHON" > $TMPNAME
cat "kzrnote.py" | sed '/so .\/notemode.vim/ {
r ./notemode.vim
d }' >> $TMPNAME
$INSTALL -v -D $TMPNAME "$DBINDIR/kzrnote"
rm -rf $TMPNAME
## Make the service file
SVC="io.github.kupferlauncher.kzrnote.service"
TMPNAME="$SVC.$$"
sed -e "s_@BINDIR@_${BINDIR}_" $SVC.in > $TMPNAME
$INSTALL -v -m 644 -D $TMPNAME "$DDBUSDIR/$SVC"
rm -rf $TMPNAME
## kzrnote.desktop
$INSTALL -v -m 644 -D kzrnote.desktop "$DAPPDIR/kzrnote.desktop"
## kzrnote.svg
DICONDIR=$DESTDIR$DATADIR/icons/hicolor
$INSTALL -v -m 644 -D kzrnote.svg "$DICONDIR/scalable/apps/kzrnote.svg"
trap "gtk-update-icon-cache -q -f -t $DICONDIR" EXIT
type rsvg-convert >/dev/null || { echo "Skipping png icons, no rsvg-convert"; exit 0; }
## kzrnote.png from svg
for sz in 24 48 128
do
T="kzrnote_$sz.png"
rsvg-convert -w $sz -h $sz kzrnote.svg > $T
$INSTALL -v -m 644 -D $T "$DICONDIR/${sz}x${sz}/apps/kzrnote.png"
rm -f $T
done
# vim: ft=sh