Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script for virtual cockpit VNC client installation #273

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions Toolbox/GEM/mqb-vncClient.esd
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
###########################################################################################
#
# Custom Green Engineering Menu screen
# Author: OneB1t
# Version: 0.0.5
# Disclaimer: THIS SCREEN WILL VOID YOUR WARRANTY
#
###########################################################################################
#
# Main -> MQBCoding -> Customization -> Virtual cockpit VNC Client
#
###########################################################################################
screen VncClient Customization

keyValue
value String sys 0x00000000 0
label "This script will install VNC client to your MIB unit."
poll 0

keyValue
value String sys 0x00000000 0
label "Make sure you have an SD-card in slot 1 or 2."
poll 0

keyValue
value String sys 0x00000000 0
label ""
poll 0

script
value sys 1 0x0100 "/eso/hmi/engdefs/scripts/mqb/vncclient_install.sh"
label "Install virtual cockpit VNC client"
Binary file added Toolbox/apps/vncclient/opengl-render-qnx
Binary file not shown.
55 changes: 55 additions & 0 deletions Toolbox/scripts/vncclient_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/sh

export PATH=/proc/boot:/bin:/usr/bin:/usr/sbin:/sbin:/mnt/app/media/gracenote/bin:/mnt/app/armle/bin:/mnt/app/armle/sbin:/mnt/app/armle/usr/bin:/mnt/app/armle/usr/sbin:$PATH

if [ "$_" = "/bin/on" ]; then BASE="$0"; else BASE="$_"; fi
SCRIPTDIR=$( cd -P -- "$(dirname -- "$(command -v -- "$BASE")")" && pwd -P )

. ${SCRIPTDIR}/util_mountsd.sh
if [[ -z "$VOLUME" ]]
then
echo "No SD-card found, quitting"
exit 0
fi
VNC_APP="${VOLUME}/Toolbox/apps/vncclient"

# Make it writable
mount -uw /mnt/app
mount -uw /mnt/system

# Copy VNC binary from sd card to main unit
echo "Copying VNC client binary."
cp ${VNC_APP}/opengl-render-qnx /navigation/opengl-render-qnx

echo "Modifying startup.sh"
# Name of the file to modify
FILE="/etc/boot/startup.sh"

# Check if the block of code is already present
if ! grep -qF "# QNX VNC CLIENT" "$FILE"; then
# If not, append it after the specified section
sed -i '/# DCIVIDEO: Kombi Map/ {
N
N
N
N
a \
# QNX VNC CLIENT \
if [ -f /navigation/opengl-render-qnx ]; then \
chmod 0777 /navigation/opengl-render-qnx \
/navigation/opengl-render-qnx & \
else \
echo "File /navigation/opengl-render-qnx does not exist." \
fi
}' "$FILE"
else
echo "Block already present. Modification of startup.sh skipped."
fi

# Make readonly again
mount -ur /mnt/app
mount -ur /mnt/system

echo Done.

exit 0