aboutsummaryrefslogtreecommitdiffstats
path: root/packages/opie-init/opie-init/opie
blob: 68ac1bb59dfd8a902f7eb8342b8c6ae8a44ff17a (plain)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/sh
#
[ -z $LOGNAME ] && export LOGNAME=root && export HOME=/home/root
[ -z $HOME ] && export HOME=/home/$LOGNAME

export QTDIR=/opt/QtPalmtop
export OPIEDIR=/opt/QtPalmtop
export QPEDIR=/opt/QtPalmtop
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OPIEDIR/lib
export PATH=$PATH:$OPIEDIR/bin

if [ ! -x "$OPIEDIR/bin/qpe" ] ; then 
    echo Opie not installed
    exit 0 
fi

. /etc/profile

if [ ! -e $TSLIB_TSDEVICE ]; then
    export QWS_MOUSE_PROTO=MouseMan:/dev/input/mice
fi

for conf in $OPIEDIR/etc/skel/*.conf; do
	conf_basename=`basename $conf`
	if [ ! -e "$HOME/Settings/$conf_basename" ] ; then
		echo "Copying default $conf_basename into $HOME/Settings/"
		mkdir -p $HOME/Settings/
		cat $conf >$HOME/Settings/$conf_basename
	fi
done

if [ ! -e "$HOME/systeminfo/linkver" ] ; then
    mkdir -p $HOME/systeminfo/
    echo "1.13" >$HOME/systeminfo/linkver
fi

if [ ! -e "/opt/Qtopia" ] ; then
    ln -sf /opt/QtPalmtop /opt/Qtopia
fi

case $1 in
'start')
    #/sbin/getkey 5 "Starting Opie in 5 seconds... press key to interrupt." && exit 0

    # Turn off psplash if any - sleep is required for anti-race
    if [ -e /mnt/.psplash ]; then
        TMPDIR=/mnt/.psplash psplash-write "QUIT" || true
        sleep 1
    fi
    
    if [ -x "$OPIEDIR/bin/opie-login" ]; then
            echo Starting Opie-login....
            $OPIEDIR/bin/opie-login -terminal 3
    else
        $OPIEDIR/bin/opie-reorgfiles
        if [ -x /usr/bin/ssh-agent ]; then
             SSHAGENT=/usr/bin/ssh-agent
        else
             SSHAGENT=""
        fi
        
        if [ -x "$OPIEDIR/bin/opie-sh-ssh-askpass.sh" ]; then
            export SSH_ASKPASS=$OPIEDIR/bin/opie-sh-ssh-askpass.sh
        fi           
        echo Starting Opie....
        $SSHAGENT $OPIEDIR/bin/qpe -terminal 3
	sleep 1
	$OPIEDIR/bin/qss >/var/log/opie-qss.log 2>&1
    fi

    ;;

'stop')
    echo "Stopping Opie..."
    killall qpe 2>/dev/null
    killall opie-login 2>/dev/null
    killall quicklauncher 2>/dev/null

    ;;

'restart')
	$0 stop && $0 start

	;;

*)
    echo "usage: $0 { start | stop | restart }"

    ;;

esac