Diffstat (limited to 'noncore/apps/opie-console/main.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/main.cpp | 102 |
1 files changed, 101 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/main.cpp b/noncore/apps/opie-console/main.cpp index 350bb3e..78a91a2 100644 --- a/noncore/apps/opie-console/main.cpp +++ b/noncore/apps/opie-console/main.cpp | |||
@@ -1 +1,9 @@ | |||
1 | #include <sys/types.h> | ||
2 | |||
3 | #include <stdio.h> | ||
4 | #include <stdlib.h> | ||
5 | #include <signal.h> | ||
6 | |||
7 | #include <qfile.h> | ||
8 | |||
1 | #include <qpe/qpeapplication.h> | 9 | #include <qpe/qpeapplication.h> |
@@ -4,2 +12,82 @@ | |||
4 | 12 | ||
13 | //#define FSCKED_DISTRIBUTION 1 | ||
14 | #ifdef FSCKED_DISTRIBUTION | ||
15 | /* | ||
16 | * The Zaurus rom | ||
17 | */ | ||
18 | class FixIt { | ||
19 | public: | ||
20 | FixIt(); | ||
21 | ~FixIt(); | ||
22 | void fixIt(); | ||
23 | /* no real interested in implementing it */ | ||
24 | void breakIt() { | ||
25 | |||
26 | }; | ||
27 | char* m_file; | ||
28 | }; | ||
29 | |||
30 | FixIt::FixIt() { | ||
31 | /* the new inittab */ | ||
32 | m_file = "#\n# /etc/inittab | ||
33 | # | ||
34 | |||
35 | # 0 - halt (Do NOT set initdefault to this) | ||
36 | # 1 - Single user mode | ||
37 | # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) | ||
38 | # 3 - Full multiuser mode | ||
39 | # 4 - JavaVM(Intent) developer mode | ||
40 | # 5 - JavaVM(Intent) | ||
41 | # 6 - reboot (Do NOT set initdefault to this) | ||
42 | # | ||
43 | id:5:initdefault: | ||
44 | |||
45 | # Specify things to do when starting | ||
46 | si::sysinit:/etc/rc.d/rc.sysinit | ||
47 | |||
48 | l0:0:wait:/root/etc/rc.d/rc 0 | ||
49 | l1:1:wait:/etc/rc.d/rc 1 | ||
50 | l2:2:wait:/etc/rc.d/rc 2 | ||
51 | l3:3:wait:/etc/rc.d/rc 3 | ||
52 | l4:4:wait:/etc/rc.d/rc 4 | ||
53 | l5:5:wait:/etc/rc.d/rc 5 | ||
54 | l6:6:wait:/root/etc/rc.d/rc 6 | ||
55 | |||
56 | # Specify things to do before rebooting | ||
57 | um::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1 | ||
58 | sw::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1 | ||
59 | |||
60 | # Specify program to run on ttyS0 | ||
61 | s0:24:respawn:/sbin/getty 9600 ttyS0 | ||
62 | #pd:5:respawn:/etc/sync/serialctl | ||
63 | |||
64 | # Specify program to run on tty1 | ||
65 | 1:2:respawn:/sbin/getty 9600 tty1 | ||
66 | ln:345:respawn:survive -l 6 /sbin/launch | ||
67 | #qt:5:respawn:/sbin/qt | ||
68 | |||
69 | # collie sp. | ||
70 | sy::respawn:/sbin/shsync\n"; | ||
71 | |||
72 | |||
73 | } | ||
74 | FixIt::~FixIt() { | ||
75 | } | ||
76 | /* | ||
77 | * the retail Zaurus is broken in many ways | ||
78 | * one is that pppd is listening on our port... | ||
79 | * we've to stop it from that and then do kill(SIGHUP,1); | ||
80 | */ | ||
81 | void FixIt::fixIt() { | ||
82 | ::rename("/etc/inittab", QPEApplication::qpeDir() + "/etc/inittab" ); | ||
83 | QFile file( "/etc/inittab" ); | ||
84 | if ( file.open(IO_WriteOnly | IO_Raw ) ) { | ||
85 | file.writeBlock(m_file,strlen(m_file) ); | ||
86 | } | ||
87 | file.close(); | ||
88 | ::kill( SIGHUP, 1 ); | ||
89 | } | ||
90 | #endif | ||
91 | |||
92 | |||
5 | int main(int argc, char **argv) { | 93 | int main(int argc, char **argv) { |
@@ -7,2 +95,8 @@ int main(int argc, char **argv) { | |||
7 | 95 | ||
96 | #ifdef FSCKED_DISTRIBUTION | ||
97 | qWarning("fscked"); | ||
98 | FixIt it; | ||
99 | it.fixIt(); | ||
100 | #endif | ||
101 | |||
8 | MainWindow mw; | 102 | MainWindow mw; |
@@ -11,3 +105,9 @@ int main(int argc, char **argv) { | |||
11 | 105 | ||
12 | return app.exec(); | 106 | int ap = app.exec(); |
107 | |||
108 | #ifdef FSCKED_DISTRIBUTION | ||
109 | /* should add a signal handler too */ | ||
110 | it.breakIt(); | ||
111 | #endif | ||
112 | return ap; | ||
13 | } | 113 | } |