00001 #include <unistd.h>
00002 #include "fixit.h"
00003
00004 using namespace Opie::Core;
00005
00006 #ifdef FSCKED_DISTRI
00007 FixIt::FixIt() {
00008
00009 m_file = "#\n# /etc/inittab"
00010 "#"
00011 ""
00012 "# 0 - halt (Do NOT set initdefault to this)"
00013 "# 1 - Single user mode"
00014 "# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)"
00015 "# 3 - Full multiuser mode"
00016 "# 4 - JavaVM(Intent) developer mode"
00017 "# 5 - JavaVM(Intent)"
00018 "# 6 - reboot (Do NOT set initdefault to this)"
00019 "#"
00020 "id:5:initdefault:"
00021 ""
00022 "# Specify things to do when starting"
00023 "si::sysinit:/etc/rc.d/rc.sysinit"
00024 ""
00025 "l0:0:wait:/root/etc/rc.d/rc 0"
00026 "l1:1:wait:/etc/rc.d/rc 1"
00027 "l2:2:wait:/etc/rc.d/rc 2"
00028 "l3:3:wait:/etc/rc.d/rc 3"
00029 "l4:4:wait:/etc/rc.d/rc 4"
00030 "l5:5:wait:/etc/rc.d/rc 5"
00031 "l6:6:wait:/root/etc/rc.d/rc 6"
00032 ""
00033 "# Specify things to do before rebooting"
00034 "um::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1"
00035 "sw::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1"
00036 ""
00037 "# Specify program to run on ttyS0"
00038 "s0:24:respawn:/sbin/getty 9600 ttyS0"
00039 "#pd:5:respawn:/etc/sync/serialctl"
00040 ""
00041 "# Specify program to run on tty1"
00042 "1:2:respawn:/sbin/getty 9600 tty1"
00043 "ln:345:respawn:survive -l 6 /sbin/launch"
00044 "#qt:5:respawn:/sbin/qt"
00045 ""
00046 "# collie sp."
00047 "sy::respawn:/sbin/shsync\n";
00048 }
00049
00050
00051
00052
00053
00054
00055 void FixIt::fixIt() {
00056 #ifndef EAST
00057 ::rename("/etc/inittab", QPEApplication::qpeDir() + "etc/inittab" );
00058 QFile file( "/etc/inittab" );
00059 if ( file.open(IO_WriteOnly | IO_Raw ) ) {
00060 file.writeBlock(m_file,strlen(m_file) );
00061 }
00062 file.close();
00063 ::kill( SIGHUP, 1 );
00064
00065 #else
00066 setuid(0);
00067 OProcess m_kill;
00068 m_kill << QPEApplication::qpeDir() + "share/opie-console/sl6000_embedix_kill_0_1.sh";
00069
00070
00071 if ( !m_kill.start(OProcess::DontCare,OProcess::NoCommunication) ) {
00072 owarn << "could not execute kill script" << oendl;
00073 } else {
00074 Global::statusMessage( QObject::tr("Fixing up Embedix"));
00075 }
00076
00077 #endif
00078 }
00079
00080 void FixIt::breakIt() {
00081 #ifdef EAST
00082 OProcess m_restart;
00083
00084 m_restart << QPEApplication::qpeDir() + "share/opie-console/sl6000_embedix_restart_0_1.sh";
00085
00086
00087 if ( !m_restart.start(OProcess::DontCare,OProcess::NoCommunication) ) {
00088 owarn << "could not execute restart script" << oendl;
00089 }
00090
00091 #endif
00092 }
00093
00094
00095 #endif