Home > tech foo > Debian on Android/Atrix with Debootstrap (Part III)

Debian on Android/Atrix with Debootstrap (Part III)

As an extension to my previous post I will now explain how to make all the stuff persistent. You then do not need to retype the whole stuff to start the VNCServer every time you restart your phone. Just put the following script into the folder /etc/init.d/ of your chroot:

#!/bin/sh

export HOME=”/root”
export USER=”/root”

STARTCMD=”vncserver -geometry 960×540″
STOPCMD=”vncserver -kill :1″

case $1 in
    start)
        if [ -e /tmp/.X1-lock ]; then
            echo “VNCServer already running”
        else
            $STARTCMD
        fi
            ;;
    stop)
        $STOPCMD
        ;;
    restart)
        $STOPCMD
        $STARTCMD
        ;;
    *)
        echo “$0 start|stop|restart”
        exit 1
        ;;
esac

exit 0

Afterwards you are able to start and stop the VNCServer, with the commands

service vncserver start

and

service vncserver stop

This allows starting, stopping and restarting the server.
To actually start the server when you switch into your chroot, you have to autostart it. The following way is not best practice (don’t let a Linux guru know ;-)). But for us it is working:

echo “service vncserver start” >> /root/.bashrc

or (when you don’t want to get the “VNCServer started…” message everytime you log into your chroot)

echo “service vncserver start > /dev/null 2>&1” >> /root/.bashrc

When you call “bootdebian” in your shell, the VNCServer will automatically start and you can connect to it via your favorite VNCClient.
Have fun!

Advertisements
  1. July 24, 2012 at 4:20 pm

    nice work thanks man

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: