-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_nsp.linux.sh
executable file
·66 lines (53 loc) · 1.37 KB
/
install_nsp.linux.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
#!/bin/sh
# Dependency Checks
echo "Running dependency checks for installation"
DEP_ERR_MSG="must be installed before installing nsp"
BUILDABLE=true
EXE_LOCATION=/usr/local/bin/nsp
DEP_LOCATION=/usr/local/share/nsp
MAN_LOCATION=/usr/local/share/man
if test $(id -u) != 0 ; then
echo "Run as root to install"
exit 1
fi
if ! command -v nsc; then
echo "The NoSyn compiler nsc $DEP_ERR_MSG"
BUILDABLE=false
fi
if ! command -v dub; then
echo "The D Build Management System DUB $DEP_ERR_MSG"
BUILDABLE=false
fi
if ! $BUILDABLE; then
echo "Not installing due to missing dependencies"
exit 1
fi
dub build
if test -d $DEP_LOCATION; then
if test -f $EXE_LOCATION; then
printf "Would you like to reinstall nsp? [n/Y]:"
read USER_INPUT
if test "$USER_INPUT" = 'n'; then
echo "Install cancelled"
exit 1
fi
else
printf "The $DEP_LOCATION file already exists. Is it ok to overwrite this for install? [N/y]:"
read USER_INPUT
if test $USER_INPUT != 'y'; then
echo "Install cancelled"
exit 1
fi
fi
fi
rm -f $EXE_LOCATION
rm -f -r $DEP_LOCATION
rm -f $MAN_LOCATION/man1/nsp.1
cp -r ./installation_deps $DEP_LOCATION
cp ./nsp $DEP_LOCATION/nsp_compile
chmod +x $DEP_LOCATION/nsp_compile
ln -s $DEP_LOCATION/scripts/nsp_bin.sh $EXE_LOCATION
chmod +x $EXE_LOCATION
chmod +x $DEP_LOCATION/scripts/*
cp ./documents/nsp.man $MAN_LOCATION/man1/nsp.1
echo "Install complete"