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