mirror of
https://github.com/troglobit/finit.git
synced 2026-10-12 10:12:32 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f92438d42a | ||
|
|
6afbcbdd6e | ||
|
|
b9583fb354 | ||
|
|
37af9970d4 | ||
|
|
3a7f7cd61a | ||
|
|
b11d6c6d4e | ||
|
|
88ffb9351d | ||
|
|
c70872f19e | ||
|
|
9e0b22ddb6 | ||
|
|
321264f0dc | ||
|
|
65c971925c | ||
|
|
a2de2c1591 | ||
|
|
85fedac866 | ||
|
|
29ab953a87 | ||
|
|
1843a0e66f | ||
|
|
6a8a3fd4ab | ||
|
|
d096efe643 | ||
|
|
e33d385f0c | ||
|
|
7ebc19782f | ||
|
|
4af58f8bb0 | ||
|
|
ed4abc952a | ||
|
|
52feb6f51c | ||
|
|
c7c388e567 | ||
|
|
95a70ed2af | ||
|
|
4554377e4d | ||
|
|
3811275df5 |
@@ -1,3 +1,10 @@
|
|||||||
|
0.6 ()
|
||||||
|
- don't start consolekit manually, dbus starts it (rtp)
|
||||||
|
- unmount all filesystems before rebooting
|
||||||
|
- disable USE_VAR_RUN_RESOLVCONF for Mandriva
|
||||||
|
- unset terminal type in Mandriva before running X
|
||||||
|
- remove extra sleep in finit-alt before calling services.sh (caio)
|
||||||
|
|
||||||
0.5 (20080821)
|
0.5 (20080821)
|
||||||
- add option to start dbus and consolekit before the X server
|
- add option to start dbus and consolekit before the X server
|
||||||
- finit-alt listens to /dev/initctl to work with reboot(8) (smurfy)
|
- finit-alt listens to /dev/initctl to work with reboot(8) (smurfy)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ CFLAGS = -Os -Wall -DVERSION=\"$(VERSION)\" -DWHOAMI=\"`whoami`@`hostname`\"
|
|||||||
LD = gcc
|
LD = gcc
|
||||||
LDFLAGS =
|
LDFLAGS =
|
||||||
LIBS =
|
LIBS =
|
||||||
VERSION = 0.5
|
VERSION = 0.6-pre
|
||||||
PKG = finit-$(VERSION)
|
PKG = finit-$(VERSION)
|
||||||
DFILES = Makefile README finit.c finit-mod.c finit-alt.c helpers.c helpers.h \
|
DFILES = Makefile README finit.c finit-mod.c finit-alt.c helpers.c helpers.h \
|
||||||
patches/*patch contrib/services.sh* contrib/Makefile.*
|
patches/*patch contrib/services.sh* contrib/Makefile.*
|
||||||
@@ -16,8 +16,11 @@ BINS = finit-mod finit-alt finit-mdv #finit-exb
|
|||||||
# Default user for finit-alt if not "user"
|
# Default user for finit-alt if not "user"
|
||||||
#DEFUSER = fred
|
#DEFUSER = fred
|
||||||
|
|
||||||
|
# Disable annoying gcc warning
|
||||||
|
CFLAGS += -U_FORTIFY_SOURCE
|
||||||
|
|
||||||
# Use -march=pentium-m to build for Eeepc
|
# Use -march=pentium-m to build for Eeepc
|
||||||
CFLAGS += -march=pentium-m
|
#CFLAGS += -march=pentium-m
|
||||||
|
|
||||||
# Omit the first /sbin/hwclock if CONFIG_RTC_HCTOSYS is enabled in the kernel
|
# Omit the first /sbin/hwclock if CONFIG_RTC_HCTOSYS is enabled in the kernel
|
||||||
#CFLAGS += -DNO_HCTOSYS
|
#CFLAGS += -DNO_HCTOSYS
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ CFLAGS = -Os -Wall -DVERSION=\"$(VERSION)\" -DWHOAMI=\"`whoami`@`hostname`\"
|
|||||||
LD = gcc
|
LD = gcc
|
||||||
LDFLAGS =
|
LDFLAGS =
|
||||||
LIBS =
|
LIBS =
|
||||||
VERSION = 0.5-pre
|
VERSION = 0.6-pre
|
||||||
PKG = finit-$(VERSION)
|
PKG = finit-$(VERSION)
|
||||||
DFILES = Makefile README finit.c finit-mod.c finit-alt.c helpers.c helpers.h \
|
DFILES = Makefile README finit.c finit-mod.c finit-alt.c helpers.c helpers.h \
|
||||||
patches/*patch contrib/services.sh*
|
patches/*patch contrib/services.sh*
|
||||||
|
|||||||
Executable
+44
@@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# precaution, if the hotplug tag exists in mkinitrd
|
||||||
|
killall nash-hotplug &
|
||||||
|
|
||||||
|
#give some priority to the user processes
|
||||||
|
renice -5 -u gdium
|
||||||
|
|
||||||
|
# Else oocalc will crash
|
||||||
|
mknod /dev/random c 1 8 &
|
||||||
|
mkdir /var/lock/subsys &
|
||||||
|
chmod 1777 /var/lock/subsys
|
||||||
|
mkdir /var/run/dbus &
|
||||||
|
mkdir /var/run/netreport &
|
||||||
|
mkdir /var/run/ConsoleKit &
|
||||||
|
mkdir /var/log &
|
||||||
|
/etc/init.d/haldaemon start &
|
||||||
|
|
||||||
|
sleep 25
|
||||||
|
# postpone udev and others startup, they are too slow
|
||||||
|
# limit the amount of udev childs, should speed up a little
|
||||||
|
export UDEV_MAX_CHILDS=2
|
||||||
|
export UDEV_MAX_CHILDS_RUNNING=2
|
||||||
|
/sbin/start_udev
|
||||||
|
/sbin/swapon -a &
|
||||||
|
|
||||||
|
chmod 0666 /dev/null
|
||||||
|
chmod 0666 /dev/ptmx
|
||||||
|
/etc/init.d/alsa start
|
||||||
|
/etc/init.d/network start
|
||||||
|
for module in `/bin/grep -hv '#' /etc/modprobe.preload /etc/modprobe.preload.d/*`; do
|
||||||
|
/sbin/modprobe $module
|
||||||
|
done
|
||||||
|
|
||||||
|
# restore (hopefully) the priority to the user processes
|
||||||
|
renice 0 -u gdium
|
||||||
|
|
||||||
|
# fuse status always say 0
|
||||||
|
/sbin/service fuse start
|
||||||
|
for i in /etc/rc5.d/S*; do
|
||||||
|
$i status > /dev/null 2>&1 || $i start
|
||||||
|
done
|
||||||
|
|
||||||
|
# enable this to stop bootchart when testing
|
||||||
|
(sleep 30; /sbin/bootchartd stop)&
|
||||||
+54
-91
@@ -54,12 +54,11 @@ THE SOFTWARE.
|
|||||||
#define RUNPARTS "/usr/bin/run-parts"
|
#define RUNPARTS "/usr/bin/run-parts"
|
||||||
#define REMOUNT_ROOTFS_RW
|
#define REMOUNT_ROOTFS_RW
|
||||||
#define MAKE_DEVICES
|
#define MAKE_DEVICES
|
||||||
|
#define MAKE_DEV_VCS
|
||||||
#define PAM_CONSOLE
|
#define PAM_CONSOLE
|
||||||
#define LISTEN_INITCTL
|
#define LISTEN_INITCTL
|
||||||
#define RUNLEVEL 5
|
#define RUNLEVEL 5
|
||||||
#define USE_VAR_RUN_RESOLVCONF
|
|
||||||
#define USE_MESSAGE_BUS
|
#define USE_MESSAGE_BUS
|
||||||
#define USE_CONSOLEKIT
|
|
||||||
#elif defined DIST_EEEXUBUNTU /* eeeXubuntu */
|
#elif defined DIST_EEEXUBUNTU /* eeeXubuntu */
|
||||||
#define RANDOMSEED "/var/lib/urandom/random-seed"
|
#define RANDOMSEED "/var/lib/urandom/random-seed"
|
||||||
#define SYSROOT "/sysroot"
|
#define SYSROOT "/sysroot"
|
||||||
@@ -69,7 +68,6 @@ THE SOFTWARE.
|
|||||||
#define MAKE_DEVICES
|
#define MAKE_DEVICES
|
||||||
#define TOUCH_ETC_NETWORK_RUN_IFSTATE
|
#define TOUCH_ETC_NETWORK_RUN_IFSTATE
|
||||||
#define LISTEN_INITCTL
|
#define LISTEN_INITCTL
|
||||||
#define USE_USPLASH
|
|
||||||
#else /* original Eeepc distribution */
|
#else /* original Eeepc distribution */
|
||||||
#define RANDOMSEED "/var/lib/urandom/random-seed"
|
#define RANDOMSEED "/var/lib/urandom/random-seed"
|
||||||
#define SYSROOT "/mnt"
|
#define SYSROOT "/mnt"
|
||||||
@@ -117,6 +115,8 @@ struct init_request {
|
|||||||
#define MATCH_CMD(l,c,x) \
|
#define MATCH_CMD(l,c,x) \
|
||||||
((!strncmp((l), (c), strlen((c)))) && ((x) = (l) + strlen((c))))
|
((!strncmp((l), (c), strlen((c)))) && ((x) = (l) + strlen((c))))
|
||||||
|
|
||||||
|
#define _d(x...) do { if (debug) { printf(x); printf("\n"); } } while (0)
|
||||||
|
|
||||||
#define LINE_SIZE 1024
|
#define LINE_SIZE 1024
|
||||||
#define CMD_SIZE 256
|
#define CMD_SIZE 256
|
||||||
#define USERNAME_SIZE 16
|
#define USERNAME_SIZE 16
|
||||||
@@ -126,44 +126,8 @@ void shutdown(int);
|
|||||||
void signal_handler(int);
|
void signal_handler(int);
|
||||||
void chld_handler(int);
|
void chld_handler(int);
|
||||||
|
|
||||||
#ifdef DEBUG_TIMESTAMP /* For profiling */
|
|
||||||
#include <time.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
static int debug = 1;
|
|
||||||
|
|
||||||
static struct timeval t0;
|
|
||||||
|
|
||||||
void _d(char *fmt, ...)
|
|
||||||
{
|
|
||||||
va_list ap;
|
|
||||||
struct timeval t;
|
|
||||||
int s, ms;
|
|
||||||
|
|
||||||
if (!debug)
|
|
||||||
return;
|
|
||||||
|
|
||||||
va_start(ap, fmt);
|
|
||||||
|
|
||||||
gettimeofday(&t, NULL);
|
|
||||||
|
|
||||||
s = t.tv_sec - t0.tv_sec;
|
|
||||||
ms = (t.tv_usec - t0.tv_usec) / 1000;
|
|
||||||
if (ms < 0) {
|
|
||||||
ms += 1000;
|
|
||||||
s -= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("[%d.%03d] ", s, ms);
|
|
||||||
vprintf(fmt, ap);
|
|
||||||
printf("\n");
|
|
||||||
va_end(ap);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define _d(x...) do { if (debug) { printf(x); printf("\n"); } } while (0)
|
|
||||||
static int debug = 0;
|
static int debug = 0;
|
||||||
#endif
|
static char sdown[CMD_SIZE];
|
||||||
|
|
||||||
|
|
||||||
static void build_cmd(char *cmd, char *x, int len)
|
static void build_cmd(char *cmd, char *x, int len)
|
||||||
{
|
{
|
||||||
@@ -230,12 +194,12 @@ int main()
|
|||||||
int i;
|
int i;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char line[LINE_SIZE];
|
char line[LINE_SIZE];
|
||||||
int fd;
|
|
||||||
struct sigaction sa, act;
|
struct sigaction sa, act;
|
||||||
sigset_t nmask, nmask2;
|
sigset_t nmask, nmask2;
|
||||||
char username[USERNAME_SIZE] = DEFUSER;
|
char username[USERNAME_SIZE] = DEFUSER;
|
||||||
char hostname[HOSTNAME_SIZE] = "eviltwin";
|
char hostname[HOSTNAME_SIZE] = "eviltwin";
|
||||||
char cmd[CMD_SIZE];
|
char cmd[CMD_SIZE];
|
||||||
|
char startx[CMD_SIZE] = "xinit";
|
||||||
#ifdef USE_ETC_RESOLVCONF_RUN
|
#ifdef USE_ETC_RESOLVCONF_RUN
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
struct dirent *d;
|
struct dirent *d;
|
||||||
@@ -243,17 +207,8 @@ int main()
|
|||||||
#ifdef RUNLEVEL
|
#ifdef RUNLEVEL
|
||||||
struct utmp entry;
|
struct utmp entry;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef PAM_CONSOLE
|
||||||
#ifdef DEBUG_TIMESTAMP
|
int fd;
|
||||||
gettimeofday(&t0, NULL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
puts("finit-alt " VERSION " (built " __DATE__ " " __TIME__
|
|
||||||
" by " WHOAMI ")");
|
|
||||||
|
|
||||||
#ifdef USE_USPLASH
|
|
||||||
system("usplash_write \"TEXT-URGENT finit " VERSION " (build "__DATE__ " " __TIME__ ") \"");
|
|
||||||
system("usplash_write \"PROGRESS 80\"");
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
chdir("/");
|
chdir("/");
|
||||||
@@ -283,23 +238,26 @@ int main()
|
|||||||
reboot(RB_DISABLE_CAD);
|
reboot(RB_DISABLE_CAD);
|
||||||
|
|
||||||
mount("none", "/proc", "proc", 0, NULL);
|
mount("none", "/proc", "proc", 0, NULL);
|
||||||
|
mount("none", "/sys", "sysfs", 0, NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse kernel parameters
|
* Parse kernel parameters
|
||||||
*/
|
*/
|
||||||
if ((f = fopen("/proc/cmdline", "r")) != NULL) {
|
if ((f = fopen("/proc/cmdline", "r")) != NULL) {
|
||||||
fgets(line, LINE_SIZE, f);
|
fgets(line, LINE_SIZE, f);
|
||||||
|
if ((strstr(line, "finit_debug"))) {
|
||||||
|
debug = 1;
|
||||||
|
}
|
||||||
if (strstr(line, "quiet")) {
|
if (strstr(line, "quiet")) {
|
||||||
close(0);
|
close(0);
|
||||||
close(1);
|
close(1);
|
||||||
close(2);
|
close(2);
|
||||||
}
|
}
|
||||||
if ((strstr(line, "finit_debug"))) {
|
|
||||||
debug = 1;
|
|
||||||
}
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_d("finit-alt " VERSION " (built " __DATE__ " " __TIME__ " by " WHOAMI ")");
|
||||||
|
|
||||||
setsid();
|
setsid();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -325,11 +283,21 @@ int main()
|
|||||||
build_cmd(username, x, USERNAME_SIZE);
|
build_cmd(username, x, USERNAME_SIZE);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (MATCH_CMD(line, "startx ", x)) {
|
||||||
|
*startx = 0;
|
||||||
|
build_cmd(startx, x, CMD_SIZE);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (MATCH_CMD(line, "host ", x)) {
|
if (MATCH_CMD(line, "host ", x)) {
|
||||||
*hostname = 0;
|
*hostname = 0;
|
||||||
build_cmd(hostname, x, HOSTNAME_SIZE);
|
build_cmd(hostname, x, HOSTNAME_SIZE);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (MATCH_CMD(line, "shutdown ", x)) {
|
||||||
|
*sdown = 0;
|
||||||
|
build_cmd(sdown, x, CMD_SIZE);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (MATCH_CMD(line, "module ", x)) {
|
if (MATCH_CMD(line, "module ", x)) {
|
||||||
strcpy(cmd, "/sbin/modprobe ");
|
strcpy(cmd, "/sbin/modprobe ");
|
||||||
build_cmd(cmd, x, CMD_SIZE);
|
build_cmd(cmd, x, CMD_SIZE);
|
||||||
@@ -344,13 +312,24 @@ int main()
|
|||||||
*/
|
*/
|
||||||
if (MATCH_CMD(line, "mountdev", x)) {
|
if (MATCH_CMD(line, "mountdev", x)) {
|
||||||
mount("none", "/dev", "tmpfs", 0, "mode=0755");
|
mount("none", "/dev", "tmpfs", 0, "mode=0755");
|
||||||
blkdev("/dev/sda", 0660, 8, 0);
|
chardev("/dev/null", 0666, 1, 3);
|
||||||
blkdev("/dev/sda1", 0660, 8, 1);
|
blkdev("/dev/sda1", 0660, 8, 1);
|
||||||
blkdev("/dev/sda2", 0660, 8, 2);
|
blkdev("/dev/sda2", 0660, 8, 2);
|
||||||
blkdev("/dev/sda3", 0660, 8, 3);
|
blkdev("/dev/sda3", 0660, 8, 3);
|
||||||
blkdev("/dev/sda4", 0660, 8, 4);
|
blkdev("/dev/sda4", 0660, 8, 4);
|
||||||
blkdev("/dev/sda5", 0660, 8, 5);
|
blkdev("/dev/sda5", 0660, 8, 5);
|
||||||
blkdev("/dev/sda6", 0660, 8, 6);
|
blkdev("/dev/sda6", 0660, 8, 6);
|
||||||
|
#ifdef MAKE_DEV_VCS
|
||||||
|
/* Caio reports that newer X.org needs these */
|
||||||
|
blkdev("/dev/vcs1", 0660, 7, 1);
|
||||||
|
blkdev("/dev/vcs2", 0660, 7, 2);
|
||||||
|
blkdev("/dev/vcs3", 0660, 7, 3);
|
||||||
|
blkdev("/dev/vcs4", 0660, 7, 4);
|
||||||
|
blkdev("/dev/vcsa1", 0660, 7, 129);
|
||||||
|
blkdev("/dev/vcsa2", 0660, 7, 130);
|
||||||
|
blkdev("/dev/vcsa3", 0660, 7, 131);
|
||||||
|
blkdev("/dev/vcsa4", 0660, 7, 132);
|
||||||
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* This works only if /dev is tmpfs! If not, create
|
/* This works only if /dev is tmpfs! If not, create
|
||||||
@@ -382,7 +361,6 @@ int main()
|
|||||||
mkdir("/dev/pts", 0755);
|
mkdir("/dev/pts", 0755);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mount("none", "/sys", "sysfs", 0, NULL);
|
|
||||||
mount("none", "/dev/pts", "devpts", 0, "gid=5,mode=620");
|
mount("none", "/dev/pts", "devpts", 0, "gid=5,mode=620");
|
||||||
mount("none", "/dev/shm", "tmpfs", 0, NULL);
|
mount("none", "/dev/shm", "tmpfs", 0, NULL);
|
||||||
mount("none", "/tmp", "tmpfs", 0, "mode=1777,size=128m");
|
mount("none", "/tmp", "tmpfs", 0, "mode=1777,size=128m");
|
||||||
@@ -417,15 +395,9 @@ int main()
|
|||||||
/*
|
/*
|
||||||
* Time adjustments
|
* Time adjustments
|
||||||
*/
|
*/
|
||||||
if ((fd = open("/etc/adjtime", O_CREAT|O_WRONLY|O_TRUNC, 0644)) >= 0) {
|
|
||||||
write(fd, "0.0 0 0.0\n", 10);
|
|
||||||
close(fd);
|
|
||||||
}
|
|
||||||
_d("adjust clock");
|
_d("adjust clock");
|
||||||
#ifndef NO_HCTOSYS
|
#ifndef NO_HCTOSYS
|
||||||
#ifndef DEBUG_TIMESTAMP
|
system("/sbin/hwclock --hctosys" HWCLOCK_DIRECTISA);
|
||||||
system("/sbin/hwclock --hctosys --localtime" HWCLOCK_DIRECTISA);
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -467,6 +439,7 @@ int main()
|
|||||||
endutent();
|
endutent();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_ETC_RESOLVCONF_RUN
|
||||||
touch("/etc/resolvconf/run/enable-updates");
|
touch("/etc/resolvconf/run/enable-updates");
|
||||||
|
|
||||||
chdir("/etc/resolvconf/run/interface");
|
chdir("/etc/resolvconf/run/interface");
|
||||||
@@ -476,6 +449,7 @@ int main()
|
|||||||
system(RUNPARTS " --arg=i /etc/resolvconf/update.d");
|
system(RUNPARTS " --arg=i /etc/resolvconf/update.d");
|
||||||
#endif
|
#endif
|
||||||
chdir("/");
|
chdir("/");
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef TOUCH_ETC_NETWORK_RUN_IFSTATE
|
#ifdef TOUCH_ETC_NETWORK_RUN_IFSTATE
|
||||||
touch("/etc/network/run/ifstate");
|
touch("/etc/network/run/ifstate");
|
||||||
@@ -522,10 +496,6 @@ int main()
|
|||||||
mkdir("/tmp/.ICE-unix", 01777);
|
mkdir("/tmp/.ICE-unix", 01777);
|
||||||
umask(022);
|
umask(022);
|
||||||
|
|
||||||
#ifdef USE_USPLASH
|
|
||||||
system("usplash_write \"PROGRESS 90\"");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
system(GETTY "&");
|
system(GETTY "&");
|
||||||
|
|
||||||
_d("forking");
|
_d("forking");
|
||||||
@@ -534,14 +504,12 @@ int main()
|
|||||||
|
|
||||||
vhangup();
|
vhangup();
|
||||||
|
|
||||||
#ifndef DEBUG_TIMESTAMP
|
|
||||||
close(2);
|
close(2);
|
||||||
close(1);
|
close(1);
|
||||||
close(0);
|
close(0);
|
||||||
|
|
||||||
if (open("/dev/tty1", O_RDWR) != 0)
|
if (open("/dev/tty1", O_RDWR) != 0)
|
||||||
exit(1);
|
exit(1);
|
||||||
#endif
|
|
||||||
|
|
||||||
sigemptyset(&act.sa_mask);
|
sigemptyset(&act.sa_mask);
|
||||||
act.sa_handler = SIG_DFL;
|
act.sa_handler = SIG_DFL;
|
||||||
@@ -553,46 +521,38 @@ int main()
|
|||||||
for (i = 1; i < NSIG; i++)
|
for (i = 1; i < NSIG; i++)
|
||||||
sigaction(i, &sa, NULL);
|
sigaction(i, &sa, NULL);
|
||||||
|
|
||||||
#ifndef DEBUG_TIMESTAMP
|
|
||||||
dup2(0, 0);
|
dup2(0, 0);
|
||||||
dup2(0, 1);
|
dup2(0, 1);
|
||||||
dup2(0, 2);
|
dup2(0, 2);
|
||||||
#endif
|
|
||||||
|
|
||||||
touch("/tmp/nologin");
|
|
||||||
|
|
||||||
#ifdef USE_MESSAGE_BUS
|
#ifdef USE_MESSAGE_BUS
|
||||||
_d("dbus");
|
_d("dbus");
|
||||||
mkdir("/var/run/dbus", 0755);
|
mkdir("/var/run/dbus", 0755);
|
||||||
mkdir("/var/lock/subsys/messagebus", 0755);
|
mkdir("/var/lock/subsys/messagebus", 0755);
|
||||||
system("dbus-uuidgen --ensure;dbus-daemon --system");
|
system("dbus-uuidgen --ensure;dbus-daemon --system");
|
||||||
/* dbus-daemon needs this delay, even after checking
|
|
||||||
* availability of /var/run/dbus/system_bus_socket */
|
|
||||||
usleep(500000);
|
|
||||||
#endif
|
|
||||||
#ifdef USE_CONSOLEKIT
|
|
||||||
_d("consolekit");
|
|
||||||
system("/usr/sbin/console-kit-daemon");
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LISTEN_INITCTL
|
#ifdef LISTEN_INITCTL
|
||||||
listen_initctl();
|
listen_initctl();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Prevents bash from running loadkeys */
|
||||||
|
unsetenv("TERM");
|
||||||
|
|
||||||
|
/* ConsoleKit needs this */
|
||||||
|
setenv("DISPLAY", ":0", 1);
|
||||||
|
|
||||||
while (access("/tmp/shutdown", F_OK) < 0) {
|
while (access("/tmp/shutdown", F_OK) < 0) {
|
||||||
_d("start X as %s\n", username);
|
_d("start X as %s\n", username);
|
||||||
#ifdef DEBUG_TIMESTAMP
|
|
||||||
sleep(10);
|
|
||||||
#endif
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
snprintf(line, LINE_SIZE,
|
snprintf(line, LINE_SIZE,
|
||||||
"su -c startx -l %s\n", username);
|
"su -l %s -c \"%s\"", username, startx);
|
||||||
system(line);
|
system(line);
|
||||||
system("/bin/sh");
|
system("/bin/sh");
|
||||||
} else {
|
} else {
|
||||||
snprintf(line, LINE_SIZE,
|
snprintf(line, LINE_SIZE,
|
||||||
"su -c startx -l %s\n &> /dev/null",
|
"su -l %s -c \"%s\" &> /dev/null",
|
||||||
username);
|
username, startx);
|
||||||
system(line);
|
system(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -603,7 +563,7 @@ int main()
|
|||||||
/* parent process */
|
/* parent process */
|
||||||
|
|
||||||
|
|
||||||
sleep(1);
|
/* sleep(1); */
|
||||||
system("/usr/sbin/services.sh &>/dev/null&");
|
system("/usr/sbin/services.sh &>/dev/null&");
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
@@ -619,6 +579,9 @@ int main()
|
|||||||
void shutdown(int sig)
|
void shutdown(int sig)
|
||||||
{
|
{
|
||||||
touch("/tmp/shutdown");
|
touch("/tmp/shutdown");
|
||||||
|
if (sdown) {
|
||||||
|
system(sdown);
|
||||||
|
}
|
||||||
|
|
||||||
kill(-1, SIGTERM);
|
kill(-1, SIGTERM);
|
||||||
|
|
||||||
@@ -627,14 +590,14 @@ void shutdown(int sig)
|
|||||||
sleep(2);
|
sleep(2);
|
||||||
|
|
||||||
system("/usr/sbin/alsactl store > /dev/null 2>&1");
|
system("/usr/sbin/alsactl store > /dev/null 2>&1");
|
||||||
system("/sbin/hwclock --systohc --localtime" HWCLOCK_DIRECTISA);
|
system("/sbin/hwclock --systohc" HWCLOCK_DIRECTISA);
|
||||||
|
|
||||||
kill(-1, SIGKILL);
|
kill(-1, SIGKILL);
|
||||||
|
|
||||||
sync();
|
sync();
|
||||||
sync();
|
sync();
|
||||||
system("/bin/mount -n -o remount,ro /");
|
system("/bin/umount -a;/bin/mount -n -o remount,ro /");
|
||||||
system("/sbin/unionctl.static / --remove / > /dev/null 2>&1");
|
//system("/sbin/unionctl.static / --remove / > /dev/null 2>&1");
|
||||||
|
|
||||||
if (sig == SIGINT || sig == SIGUSR1)
|
if (sig == SIGINT || sig == SIGUSR1)
|
||||||
reboot(RB_AUTOBOOT);
|
reboot(RB_AUTOBOOT);
|
||||||
|
|||||||
@@ -3,3 +3,4 @@ module intel-agp
|
|||||||
module p4-clockmod
|
module p4-clockmod
|
||||||
check /dev/sda3
|
check /dev/sda3
|
||||||
host eviltwin
|
host eviltwin
|
||||||
|
startx /usr/bin/startx
|
||||||
|
|||||||
Reference in New Issue
Block a user