-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·66 lines (52 loc) · 1.5 KB
/
install.sh
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
#!/bin/bash
# This is an install script that can be used to install this application on linux.
URL=https://github.com/rolandbernard/marvin/releases/latest/download
ICONURL=https://github.com/raw/rolandbernard/marvin/master/static/logo.svg
DESKDIR=~/.local/share/applications
CONFDIR=~/.config/marvin/bin
LOCALDIR=~/.local/bin
BINDIR=/usr/bin
DESKTOP=${DESKDIR}/marvin.desktop
ICON=${CONFDIR}/logo.svg
SCRIPT=${CONFDIR}/marvin
MSGSCRIPT=${CONFDIR}/marvin-msg
LOCALBIN=${LOCALDIR}/marvin
MSGLOCALBIN=${LOCALDIR}/marvin-msg
BIN=${BINDIR}/marvin
MSGBIN=${BINDIR}/marvin-msg
mkdir -p ${DESKDIR}
mkdir -p ${CONFDIR}
mkdir -p ${LOCALDIR}
VERSION=$(wget -qO- ${URL}/latest-linux.yml | awk '/version/ { print $2 }')
if [ ${CONFDIR}/Marvin-*.AppImage ]
then
rm -f ${CONFDIR}/Marvin-*.AppImage
fi
wget -P ${CONFDIR} ${ICONURL}
wget -P ${CONFDIR} ${URL}/Marvin-${VERSION}.AppImage
chmod uga+x ${CONFDIR}/Marvin-${VERSION}.AppImage
rm -f ${SCRIPT}
echo -e '#!/bin/sh' "\n${CONFDIR}/Marvin-*.AppImage \$@" > ${SCRIPT}
chmod a+x ${SCRIPT}
rm -f ${MSGSCRIPT}
echo -e '#!/bin/sh' "\necho {\\\"kind\\\":\\\"\$1\\\"} | nc -U /tmp/marvin.sock" \
> ${MSGSCRIPT}
chmod a+x ${MSGSCRIPT}
echo "
[Desktop Entry]
Name=Marvin
Exec=${SCRIPT}
Terminal=false
Type=Application
Icon=${ICON}
" > ${DESKTOP}
rm -f ${LOCALBIN}
ln -s ${SCRIPT} ${LOCALBIN}
rm -f ${MSGLOCALBIN}
ln -s ${MSGSCRIPT} ${MSGLOCALBIN}
sudo /bin/sh -c "
rm -f ${BIN} ;
ln -s ${SCRIPT} ${BIN} ;
rm -f ${MSGBIN} ;
ln -s ${MSGSCRIPT} ${MSGBIN}
"