-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcopy-to-watch.sh
More file actions
executable file
·67 lines (62 loc) · 1.72 KB
/
copy-to-watch.sh
File metadata and controls
executable file
·67 lines (62 loc) · 1.72 KB
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
#!/bin/bash
# Copy content of the image folders to a connected watch in Developer or ADB mode.
function showHelp {
cat << EOF
./deploy.sh [option]
Deploy all wallpapers to AsteroidOS device. By default, uses "Developer Mode"
over ssh, but can also use "ADB Mode" using ADB.
Available options:
-h or --help prints this help screen and quits
-a or --adb uses ADB command to communicate with watch
-p or --port specifies a port to use for ssh and scp commands
-r or --remote specifies the remote (watch) name or address for ssh and scp commands
-q or --qemu communicates with QEMU emulated watch (same as -r localhost -p 2222 )
EOF
}
# These are the defaults for SSH access
WATCHPORT=22
WATCHADDR=192.168.2.15
# These are the defaults for local QEMU target
QEMUPORT=2222
QEMUADDR=localhost
# Assume no ADB unless told otherwise
ADB=false
while [[ $# -gt 0 ]] ; do
case $1 in
-a|--adb)
ADB=true
shift
;;
-q|--qemu)
WATCHPORT=${QEMUPORT}
WATCHADDR=${QEMUADDR}
shift
;;
-p|--port)
WATCHPORT="$2"
shift
shift
;;
-r|--remote)
WATCHADDR="$2"
shift
shift
;;
-h|--help)
showHelp
exit 1
;;
*)
echo "Ignoring unknown option $1"
shift
;;
esac
done
while read -r -d $'\0' dir
do
if [ "$ADB" = true ] ; then
adb push $dir* /usr/share/asteroid-launcher/wallpapers/$dir
else
scp -P"${WATCHPORT}" $dir* root@"${WATCHADDR}":/usr/share/asteroid-launcher/wallpapers/$dir
fi
done < <(find */ -maxdepth 0 -type d -print0 )