forked from neuronalmotion/qtrpi
-
Notifications
You must be signed in to change notification settings - Fork 6
/
deploy-qtrpi.sh
executable file
·63 lines (50 loc) · 1.99 KB
/
deploy-qtrpi.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
#!/bin/bash
source ${0%/*}/utils/common.sh
OUTPUT_DIR=$ROOT/raspi/qt5pi
check_env_vars
validate_var_qtrpi_target_host
cd_root
function usage() {
cat <<EOF
Usage: $0 [options]
-h| --help Display help text.
-p| --prepare-rpi Prepare the Raspberry Pi device by:
- Installing package dependencies for Qt
- Add /usr/local/qt5pi/lib to the ldd list of directories
- Fix libEGL and libGLESv2 links
EOF
}
# Parse arguments
while [[ $# -gt 0 ]]; do
KEY="$1"
case $KEY in
-h|--help)
DISPLAY_HELP=true
;;
-p|--prepare-rpi)
PREPARE_RPI=true
;;
*)
;;
esac
shift
done
if [[ $DISPLAY_HELP ]]; then
usage
exit 0
fi
if [[ $PREPARE_RPI ]]; then
TARGET_USER=$(echo $TARGET_HOST | cut -d@ -f1)
ssh $TARGET_HOST "sudo mkdir /usr/local/qt5pi ; sudo chown -R ${TARGET_USER}:users /usr/local/qt5pi"
ssh $TARGET_HOST 'sudo apt-get install -y apt-transport-https'
ssh $TARGET_HOST 'sudo apt-get install -y libts-0.0-0 libinput5 fontconfig'
ssh $TARGET_HOST "sudo sh -c 'echo /usr/local/qt5pi/lib > /etc/ld.so.conf.d/99-qt5pi.conf'"
# to fix which version of libEGL should be picked by Qt applications (/opt/vc rather than /usr/lib/....)
ssh $TARGET_HOST "sudo sh -c 'rm /usr/lib/arm-linux-gnueabihf/libEGL.so.1.0.0 /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0'"
ssh $TARGET_HOST "sudo sh -c 'ln -sf /opt/vc/lib/libEGL.so /usr/lib/arm-linux-gnueabihf/libEGL.so.1.0.0'"
ssh $TARGET_HOST "sudo sh -c 'ln -sf /opt/vc/lib/libEGL.so /usr/lib/arm-linux-gnueabihf/libEGL.so.1'"
ssh $TARGET_HOST "sudo sh -c 'ln -sf /opt/vc/lib/libGLESv2.so /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0'"
ssh $TARGET_HOST "sudo sh -c 'ln -sf /opt/vc/lib/libGLESv2.so /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2'"
fi
rsync -avz $OUTPUT_DIR $TARGET_HOST:/usr/local/
ssh $TARGET_HOST 'sudo ldconfig'