forked from AsteroidOS/unofficial-watchfaces
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·81 lines (75 loc) · 2.77 KB
/
deploy.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
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
# Deploy selected Watchfaces from /unofficial-watchfaces folder
# to a connected AsteroidOS watch in Developer or ADB mode.
# Use -a for adb or no flag for scp transfer.
PS3='- Deploy watchface by entering its number -
- Refresh list with the enter key -
- Quit with any other input -'
unset options i
options[i++]="DEPLOY-ALL"
while IFS= read -r -d $'\0' f
do
options[i++]="$f"
done < <(find */ -maxdepth 0 -type d -print0 )
select opt in "${options[@]}"
do
if [ "$opt" == "DEPLOY-ALL" ]
then
for opt in "${options[@]}"
do
if [ -e $opt/usr/share/ ]
then
if [ "$1" = "-a" ]
then
adb push $opt/usr/share/* /usr/share/
else
scp -r $opt/usr/share/* root@192.168.2.15:/usr/share/
fi
fi
done
echo " "
echo "Press 'y' to restart the ceres session on the watch."
echo "Or get back to watchface selection with any other key press."
read -rsn1 input
if [ "$input" = "y" ];
then
if [ "$1" = "-a" ]
then
adb shell systemctl restart user@1000
else
ssh -t root@192.168.2.15 "systemctl restart user@1000"
fi
fi
else
if [ -e $opt/usr/share/asteroid-launcher/watchfaces ]
then
if [ "$1" = "-a" ]
then
adb push $opt/usr/share/* /usr/share/
echo " "
echo "Press 'y' to activate ${opt::-1} and restart the ceres session on the watch."
echo "Back to watchface selection with any other key press."
read -rsn1 input
if [ "$input" = "y" ];
then
printf -v cmd %q "'file:///usr/share/asteroid-launcher/watchfaces/${opt::-1}.qml'"
printf -v cmd %q "dconf write /desktop/asteroid/watchface $cmd"
adb shell "su ceres -c $cmd"
adb shell systemctl restart user@1000
fi
else
scp -r $opt/usr/share/* root@192.168.2.15:/usr/share/
echo " "
echo "Press 'y' to activate ${opt::-1} and restart the ceres session on the watch."
echo "Back to watchface selection with any other key press."
read -rsn1 input
if [ "$input" = "y" ]; then
ssh -t ceres@192.168.2.15 "dconf write /desktop/asteroid/watchface \"'file:///usr/share/asteroid-launcher/watchfaces/${opt::-1}.qml'\""
ssh -t root@192.168.2.15 "systemctl restart user@1000"
fi
fi
else
break
fi
fi
done