-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmykeys
executable file
·97 lines (88 loc) · 2.75 KB
/
mykeys
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
#!/bin/bash
USER=$(id -u -n)
MAGDIR="/usr/local/MirrorCommand"
MIRDIR="/usr/local/MagicMirror"
MCL=$HOME/src/MirrorCommand
PICDIR="/media/${USER}/Transcend/Pictures/MagicMirror"
[ -d "${PICDIR}" ] || {
PICDIR="/u/pictures/MagicMirror"
[ -d ${PICDIR} ] || {
PICDIR="/v/pictures/MagicMirror"
[ -d ${PICDIR} ] || {
echo "Cannot locate Pictures folder ${PICDIR}"
echo "Pictures folders in $MAGDIR unlinked"
}
}
}
[ -f ${MAGDIR}/etc/arp-devices.js ] && {
cp ${MAGDIR}/etc/arp-devices.js ${MAGDIR}/etc/arp-devices-inst.js
}
[ -f "${MCL}"/etc/arp-devices.js ] && {
cp "${MCL}"/etc/arp-devices.js "${MAGDIR}"/etc/arp-devices.js
}
[ -f "${MCL}"/etc/arp-devices-cols.js ] && {
cp "${MCL}"/etc/arp-devices-cols.js ${MAGDIR}/etc/arp-devices-cols.js
}
[ -f "${MCL}"/etc/arp-devices-scenes.js ] && {
cp "${MCL}"/etc/arp-devices-scenes.js ${MAGDIR}/etc/arp-devices-scenes.js
}
[ -f "${MCL}"/etc/my_mirrorkeys ] || {
echo "Cannot locate ${MCL}/etc/my_mirrorkeys"
echo "Find it and rerun this script"
exit 1
}
cp "${MCL}"/etc/my_mirrorkeys ${MAGDIR}/etc/mirrorkeys
showkeys
echo "Copying in my calendars"
CASRC="${MCL}/modules/default/calendar/calendars"
CADIR="${MIRDIR}/modules/default/calendar/calendars"
if [ -d "${CASRC}" ]; then
[ -d ${CADIR} ] || mkdir ${CADIR}
cp "${CASRC}"/* ${CADIR}
else
echo "Cannot locate calendars folder ${CASRC}"
fi
echo "Copying in Google Assistant credentials and tokens"
GASRC="${MCL}/modules/MMM-GoogleAssistant"
GADIR="${MIRDIR}/modules/MMM-GoogleAssistant"
if [ -f "${GASRC}"/credentials.json ]; then
cp "${GASRC}"/credentials.json ${GADIR}/credentials.json
else
echo "Cannot locate credentials file ${GASRC}/credentials.json"
fi
for token in "${GASRC}"/tokens/token*.json; do
if [ "${token}" == "${GASRC}/tokens/token*.json" ]; then
echo "Cannot locate Google Assistant token ${GASRC}/tokenGA.json"
else
cp "${token}" "${GADIR}"
fi
done
echo "Copying in Google Photos tokens"
GPSRC="${MCL}/modules/EXT-GooglePhotos"
GPDIR="${MIRDIR}/modules/EXT-GooglePhotos"
for token in "${GPSRC}"/token*.json; do
if [ "${token}" == "${GPSRC}/token*.json" ]; then
echo "Cannot locate Google Photos token ${GPSRC}/tokenGP.json"
else
cp "${token}" ${GPDIR}
fi
done
echo "Copying in EXT-Detector resources"
DASRC="${MCL}/modules/EXT-Detector/resources"
DADIR="${MIRDIR}/modules/EXT-Detector/resources"
[ -d ${DADIR} ] || mkdir -p ${DADIR}
[ -f ${DADIR}/google.png ] && {
[ -f ${DADIR}/google-orig.png ] || {
cp ${DADIR}/google.png ${DADIR}/google-orig.png
}
}
for res in "${DASRC}"/*; do
if [ "${res}" == "${DASRC}/*" ]; then
echo "Cannot locate EXT-Detector resources"
else
cp "${res}" ${DADIR}
fi
done
[ -f ${DADIR}/google-replace.png ] && {
cp ${DADIR}/google-replace.png ${DADIR}/google.png
}