blob: 4c169606098ea9ad578bed44ef1e7eaf9b531093 (
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
|
#!/bin/bash
PREFIX=/usr/local
BINDIR=${PREFIX}/bin
DATADIR=${PREFIX}/share
MANDIR=${DATADIR}/man
MAN1DIR=${MANDIR}/man1
DOCDIR=${DATADIR}/doc/dotwm
EXAMPLEDIR=${DOCDIR}/examples
SYSCONFDIR=/etc
CONFIGDIR=${SYSCONFDIR}/xdg/dotwm
XSESSIONDIR=${DATADIR}/share/xsessions
fail_dependencies() {
cat <<EOF
You need to install all the dependencies.
Check www.rust-lang.org for installation instructions for rust compiler and cargo.
EOF
}
_build() {
echo Building...
if ! which rustc 2> /dev/null > /dev/null
then
fail_dependencies
fi
if ! which cargo 2> /dev/null > /dev/null
then
fail_dependencies
fi
cargo build --release
}
_install() {
echo $@
if [[ x"$1" = "x--prefix" ]]
then
PREFIX=$2
fi
echo "Base dir for installation: ${PREFIX}"
install -m 755 target/release/dotwm $BINDIR
install -m 644 dotwm.1 ${MAN1DIR}
mkdir -p ${DOCDIR}
mkdir -p ${EXAMPLEDIR}
install -m 755 autostart ${EXAMPLEDIR}
install -m 644 LICENSE ${DOCDIR}
install -m 644 README.md ${DOCDIR}
install -m 644 dotwm.desktop ${XSESSIONDIR}
}
_uninstall() {
rm $BINDIR/dotwm
rm ${EXAMPLEDIR}/autostart
rm ${MAN1DIR}/dotwm.1
rm -r ${DOCDIR}
rm ${XSESSIONDIR}/dotwm.desktop
}
base=$1
shift
case $base in
build)
_build
;;
install)
_install $@
;;
uninstall)
_uninstall $@
;;
*)
_build
_install $@
;;
esac
|