Skip to content

Commit

Permalink
bring startup scripts into the common assets, so i don't have to main…
Browse files Browse the repository at this point in the history
…tain multiple of them
  • Loading branch information
corbinlc committed Dec 18, 2019
1 parent bc036be commit ec7ccd4
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
14 changes: 14 additions & 0 deletions assets/all/startSSHServer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#! /support/common/busybox_static sh

unset LD_LIBRARY_PATH

if [ ! -f /support/.ssh_setup_complete ]; then
rm -rf /etc/dropbear
mkdir /etc/dropbear
dropbearkey -t dss -s 1024 -f /etc/dropbear/dropbear_dss_host_key
dropbearkey -t rsa -s 2048 -f /etc/dropbear/dropbear_rsa_host_key
dropbearkey -t ecdsa -s 521 -f /etc/dropbear/dropbear_ecdsa_host_key
touch /support/.ssh_setup_complete
fi

dropbear -E -p 2022
15 changes: 15 additions & 0 deletions assets/all/startVNCServer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#! /support/common/busybox_static sh

unset LD_LIBRARY_PATH

if [[ -z "${INITIAL_USERNAME}" ]]; then
INITIAL_USERNAME="user"
fi

#weirdly need to reconfigure xfonts-base for armhf after extraction
if [ ! -f /support/.reconfigure_xfonts ]; then
dpkg-reconfigure xfonts-base
touch /support/.reconfigure_xfonts
fi

su $INITIAL_USERNAME -c /support/startVNCServerStep2.sh
48 changes: 48 additions & 0 deletions assets/all/startVNCServerStep2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#! /bin/bash

if [[ -z "${INITIAL_USERNAME}" ]]; then
INITIAL_USERNAME="user"
fi

if [[ -z "${INITIAL_VNC_PASSWORD}" ]]; then
INITIAL_VNC_PASSWORD="userland"
fi

if [ ! -f /home/$INITIAL_USERNAME/.vnc/passwd ]; then

prog=/usr/bin/vncpasswd

/usr/bin/expect <<EOF
spawn "$prog"
expect "Password:"
send "$INITIAL_VNC_PASSWORD\r"
expect "Verify:"
send "$INITIAL_VNC_PASSWORD\r"
expect "(y/n)?"
send "n\r"
expect eof
exit
EOF

fi

if [[ -z "${DIMENSIONS}" ]]; then
DIMENSIONS="1024x768"
fi

if [ ! -f /home/$INITIAL_USERNAME/.vncrc ]; then
vncrc_line="\$geometry = \"${DIMENSIONS}\";"
echo $vncrc_line > /home/$INITIAL_USERNAME/.vncrc
fi

rm /tmp/.X51-lock
rm /tmp/.X11-unix/X51
tightvncserver -kill :51
tightvncserver :51

while [ ! -f /home/$INITIAL_USERNAME/.vnc/localhost:51.pid ]
do
sleep 1
done
cd ~
DISPLAY=localhost:51 xterm -geometry 80x24+0+0 -e /bin/bash --login &

0 comments on commit ec7ccd4

Please sign in to comment.