Compare commits

...
26 Commits
Author SHA1 Message Date
Claudio Matsuoka f92438d42a Add hook to call shutdown script
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2010-07-14 18:09:16 -03:00
Claudio Matsuoka 6afbcbdd6e Mount /sys earlier (modprobe modprobe might use it) (blino)
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2009-04-29 12:49:01 -03:00
Claudio Matsuoka b9583fb354 Don't set Pentium M arch by default
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2009-04-14 12:59:48 -03:00
Claudio Matsuoka 37af9970d4 Disable annoying warning caused by attribute warn_unused_result
Example:
gcc -c -Os -Wall -DVERSION=\"0.6-pre\" -DWHOAMI=\"`whoami`@`hostname`\" -march=pentium-m -DBUILTIN_RUNPARTS -o finit-mod.o finit-mod.c
finit-mod.c: In function ‘main’:
finit-mod.c:107: warning: ignoring return value of ‘chdir’, declared with attribute warn_unused_result
finit-mod.c:137: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
finit-mod.c:164: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
finit-mod.c:168: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2009-04-14 12:55:44 -03:00
Claudio Matsuoka 3a7f7cd61a Create /dev/vcsX, /dev/vcsaX when building for Mandriva (caio)
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2009-04-14 12:46:29 -03:00
Claudio Matsuoka b11d6c6d4e Make the version information a debug message (caio)
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2009-04-06 11:42:53 -03:00
Claudio Matsuoka 88ffb9351d Don't mess mess localtime/UTC setting in finit
Signed-off-by: Olivier Blin <oblin@mandriva.com>
2009-04-06 11:36:19 -03:00
Claudio Matsuoka c70872f19e Honor quiet flag in kernel command line
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-12-04 14:25:29 -02:00
Claudio Matsuoka 9e0b22ddb6 Hmm, maybe not. We'll see.
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-10-16 14:28:00 -02:00
Claudio Matsuoka 321264f0dc So hnoring quiet was important after all
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-10-16 13:51:21 -02:00
Claudio Matsuoka 65c971925c Remove usplash and nologin from Asus legacy code
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-10-10 13:03:31 -03:00
Claudio Matsuoka a2de2c1591 Add comment for DISPLAY setting
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-10-07 17:19:38 -03:00
Claudio Matsuoka 85fedac866 Set DISPLAY before invoking xinit (miura)
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-10-06 14:33:13 -03:00
Claudio Matsuoka 29ab953a87 Make startx command configurable from finit.conf
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-10-01 16:50:38 -03:00
Claudio Matsuoka 1843a0e66f Don't close descriptors on kernel "quiet" flag
(Asus legacy). Closing them prevents fsck output when booting quietly.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-09-11 16:45:19 -03:00
Claudio Matsuoka 6a8a3fd4ab Remove timestamping debug messages
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-09-04 15:24:24 -03:00
Claudio Matsuoka d096efe643 Remove extra sleep before executing services.sh
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-09-04 14:02:51 -03:00
Claudio Matsuoka e33d385f0c Update gdium makefile
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-09-03 14:41:13 -03:00
Claudio Matsuoka 7ebc19782f Update changelog
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-09-02 13:07:28 -03:00
Claudio Matsuoka 4af58f8bb0 Disable USE_VAR_RUN_RESOLVCONF for Mandriva, unset TERM
Unsetting TERM in distributions using bash as /bin/sh prevents execution
of loadkeys from bashrc when creating the user environment to run X

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-09-02 13:03:25 -03:00
Claudio Matsuoka ed4abc952a Unmount all filesystems before rebooting
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-27 17:17:26 -03:00
Claudio Matsuoka 52feb6f51c Invoke xinit directly instead of startx
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-26 19:10:09 -03:00
Claudio Matsuoka c7c388e567 Remove consolekit and superfluous 0.5s delay
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-25 15:19:34 -03:00
Claudio Matsuoka 95a70ed2af Update changelog
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-25 13:53:02 -03:00
Claudio Matsuoka 4554377e4d Don't start consolekit manually in mandriva
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-25 13:31:36 -03:00
Claudio Matsuoka 3811275df5 Post-0.5 release
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-21 15:32:55 -03:00
6 changed files with 112 additions and 94 deletions
+7
View File
@@ -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)
- add option to start dbus and consolekit before the X server
- finit-alt listens to /dev/initctl to work with reboot(8) (smurfy)
+5 -2
View File
@@ -3,7 +3,7 @@ CFLAGS = -Os -Wall -DVERSION=\"$(VERSION)\" -DWHOAMI=\"`whoami`@`hostname`\"
LD = gcc
LDFLAGS =
LIBS =
VERSION = 0.5
VERSION = 0.6-pre
PKG = finit-$(VERSION)
DFILES = Makefile README finit.c finit-mod.c finit-alt.c helpers.c helpers.h \
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"
#DEFUSER = fred
# Disable annoying gcc warning
CFLAGS += -U_FORTIFY_SOURCE
# 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
#CFLAGS += -DNO_HCTOSYS
+1 -1
View File
@@ -3,7 +3,7 @@ CFLAGS = -Os -Wall -DVERSION=\"$(VERSION)\" -DWHOAMI=\"`whoami`@`hostname`\"
LD = gcc
LDFLAGS =
LIBS =
VERSION = 0.5-pre
VERSION = 0.6-pre
PKG = finit-$(VERSION)
DFILES = Makefile README finit.c finit-mod.c finit-alt.c helpers.c helpers.h \
patches/*patch contrib/services.sh*
+44
View File
@@ -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
View File
@@ -54,12 +54,11 @@ THE SOFTWARE.
#define RUNPARTS "/usr/bin/run-parts"
#define REMOUNT_ROOTFS_RW
#define MAKE_DEVICES
#define MAKE_DEV_VCS
#define PAM_CONSOLE
#define LISTEN_INITCTL
#define RUNLEVEL 5
#define USE_VAR_RUN_RESOLVCONF
#define USE_MESSAGE_BUS
#define USE_CONSOLEKIT
#elif defined DIST_EEEXUBUNTU /* eeeXubuntu */
#define RANDOMSEED "/var/lib/urandom/random-seed"
#define SYSROOT "/sysroot"
@@ -69,7 +68,6 @@ THE SOFTWARE.
#define MAKE_DEVICES
#define TOUCH_ETC_NETWORK_RUN_IFSTATE
#define LISTEN_INITCTL
#define USE_USPLASH
#else /* original Eeepc distribution */
#define RANDOMSEED "/var/lib/urandom/random-seed"
#define SYSROOT "/mnt"
@@ -117,6 +115,8 @@ struct init_request {
#define MATCH_CMD(l,c,x) \
((!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 CMD_SIZE 256
#define USERNAME_SIZE 16
@@ -126,44 +126,8 @@ void shutdown(int);
void signal_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;
#endif
static char sdown[CMD_SIZE];
static void build_cmd(char *cmd, char *x, int len)
{
@@ -230,12 +194,12 @@ int main()
int i;
FILE *f;
char line[LINE_SIZE];
int fd;
struct sigaction sa, act;
sigset_t nmask, nmask2;
char username[USERNAME_SIZE] = DEFUSER;
char hostname[HOSTNAME_SIZE] = "eviltwin";
char cmd[CMD_SIZE];
char startx[CMD_SIZE] = "xinit";
#ifdef USE_ETC_RESOLVCONF_RUN
DIR *dir;
struct dirent *d;
@@ -243,17 +207,8 @@ int main()
#ifdef RUNLEVEL
struct utmp entry;
#endif
#ifdef DEBUG_TIMESTAMP
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\"");
#ifdef PAM_CONSOLE
int fd;
#endif
chdir("/");
@@ -283,23 +238,26 @@ int main()
reboot(RB_DISABLE_CAD);
mount("none", "/proc", "proc", 0, NULL);
mount("none", "/sys", "sysfs", 0, NULL);
/*
* Parse kernel parameters
*/
if ((f = fopen("/proc/cmdline", "r")) != NULL) {
fgets(line, LINE_SIZE, f);
if ((strstr(line, "finit_debug"))) {
debug = 1;
}
if (strstr(line, "quiet")) {
close(0);
close(1);
close(2);
}
if ((strstr(line, "finit_debug"))) {
debug = 1;
}
fclose(f);
}
_d("finit-alt " VERSION " (built " __DATE__ " " __TIME__ " by " WHOAMI ")");
setsid();
/*
@@ -325,11 +283,21 @@ int main()
build_cmd(username, x, USERNAME_SIZE);
continue;
}
if (MATCH_CMD(line, "startx ", x)) {
*startx = 0;
build_cmd(startx, x, CMD_SIZE);
continue;
}
if (MATCH_CMD(line, "host ", x)) {
*hostname = 0;
build_cmd(hostname, x, HOSTNAME_SIZE);
continue;
}
if (MATCH_CMD(line, "shutdown ", x)) {
*sdown = 0;
build_cmd(sdown, x, CMD_SIZE);
continue;
}
if (MATCH_CMD(line, "module ", x)) {
strcpy(cmd, "/sbin/modprobe ");
build_cmd(cmd, x, CMD_SIZE);
@@ -344,13 +312,24 @@ int main()
*/
if (MATCH_CMD(line, "mountdev", x)) {
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/sda2", 0660, 8, 2);
blkdev("/dev/sda3", 0660, 8, 3);
blkdev("/dev/sda4", 0660, 8, 4);
blkdev("/dev/sda5", 0660, 8, 5);
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;
}
/* This works only if /dev is tmpfs! If not, create
@@ -382,7 +361,6 @@ int main()
mkdir("/dev/pts", 0755);
#endif
mount("none", "/sys", "sysfs", 0, NULL);
mount("none", "/dev/pts", "devpts", 0, "gid=5,mode=620");
mount("none", "/dev/shm", "tmpfs", 0, NULL);
mount("none", "/tmp", "tmpfs", 0, "mode=1777,size=128m");
@@ -417,15 +395,9 @@ int main()
/*
* 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");
#ifndef NO_HCTOSYS
#ifndef DEBUG_TIMESTAMP
system("/sbin/hwclock --hctosys --localtime" HWCLOCK_DIRECTISA);
#endif
system("/sbin/hwclock --hctosys" HWCLOCK_DIRECTISA);
#endif
/*
@@ -467,6 +439,7 @@ int main()
endutent();
#endif
#ifdef USE_ETC_RESOLVCONF_RUN
touch("/etc/resolvconf/run/enable-updates");
chdir("/etc/resolvconf/run/interface");
@@ -476,6 +449,7 @@ int main()
system(RUNPARTS " --arg=i /etc/resolvconf/update.d");
#endif
chdir("/");
#endif
#ifdef TOUCH_ETC_NETWORK_RUN_IFSTATE
touch("/etc/network/run/ifstate");
@@ -522,10 +496,6 @@ int main()
mkdir("/tmp/.ICE-unix", 01777);
umask(022);
#ifdef USE_USPLASH
system("usplash_write \"PROGRESS 90\"");
#endif
system(GETTY "&");
_d("forking");
@@ -534,14 +504,12 @@ int main()
vhangup();
#ifndef DEBUG_TIMESTAMP
close(2);
close(1);
close(0);
if (open("/dev/tty1", O_RDWR) != 0)
exit(1);
#endif
sigemptyset(&act.sa_mask);
act.sa_handler = SIG_DFL;
@@ -553,46 +521,38 @@ int main()
for (i = 1; i < NSIG; i++)
sigaction(i, &sa, NULL);
#ifndef DEBUG_TIMESTAMP
dup2(0, 0);
dup2(0, 1);
dup2(0, 2);
#endif
touch("/tmp/nologin");
#ifdef USE_MESSAGE_BUS
_d("dbus");
mkdir("/var/run/dbus", 0755);
mkdir("/var/lock/subsys/messagebus", 0755);
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
#ifdef LISTEN_INITCTL
listen_initctl();
#endif
/* Prevents bash from running loadkeys */
unsetenv("TERM");
/* ConsoleKit needs this */
setenv("DISPLAY", ":0", 1);
while (access("/tmp/shutdown", F_OK) < 0) {
_d("start X as %s\n", username);
#ifdef DEBUG_TIMESTAMP
sleep(10);
#endif
if (debug) {
snprintf(line, LINE_SIZE,
"su -c startx -l %s\n", username);
"su -l %s -c \"%s\"", username, startx);
system(line);
system("/bin/sh");
} else {
snprintf(line, LINE_SIZE,
"su -c startx -l %s\n &> /dev/null",
username);
"su -l %s -c \"%s\" &> /dev/null",
username, startx);
system(line);
}
}
@@ -603,7 +563,7 @@ int main()
/* parent process */
sleep(1);
/* sleep(1); */
system("/usr/sbin/services.sh &>/dev/null&");
while (1) {
@@ -619,6 +579,9 @@ int main()
void shutdown(int sig)
{
touch("/tmp/shutdown");
if (sdown) {
system(sdown);
}
kill(-1, SIGTERM);
@@ -627,14 +590,14 @@ void shutdown(int sig)
sleep(2);
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);
sync();
sync();
system("/bin/mount -n -o remount,ro /");
system("/sbin/unionctl.static / --remove / > /dev/null 2>&1");
system("/bin/umount -a;/bin/mount -n -o remount,ro /");
//system("/sbin/unionctl.static / --remove / > /dev/null 2>&1");
if (sig == SIGINT || sig == SIGUSR1)
reboot(RB_AUTOBOOT);
+1
View File
@@ -3,3 +3,4 @@ module intel-agp
module p4-clockmod
check /dev/sda3
host eviltwin
startx /usr/bin/startx