-
Notifications
You must be signed in to change notification settings - Fork 12
/
install.sh
executable file
·68 lines (60 loc) · 1.22 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
66
67
#!/bin/sh
[ -z "$PREFIX" ] && PREFIX=/usr/local
[ -z "$LIBEXEC" ] && LIBEXEC=$PREFIX/libexec
BIN=$PREFIX/bin
BINS="minc marten polecat"
LIBS="libexec/*"
TOPDIR=$(cd $(dirname $0); pwd)
. libexec/minc-dens
UNINSTALL=
case "$1" in
--stop-mincbr)
rmmincbr
exit 0
;;
-u|--uninstall)
rmmincbr ||:
UNINSTALL=yes
;;
--ermine) # install ermine
echo "Build ermine and install"
$TOPDIR/ermine-breeder
;;
--minimum)
BINS=minc
LIBS="libexec/minc-exec libexec/minc-core libexec/minc-coat libexec/minc-leash libexec/minc-cage"
;;
-h|--help)
echo "Install script for MINCS"
echo "Usage: $0 [-u|--uninstall|--ermine|--minimum|--stop-mincbr]"
exit 0
;;
esac
uninstall() {
echo "Uninstall $1 from $2"
rm -rf $2
}
modify_install() { # bin target
echo "Install $1 into $2"
mkdir -p `dirname $2`
if [ -d $1 ];then
cp -r $1 `dirname $2`
return
fi
cat $1 | sed -e 's%^LIBEXEC=.*$%LIBEXEC='$LIBEXEC%g > $2
chmod 755 $2
}
for i in $BINS; do
if [ "$UNINSTALL" ]; then
uninstall $i $BIN/$i
else
modify_install $i $BIN/$i
fi
done
for i in $LIBS; do
if [ "$UNINSTALL" ]; then
uninstall $i $PREFIX/$i
else
modify_install $i $PREFIX/$i
fi
done