-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup_app_icon.sh
executable file
·144 lines (121 loc) · 3.48 KB
/
setup_app_icon.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# pi hardware
USER=pi
HOST=raspberrypi.local
PORT=22
INSTALL_DIR="/home/pi/td3"
EXE="SubatomicTD3ditor"
APPNAME="Subatomic TD3"
# qemu
#USER=pi
#HOST=localhost
#PORT=2222
args=()
VERBOSE=false
################################
# scan command line args:
function usage
{
echo "$0 setup rpi $HOST"
echo "Usage: "
echo " $0 (default)"
echo " $0 --help (this help)"
echo " $0 --verbose (output verbose information)"
echo ""
}
usage
ARGC=$#
ARGV=("$@")
non_flag_args=0
non_flag_args_required=0
for ((i = 0; i < ARGC; i++)); do
if [[ $ARGC -ge 1 && ${ARGV[$i]} == "--help" ]]; then
usage
exit -1
fi
if [[ $ARGC -ge 1 && ${ARGV[$i]} == "--verbose" ]]; then
VERBOSE=true
continue
fi
if [[ $ARGC -ge 1 && ${ARGV[$i]:0:2} == "--" ]]; then
echo "Unknown option ${ARGV[$i]}"
exit -1
fi
# general non -- args
args+=("${ARGV[$i]}")
$VERBOSE && echo "Parsing Args: \"${ARGV[$i]}\""
((non_flag_args+=1))
done
# output help if they're getting it wrong...
if [ $non_flag_args_required -ne 0 ] && [[ $ARGC -eq 0 || ! $ARGC -ge $non_flag_args_required ]]; then
[ $ARGC -gt 0 ] && echo "Expected $non_flag_args_required args, but only got $ARGC"
usage
exit -1
fi
################################
echo ""
echo "We assume you have already:
- created a Raspian drive (e.g. MicroSD or USB) with setup_image_buster.sh
- setup internet sharing in SystemPreferences/Sharing/InternetSharing
- connected the drive into the Rpi
- connected the Rpi to your mac with network cable and booted it up,
allowing time for partition to resize (dont disconnect power during this!)
"
echo ""
read -p "Press enter to continue"
apt_get="sudo DEBIAN_FRONTEND=noninteractive apt-get -yq --allow-unauthenticated --allow-downgrades --allow-change-held-packages --allow-remove-essential "
apt="sudo DEBIAN_FRONTEND=noninteractive apt -yq --allow-unauthenticated --allow-downgrades --allow-change-held-packages --allow-remove-essential "
source "../vstdev/MantisSynth/rpi/common.sh"
echo ""
echo "Icon launcher for the app"
writeText2File '#!/bin/bash
PID="$(pidof $EXE)"
if [ "$PID" != "" ]; then
kill $PID
else
DISPLAY=:0.0 "$INSTALL_DIR/release/linux-armv7l-unpacked/$EXE" &
fi
' "/usr/bin/toggle-$EXE.sh"
remoteCmd "sudo chmod +x /usr/bin/toggle-$EXE.sh"
copyFile2FileAsRoot rpi-icon.png "/usr/share/pixmaps/$EXE-rpi-icon.png"
writeText2File "[Desktop Entry]
Name=Toggle $APPNAME
Comment=Toggle $APPNAME
Exec=/usr/bin/toggle-$EXE.sh
Type=Application
Icon=$EXE-rpi-icon.png
Categories=Panel;Utility;MB
X-MB-INPUT-MECHANISM=True
" "/usr/share/raspi-ui-overrides/applications/toggle-$EXE.desktop"
remoteCmd "cp /etc/xdg/lxpanel/LXDE-pi/panels/panel /home/pi/.config/lxpanel/LXDE-pi/panels/panel"
appendText2ToFile "
Plugin {
type=launchbar
Config {
Button {
id=toggle-keyboard.desktop
}
}
}
Plugin {
type=launchbar
Config {
Button {
id=toggle-$EXE.desktop
}
}
}
" "/home/pi/.config/lxpanel/LXDE-pi/panels/panel"
writeText2File "[Desktop Entry]
Name=TD3 Editor
Comment=TD3 Editor
Icon=/usr/share/pixmaps/$EXE-rpi-icon.png
Exec=$INSTALL_DIR/release/linux-armv7l-unpacked/$EXE
Type=Application
Encoding=UTF-8
Terminal=false
" "/home/pi/Desktop/$APPNAME.desktop"
remoteCmd "sudo chmod 755 'Desktop/$APPNAME.desktop'; sudo chown pi 'Desktop/$APPNAME.desktop'; sudo chgrp pi 'Desktop/$APPNAME.desktop'"
remoteCmd "/usr/bin/toggle-$EXE.sh"
# DISPLAY=:0 matchbox-keyboard &
#echo "Now, try logging in with: ssh -p$PORT $USER@$HOST"
#ssh -p$PORT $USER@$HOST