-rwxr-xr-x | root/etc/init.d/opie | 74 |
1 files changed, 33 insertions, 41 deletions
diff --git a/root/etc/init.d/opie b/root/etc/init.d/opie index 61de104..8151b8f 100755 --- a/root/etc/init.d/opie +++ b/root/etc/init.d/opie | |||
@@ -1,52 +1,53 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # | 2 | # |
3 | 3 | ||
4 | export LOGNAME=root | 4 | [ -z $LOGNAME ] && export LOGNAME=root |
5 | export HOME=/$LOGNAME | 5 | [ -z $HOME ] && export HOME=/$LOGNAME |
6 | |||
6 | export QTDIR=/opt/QtPalmtop | 7 | export QTDIR=/opt/QtPalmtop |
7 | export OPIEDIR=/opt/QtPalmtop | 8 | export OPIEDIR=/opt/QtPalmtop |
8 | export QPEDIR=/opt/QtPalmtop | 9 | export QPEDIR=/opt/QtPalmtop |
9 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OPIEDIR/lib | 10 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OPIEDIR/lib |
10 | export PATH=$PATH:$OPIEDIR/bin | 11 | export PATH=$PATH:$OPIEDIR/bin |
11 | 12 | ||
13 | if [ -e /proc/hal/model ] ; then | ||
14 | ipaq=`cat /proc/hal/model` | ||
15 | |||
16 | case "$ipaq" in | ||
17 | "3100" ) export QWS_DISPLAY=Transformed:Rot90:0 ;; | ||
18 | "3600" ) export QWS_DISPLAY=Transformed:Rot270:0 ;; | ||
19 | "3700" ) export QWS_DISPLAY=Transformed:Rot270:0 ;; | ||
20 | "3800" ) export QWS_DISPLAY=Transformed:Rot90:0 ;; | ||
21 | "3900" ) export QWS_DISPLAY=Transformed:Rot270:0 ;; | ||
22 | *) echo "Unknown iPAQ model: $ipaq" ;; | ||
23 | esac | ||
24 | else | ||
25 | export QWS_DISPLAY=Transformed:Rot270:0 | ||
26 | fi | ||
27 | |||
28 | |||
12 | if [ ! -x $OPIEDIR/bin/qpe ] ; then | 29 | if [ ! -x $OPIEDIR/bin/qpe ] ; then |
13 | echo Opie not installed | 30 | echo Opie not installed |
14 | exit 0 | 31 | exit 0 |
15 | fi | 32 | fi |
16 | 33 | ||
17 | $OPIEDIR/bin/opie-reorgfiles | ||
18 | |||
19 | . /etc/profile | 34 | . /etc/profile |
20 | 35 | ||
21 | killproc() { | ||
22 | pid=`/bin/ps -e | /bin/sed -n -e '/\<'$1'\>/ s/^ *\([0-9][0-9]*\).*/\1/p'` | ||
23 | [ "$pid" != "" ] && kill $pid | ||
24 | } | ||
25 | |||
26 | case $1 in | 36 | case $1 in |
27 | 'start') | 37 | 'start') |
28 | |||
29 | cd $HOME | 38 | cd $HOME |
30 | rm -f /etc/rc2.d/S99x # Can't have both running! | 39 | rm -f /etc/rc2.d/S99x # Can't have both running! |
31 | 40 | ||
32 | if [ -e /proc/hal/model ] ; then | 41 | if [ -x $OPIEDIR/bin/opie-login ]; then |
33 | 42 | if ! killall -0 syslogd 2>/dev/null >/dev/null; then | |
34 | IPAQ=`cat /proc/hal/model` | 43 | echo Starting Opie-login.... |
35 | 44 | $OPIEDIR/bin/opie-login 2>/dev/null >/dev/null & | |
36 | echo iPAQ type $IPAQ | ||
37 | case $IPAQ in | ||
38 | "3100" ) export QWS_DISPLAY=Transformed:Rot90:0 ;; | ||
39 | "3600" ) export QWS_DISPLAY=Transformed:Rot270:0 ;; | ||
40 | "3700" ) export QWS_DISPLAY=Transformed:Rot270:0 ;; | ||
41 | "3800" ) export QWS_DISPLAY=Transformed:Rot90:0 ;; | ||
42 | "3900" ) export QWS_DISPLAY=Transformed:Rot270:0 ;; | ||
43 | *) echo "Unknown processor type -`module_id`-!" ;; | ||
44 | esac | ||
45 | else | 45 | else |
46 | export QWS_DISPLAY=Transformed:Rot270:0 | 46 | echo Starting Opie-login with syslog logging..... |
47 | ( $OPIEDIR/bin/opie-login 2>&1 | logger ) & | ||
47 | fi | 48 | fi |
48 | 49 | else | |
49 | 50 | $OPIEDIR/bin/opie-reorgfiles | |
50 | if [ -x /usr/bin/ssh-agent ]; then | 51 | if [ -x /usr/bin/ssh-agent ]; then |
51 | SSHAGENT=/usr/bin/ssh-agent | 52 | SSHAGENT=/usr/bin/ssh-agent |
52 | else | 53 | else |
@@ -57,15 +58,6 @@ case $1 in | |||
57 | export SSH_ASKPASS=$OPIEDIR/bin/opie-sh-ssh-askpass.sh | 58 | export SSH_ASKPASS=$OPIEDIR/bin/opie-sh-ssh-askpass.sh |
58 | fi | 59 | fi |
59 | 60 | ||
60 | if [ -x $OPIEDIR/bin/opie-login ]; then | ||
61 | if ! killall -0 syslogd 2>/dev/null >/dev/null; then | ||
62 | echo Starting Opie-login.... | ||
63 | $SSHAGENT $OPIEDIR/bin/opie-login 2>/dev/null >/dev/null & | ||
64 | else | ||
65 | echo Starting Opie-login with syslog logging..... | ||
66 | ($SSHAGENT $OPIEDIR/bin/opie-login 2>&1 | logger ) & | ||
67 | fi | ||
68 | else | ||
69 | if ! killall -0 syslogd 2>/dev/null >/dev/null; then | 61 | if ! killall -0 syslogd 2>/dev/null >/dev/null; then |
70 | echo Starting Opie.... | 62 | echo Starting Opie.... |
71 | $SSHAGENT $OPIEDIR/bin/qpe 2>/dev/null >/dev/null & | 63 | $SSHAGENT $OPIEDIR/bin/qpe 2>/dev/null >/dev/null & |
@@ -76,18 +68,18 @@ case $1 in | |||
76 | fi | 68 | fi |
77 | 69 | ||
78 | ;; | 70 | ;; |
71 | |||
79 | 'stop') | 72 | 'stop') |
80 | echo "Killing Opie..." | 73 | echo "Killing Opie..." |
81 | if [ -f /var/run/opie.pid ]; then | 74 | killall qpe |
82 | kill -TERM `cat /var/run/opie.pid` | 75 | killall opie-login |
83 | else | ||
84 | killproc qpe | ||
85 | fi | ||
86 | 76 | ||
87 | killproc opie-login | ||
88 | ;; | 77 | ;; |
78 | |||
89 | *) | 79 | *) |
90 | echo "usage: $0 { start | stop }" | 80 | echo "usage: $0 { start | stop }" |
81 | |||
91 | ;; | 82 | ;; |
83 | |||
92 | esac | 84 | esac |
93 | 85 | ||