-
Notifications
You must be signed in to change notification settings - Fork 6
/
do_install
executable file
·47 lines (41 loc) · 904 Bytes
/
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
#
# Copyright © 2015 Jesse 'Jeaye' Wilkerson
# See licensing in LICENSE file, or at:
# http://www.opensource.org/licenses/MIT
#
# File: do_install
# Author: Jesse 'Jeaye' Wilkerson
# XXX: Do not call this script directly: use `make install`
set -o errexit
set -o nounset
shopt -s globstar
if [[ $# == 0 ]];
then
echo "error: Use \`make install\` to install"
exit 1
fi
uninstall=0
if [[ $# == 1 && "$1" = "undo" ]];
then
uninstall=1
echo "Uninstalling from $installdir"
else
echo "Installing from $PWD to $installdir"
fi
mkdir -p $installdir
for file in "$PWD"/include/**/*.hpp ; do
out=$installdir/$project/$(echo "$file" | sed "s_^.*${project}/__");
if [ $uninstall -eq 1 ];
then
rm -f "$out";
else
mkdir -p $(dirname "$out")
install -m 0644 "$file" "$out";
fi
done
if [ $uninstall -eq 1 ];
then
rm -r "$installdir/$project" || true
fi
echo "Done"