-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
chkconfig.sh
executable file
·47 lines (46 loc) · 1.22 KB
/
chkconfig.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
#!/bin/bash
#
MMHOME=${HOME}/MagicMirror
[ -d ${MMHOME}/config ] || {
MMHOME=
for homedir in /usr/local /home/*
do
[ "${homedir}" == "/home/*" ] && continue
[ -d ${homedir}/MagicMirror/config ] && {
MMHOME="${homedir}/MagicMirror"
break
}
done
}
CONFDIR=${MMHOME}/config
[ -d ${CONFDIR} ] || {
echo "$CONFDIR does not exist or is not a directory. Exiting."
exit 1
}
cd ${CONFDIR}
if [ "$1" == "all" ]
then
current=`ls -l config.js | awk ' { print $11 } '`
echo "Saving $current MagicMirror configuration"
for config in config-*.js */config-*.js
do
[ "$config" == "config-*.js" ] && {
echo "No MagicMirror configuration files found in $CONFDIR"
continue
}
[ "$config" == "*/config-*.js" ] && {
echo "No MagicMirror configuration files found in $CONFDIR subdirs"
continue
}
rm -f config.js
ln -s ${config} config.js
echo "Checking ${config} ..."
npm run --silent config:check
echo "Done"
done
echo "Restoring $current MagicMirror configuration"
rm -f config.js
ln -s ${current} config.js
else
npm run --silent config:check
fi