Skip to content

Commit

Permalink
VNC support for not user pi Fixes #571
Browse files Browse the repository at this point in the history
  • Loading branch information
guysoft committed Nov 3, 2024
1 parent d58426a commit 7a8f438
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[Unit]
Description=VNC Server for X11
ConditionPathExists=/home/pi/.vnc/passwd
ConditionPathExists=/opt/custompios/vnc/passwd
Requires=display-manager.service

[Service]
ExecStart=/usr/bin/x11vnc -display :0 -auth guess -many -noxdamage -rfbauth /home/pi/.vnc/passwd -rfbport 5900 -shared
ExecStart=/usr/bin/x11vnc -display :0 -auth guess -many -noxdamage -rfbauth /opt/custompios/vnc/passwd -rfbport 5900 -shared
ExecStop=/usr/bin/x11vnc -R stop
Restart=on-failure
RestartSec=2

[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target
21 changes: 12 additions & 9 deletions src/modules/fullpageos/start_chroot_script
Original file line number Diff line number Diff line change
Expand Up @@ -123,36 +123,39 @@ if [ "$FULLPAGEOS_INCLUDE_X11VNC" == "yes" ]
then
apt-get install -y --force-yes x11vnc

mkdir -p /opt/custompios/vnc
chown "${BASE_USER}":"${BASE_USER}"

# Set x11vnc password
if [ "$FULLPAGEOS_OVERRIDE_PASSWORD" != "default" ]
then
sudo -u pi /opt/custompios/scripts/setX11vncPass "$FULLPAGEOS_OVERRIDE_PASSWORD"
sync
if [ ! -f /home/pi/.vnc/passwd ] || [ ! -s /home/pi/.vnc/passwd ]; then
echo "/home/pi/.vnc/passwd was not created. Trying again."
if [ ! -f /opt/custompios/vnc/passwd ] || [ ! -s /opt/custompios/vnc/passwd ]; then
echo "/opt/custompios/vnc/passwd was not created. Trying again."
sudo -u pi /opt/custompios/scripts/setX11vncPass "$FULLPAGEOS_OVERRIDE_PASSWORD"
sync
if [ ! -f /home/pi/.vnc/passwd ] || [ ! -s /home/pi/.vnc/passwd ]; then
echo "/home/pi/.vnc/passwd was not created again. Giving up."
if [ ! -f /opt/custompios/vnc/passwd ] || [ ! -s /opt/custompios/vnc/passwd ]; then
echo "/opt/custompios/vnc/passwd was not created again. Giving up."
echo "Failed to set a VNC password. Aborting build."
exit 1
fi
fi
else
sudo -u pi /opt/custompios/scripts/setX11vncPass raspberry
sync
if [ ! -f /home/pi/.vnc/passwd ] || [ ! -s /home/pi/.vnc/passwd ]; then
echo "/home/pi/.vnc/passwd was not created. Trying again."
if [ ! -f /opt/custompios/vnc/passwd ] || [ ! -s /opt/custompios/vnc/passwd ]; then
echo "/opt/custompios/vnc/passwd was not created. Trying again."
sudo -u pi /opt/custompios/scripts/setX11vncPass raspberry
sync
if [ ! -f /home/pi/.vnc/passwd ] || [ ! -s /home/pi/.vnc/passwd ]; then
echo "/home/pi/.vnc/passwd was not created again. Giving up."
if [ ! -f /opt/custompios/vnc/passwd ] || [ ! -s /opt/custompios/vnc/passwd ]; then
echo "/opt/custompios/vnc/passwd was not created again. Giving up."
echo "Failed to set a VNC password. Aborting build."
exit 1
fi
fi
fi
ls -l /home/pi/.vnc/passwd
ls -l /opt/custompios/vnc/passwd

#Enable x11vnc service
systemctl enable x11vnc.service
Expand Down

0 comments on commit 7a8f438

Please sign in to comment.