-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
chkinst
executable file
·98 lines (93 loc) · 2.45 KB
/
chkinst
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/bash
ROON="/usr/local/Roon"
install=
rooninst=
uptodate=1
verbose=
[ "$1" == "-i" ] && install=1
[ "$1" == "-I" ] && {
install=1
rooninst=1
}
[ "$1" == "-v" ] && verbose=1
for dir in api bin etc
do
[ -d $dir ] || {
echo "$dir does not exist or is not a directory. Skipping."
continue
}
cd $dir
HERE=`pwd`
for i in *
do
[ -f ${ROON}/$dir/$i ] || {
if [ "${install}" ]
then
echo "Installing $dir/$i"
sudo cp $i ${ROON}/$dir/$i
[ "${dir}" == "bin" ] && {
cd /usr/local/bin
sudo ln -s ${ROON}/bin/$i $i
cd ${HERE}
}
else
echo "$dir/$i not installed."
fi
uptodate=
continue
}
if [ "$dir/$i" == "bin/roon" ]
then
delta=`diff $i ${ROON}/$dir/$i | wc -l`
[ ${delta} -gt 8 ] && {
if [ "${install}" ]
then
if [ "${rooninst}" ]
then
echo "Installing $dir/$i"
echo "Edit ${ROON}/$dir/$i with 'server' and 'user'"
sudo cp $i ${ROON}/$dir/$i
else
echo "$dir/$i differs from installed version."
echo "$dir/$i must be installed manually in order"
echo "to set 'server' and 'user' appropriately."
fi
else
if [ "${verbose}" ]
then
echo "$dir/$i differs from installed version:"
echo ""
diff $i ${ROON}/$dir/$i
echo ""
else
echo "$dir/$i differs from installed version."
fi
fi
uptodate=
continue
}
else
diff $i ${ROON}/$dir/$i > /dev/null || {
if [ "${install}" ]
then
echo "Installing $dir/$i"
sudo cp $i ${ROON}/$dir/$i
else
if [ "${verbose}" ]
then
echo "$dir/$i differs from installed version:"
echo ""
diff $i ${ROON}/$dir/$i
echo ""
else
echo "$dir/$i differs from installed version."
fi
fi
uptodate=
continue
}
fi
done
cd ..
done
[ "${uptodate}" ] && echo "Roon installation up to date!"