Compare commits

...
143 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
Claudio Matsuoka 7360ef1f08 Fix distribution filelist
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-21 15:31:38 -03:00
Claudio Matsuoka 529224153f Update docs for 0.5
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-21 15:30:34 -03:00
Claudio Matsuoka 0f8393ef0e Start dbus directly instead of calling initscript
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-20 13:13:10 -03:00
Claudio Matsuoka a1d7e48225 Improve profiling messages
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-19 15:11:47 -03:00
Claudio Matsuoka 938773765c Add some profiling aids
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-19 13:58:19 -03:00
Claudio Matsuoka 367049a11c Set time value before using it!
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-19 13:41:16 -03:00
Claudio Matsuoka efcdc141c8 Use relative timestamp
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-19 13:25:10 -03:00
Claudio Matsuoka dfed328d47 Timestamp fixes
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-19 10:27:42 -03:00
Claudio Matsuoka 804aa3c747 Add timestamps to debug messages to help profiling
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-19 10:25:42 -03:00
Claudio Matsuoka 3ce7638dab Update changelog
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-15 19:08:39 -03:00
Claudio Matsuoka b0746f5220 Add bloat for gnome-volume-manager: start dbus and consolekit
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-15 18:59:49 -03:00
Claudio Matsuoka c324eff01a New README with better SNR
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-13 15:56:59 -03:00
Claudio Matsuoka a6f534621c Fix filesystem initialization order
Fsck filesystems before mounting root as read-write. Mountdev and
device creation can stay there because they're tmpfs.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-13 13:14:33 -03:00
Claudio Matsuoka b0e3dbc47f Add .gitignore
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-12 18:01:44 -03:00
Claudio Matsuoka 220b2c9ae3 Create basic device nodes when mounting /dev as tmpfs
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-12 18:00:37 -03:00
Claudio Matsuoka 173853ca17 finit.conf commands accepts multiple parameters
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-11 19:02:55 -03:00
Claudio Matsuoka 9f83bbe788 Allow creation of device nodes from configuration file
Using command "mknod", same syntax as mknod(1)

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-11 18:03:52 -03:00
Claudio Matsuoka a187b88dd9 Final changes to boot Guillemot
- call shutdown() directly instead of raising signal
- use blino's sanity check for /dev/null

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-07-04 17:24:25 -03:00
Claudio Matsuoka 134d9f3463 Mount /dev as tmpfs before creating directories inside
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-06-27 08:56:47 -03:00
Claudio Matsuoka 25e9d84673 Add experimental mountdev option
If "mountdev" is specified in /etc/finit.conf, finit-alt will try
to mount tmpfs on /dev prior to creating device nodes.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-06-25 19:10:36 -03:00
Claudio Matsuoka 765bef0991 Don't fix /dev/null permissions if it fails in creation
By doing so we'll be masking a symptom of the problem instead of fixing
it. If permissions of /dev/null fail, most likely other problems will
also happen (e.g. pts permissions). Keep /dev/null alarm (which leads
to X server starting problems) to alert us if something is wrong.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-06-18 11:39:38 -03:00
Claudio Matsuoka 7d10388158 Conditional build of /etc/resolveconf/run support
Xandros actually uses it.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-06-18 11:34:52 -03:00
Claudio Matsuoka a0382dfab8 Keep /etc/resolveconf/run code commented until we check Xandros
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-06-13 20:31:49 -03:00
Claudio Matsuoka ead2eb7076 Merge branch 'master' of claudio@git.mandriva.com:/people/blino/finit 2008-06-13 20:15:21 -03:00
Claudio Matsuoka 0f2a14bf4f Remove old code to load AGP drivers
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-06-13 19:58:31 -03:00
Claudio Matsuoka 4e8be438e9 Use smurfy's /dev/initctl handler
If we handle it using pselect() in the parent process we'll end up
with a lot of zombie processes because SIGCHLD is not handled correctly.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-06-13 19:55:34 -03:00
Olivier Blin 2f3404165f make sure /dev/null is world-writable 2008-06-06 18:35:44 +02:00
Olivier Blin ca9ee99f59 create resolv.conf symlink in /var 2008-06-06 17:52:00 +02:00
Olivier Blin 0ab62c8871 create /var/run/resolvconf/interface 2008-06-06 17:52:00 +02:00
Olivier Blin efdac3fc2d remove useless /etc/resolvconfig/run clean, it's a symlink to /var/run which is tmpfs 2008-06-06 17:52:00 +02:00
Olivier Blin c127735e2d do not create useless resolvconf and network dirs in /dev/shm 2008-06-06 17:51:53 +02:00
Olivier Blin d621b0ba15 include limits.h for INT_MAX 2008-06-06 17:42:26 +02:00
Claudio Matsuoka 33469873a5 Don't build vanilla finit
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-06-02 18:20:03 -03:00
Claudio Matsuoka 36043c04f9 Fix permission of utmp
Also remove other redundant or seemingly unneeded permission settings

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-06-02 17:28:31 -03:00
Claudio Matsuoka ec10fecd8d Add pterjan's services.sh
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-06-02 17:28:16 -03:00
Claudio Matsuoka 0fc7654a83 Set owner of /var/run/utmp to root:utmp
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-06-02 17:22:35 -03:00
Claudio Matsuoka ba9c897e83 Ajusted options for eeeXubuntu
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-31 16:28:19 -03:00
Claudio Matsuoka 4948844f82 Merged usplash support from smurfy's port
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-31 10:56:40 -03:00
Claudio Matsuoka 9f99f38561 Initial eeeXubuntu port merged from smurfy's port
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-31 10:43:43 -03:00
Claudio Matsuoka f516108ca6 Merge branch 'master' of cmatsuoka@helllabs.org:git/eeepc 2008-05-29 11:13:44 -03:00
Claudio Matsuoka 04b91da9f9 Remove unused variables
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-28 19:24:18 -03:00
Claudio Matsuoka f94504ad96 Write runlevel to utmp
This is needed by Printerdrake (by Pascal Terjan)

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-28 12:51:30 -03:00
Claudio Matsuoka 698c5a1852 Changelog updates
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-27 16:45:20 -03:00
Claudio Matsuoka d5037d1352 Finit-alt listens to /dev/initctl
This allows us to use the standard reboot utility in Linux to perform
a fast reboot.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-27 16:29:34 -03:00
Claudio Matsuoka 57ad91136b Build finit-alt from finit-alt.c
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-26 20:09:25 -03:00
Claudio Matsuoka 9488e65998 Merge branch 'master' of cmatsuoka@helllabs.org:git/eeepc 2008-05-18 22:36:50 -03:00
Claudio Matsuoka 19540d148e Cosmetic coding style fix
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-18 22:36:21 -03:00
Claudio Matsuoka df14fd5255 Post-0.4
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-16 16:23:19 -03:00
Claudio Matsuoka 821a6853fe Version 0.4
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-16 16:20:29 -03:00
Claudio Matsuoka dbdf8ccc72 Merge branch 'master' of cmatsuoka@helllabs.org:git/eeepc 2008-05-16 10:54:27 -03:00
Claudio Matsuoka b2f143e623 Rollback removal of /dev/tty0 creation
This is need by xorg to start

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-16 10:53:13 -03:00
Claudio Matsuoka 2ffafc3d03 More robust command line parsing
Allow multiple spaces or tabs between keyword and argument, also set
hostname only once.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-16 09:19:29 -03:00
Claudio Matsuoka 3158733ced Update example services script
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-15 18:36:39 -03:00
Claudio Matsuoka 1aa6358611 Mount "none" as pseudo filesystems
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-15 18:27:55 -03:00
root ce998373e5 Merge branch 'master' of cmatsuoka@helllabs.org:git/eeepc 2008-05-15 20:39:59 -03:00
root d0b6457f01 Better string matching
Signed-off-by: root <root@eviltwin.(none)>
2008-05-15 20:32:51 -03:00
root 349593d41b Configure hostname from finit.conf
Signed-off-by: root <root@test.(none)>
2008-05-15 17:47:14 -03:00
Claudio Matsuoka b8daa9c869 Documentation update
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-15 17:39:01 -03:00
root f21b0a2580 Open terminal in VT2 using openvt(1)
Signed-off-by: root <root@test.(none)>
2008-05-15 17:37:51 -03:00
Claudio Matsuoka 4e18bc3724 Fix module name in finit.conf example
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-14 17:33:22 -03:00
Claudio Matsuoka 90c8c73470 Fix fsck options (hopefully)
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-14 13:31:53 -03:00
Claudio Matsuoka c8e7b34b4c Move conffile parsing to proper function
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-08 11:46:21 -03:00
Claudio Matsuoka 6ff7f2e52b Create tty0
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-05 16:06:40 -03:00
Claudio Matsuoka b6bf00ed06 *sigh*
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-05 16:00:28 -03:00
Claudio Matsuoka 136dfeb41a And I mean it!
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-05 15:55:20 -03:00
Claudio Matsuoka 7867db7b23 And do it right this time
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-05 15:34:21 -03:00
Claudio Matsuoka 75d755afad Chomp trailing LF in line from conf file
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-05 15:24:01 -03:00
Claudio Matsuoka 01509376cc Don't reboot automatically after fsck
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-05 14:51:23 -03:00
Claudio Matsuoka c55afaadb3 User, modules and checkfs configurable from /etc/finit.conf
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-05 13:41:01 -03:00
Claudio Matsuoka ccd49f2024 Dynamic username setting
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-02 17:33:32 -03:00
Claudio Matsuoka 0fdf97653f Document kernel command line parameters
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-02 15:35:51 -03:00
Claudio Matsuoka 9d164ac312 Enable runtime debug in finit-alt if DEBUG parameter is specified
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-02 15:34:13 -03:00
Claudio Matsuoka 5acd2cd441 Don't force fsck every time.
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-04-29 15:19:14 -03:00
Claudio Matsuoka 1f7eab37a0 Erm. Fix wrong string size in strncpy.
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-04-24 16:15:01 -03:00
Claudio Matsuoka d87fb47cf3 finit-mdv checks filesystem if CHECKFS= parameter specified
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-04-24 16:05:46 -03:00
Claudio Matsuoka 7caf633259 Mount /proc/bus/usb
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-04-24 13:55:45 -03:00
Claudio Matsuoka ba6470f5a6 Update documentation
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-04-18 17:20:51 -03:00
Claudio Matsuoka fa23155593 Change console.lock path to /var/run/console/
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-04-18 17:16:50 -03:00
Claudio Matsuoka 996cb2ec1e Merge branch 'master' of cmatsuoka@helllabs.org:git/eeepc
Conflicts:

	Changelog
	finit-mod.c

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-04-18 16:03:21 -03:00
Claudio Matsuoka 4e3d6ec976 Handle pam_console permissions in finit-alt for Mandriva
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-04-18 16:01:11 -03:00
Claudio Matsuoka 0857a0846f Ignore signal instead of setting to an empty handler
As suggested by Metalshark

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-04-18 15:48:15 -03:00
Claudio Matsuoka a3ad99798e Don't mount dev as tmpfs
Otherwise we won't be able to mount stuff

Signed-off-by: Claudio Matsuoka <claudio@frohike.(none)>
2008-03-20 05:12:58 -03:00
Claudio Matsuoka c79b823f17 Fix default user setting in Makefile
Otherwise the default user name is set to the name of the current user

Signed-off-by: Claudio Matsuoka <claudio@frohike.(none)>
2008-03-20 05:10:07 -03:00
Claudio Matsuoka 71ce4b98e9 Minor documentation updates
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-18 16:38:08 -03:00
Claudio Matsuoka 9908a6e680 Documentaion update
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-18 16:24:40 -03:00
Claudio Matsuoka f94a76ed17 Minor documentation updates
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-17 12:29:47 -03:00
Claudio Matsuoka 6fc2a6b108 Add KDE dbus note
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-16 18:37:07 -03:00
Claudio Matsuoka a52c932085 Cosmetic changes
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-16 18:03:23 -03:00
Claudio Matsuoka 2e7952645a Make it like the original
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-16 17:56:05 -03:00
Claudio Matsuoka 494f182b13 Minor fixes, updated comments
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-16 17:17:17 -03:00
Claudio Matsuoka 5ad9ff48c5 Use macro for line size, reuse line buffer for hostname and filename
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-16 17:07:14 -03:00
Claudio Matsuoka b5e2af21a6 Add example services.sh for Mandriva 2008 running KDE
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-16 16:06:38 -03:00
Claudio Matsuoka eb5445628f Mount /dev as tmpfs in finit-alt if MAKE_DEVICES is set
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-16 15:45:03 -03:00
Claudio Matsuoka 89854a579f Add nash-plugin patch, move Mandriva specifics to its own README file
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-16 13:57:22 -03:00
Claudio Matsuoka 1c88ae1f61 Run-parts code cleanup and minor fixes
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-16 12:47:37 -03:00
Claudio Matsuoka f972ff4d30 /usr on squashfs must be mounted after creation of loop0
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-15 15:39:14 -03:00
Claudio Matsuoka 904c12d06a Add a contrib directory
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-15 14:37:46 -03:00
Claudio Matsuoka a85b0cf481 Remove USE_SQUASHFS hack
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-15 14:33:54 -03:00
Claudio Matsuoka 286711237d Fixed run-parts bug
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-15 14:31:34 -03:00
Claudio Matsuoka 434ec4c533 Add option to use built-in run-parts instead of /bin/run-parts
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-15 10:34:05 -03:00
Claudio Matsuoka 6371f82fea Always use /bin/run-parts in Mandriva with squashfs
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-14 17:36:26 -03:00
Claudio Matsuoka b2233a6f4b Merge branch 'master' of cmatsuoka@helllabs.org:git/eeepc 2008-03-14 16:44:24 -03:00
Claudio Matsuoka 6c807c3a95 Add a run-parts implementation, not sure if really needed
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-14 16:43:59 -03:00
Claudio Matsuoka e4f675fa1a Create loopback device in finit-alt (for squashfs)
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-14 14:16:29 -03:00
Claudio Matsuoka 880b5f8a92 Reboot/poweroff documentation update
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-11 09:09:07 -03:00
Claudio Matsuoka c8f171556b Rollback previous finit-alt initctl patch, not really needed.
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-10 19:14:26 -03:00
Claudio Matsuoka 2a9bfa7fd7 Default user for finit-alt configurable from Makefile
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-10 17:41:11 -03:00
Claudio Matsuoka 98624a3d21 Create initctl fifo in finit-alt
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-10 17:12:40 -03:00
Claudio Matsuoka 6565cc67ee Update version information to post-0.3
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-23 08:55:12 -03:00
Claudio Matsuoka 08d0dc6ee9 Disable debug
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-23 08:50:19 -03:00
Claudio Matsuoka 6e2ea43e97 Changelog updated
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-22 20:19:50 -03:00
Claudio Matsuoka 2679c1b1c5 Mount /var/lock and /var/run as tmpfs
Also create /var/run/console/<user> for X authentication

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-22 18:02:45 -03:00
Claudio Matsuoka d05900368f Fix string termination in path creation
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-22 18:00:48 -03:00
Claudio Matsuoka a1de36c163 Add note about default user in documentation
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-21 19:20:31 -03:00
Claudio Matsuoka 8206803762 Remove duplicate unionctl() error in initial reimplementation
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-21 14:09:32 -03:00
Claudio Matsuoka fb8c341168 Change poweroff method to reboot(RB_POWER_OFF) (Metalshark)
Metalshark says:
February 19th, 2008 at 9:10 pm

There is an issue with some ACPI/Kernel combinations to do with shutdown.

It isn’t always powering off (tried /proc/acpi and /sys methods) - however
removing all the fd > 5 stuff and putting in the simple line
“reboot(RB_POWER_OFF);” worked for all thus far. Although semantically
incorrect it is a working solution.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-21 09:43:35 -03:00
Claudio Matsuoka 7137573534 Post-0.2 adjustments
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-19 20:24:33 -03:00
17 changed files with 815 additions and 214 deletions
+2
View File
@@ -0,0 +1,2 @@
*.o
*.gz
+34 -1
View File
@@ -1,5 +1,38 @@
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.2 ()
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)
- write runlevel to utmp, needed by Printerdrake (Pascal Terjan)
- fix ownership of /var/run/utmp (reported by Pascal Terjan)
- remove obsolete code to load AGP drivers
- conditional build of /etc/resolveconf/run support
- add support to /var/run/resolvconf in Mandriva (blino)
O.4 (20080516)
- default username for finit-alt configurable in Makefile
- create loopback device node in finit-alt (for squashfs)
- add option to use built-in run-parts instead of /bin/run-parts
- ignore signal instead of setting to an empty handler (Metalshark)
- handle pam_console permissions in finit-alt for Mandriva
- add services.sh example and nash-hotplug patch for Mandriva
- mount /proc/bus/usb in Mandriva
- add runtime debug to finit-alt if finit_debug parameter is specified
- read configuration from /etc/finit.conf
- run getty with openvt on the virtual terminal
0.3 (20080223)
- Change poweroff method to reboot(RB_POWER_OFF) (Metalshark)
- Remove duplicate unionctl() reimplementation error
- Fix string termination in path creation
- Mount /var/lock and /var/run as tmpfs
0.2 (20080219)
- replace system("touch") with touch() in finit-mod (Metalshark)
- disable NO_HCTOSYS by default to match stock Eeepc kernel
- drop system("rm -f") to clean /tmp, its a fresh mounted tmpfs
+38 -11
View File
@@ -3,35 +3,48 @@ CFLAGS = -Os -Wall -DVERSION=\"$(VERSION)\" -DWHOAMI=\"`whoami`@`hostname`\"
LD = gcc
LDFLAGS =
LIBS =
VERSION = 0.2
VERSION = 0.6-pre
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.*
BINS = finit-mod finit-alt finit-mdv #finit-exb
#### Configurable parameters
# Add -DDEBUG to build with debug messages, also drops to terminal after X
#CFLAGS += -DDEBUG
# Default user for finit-alt if not "user"
#DEFUSER = fred
# Parameters added by Metalshark
# 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
# Append –directisa to /sbin/hwclock lines if the user has disabled
# Append -directisa to /sbin/hwclock lines if the user has disabled
# CONFIG_GENRTC and enabled CONFIG_RTC but not enabled CONFIG_HPET_TIMER
# and CONFIG_HPET_RTC_IRQ.
#CFLAGS += -DDIRECTISA
# Use built-in run-parts instead of /bin/run-parts
CFLAGS += -DBUILTIN_RUNPARTS
#### End of configurable parameters
ifneq ($(DEFUSER),)
CFLAGS += -DDEFUSER=\"$(DEFUSER)\"
endif
.c.o:
$(CC) -c $(CFLAGS) -o $*.o $<
all: finit finit-mod finit-mdv
all: $(BINS)
finit: finit.o
$(LD) $(LDFLAGS) -o $@ $+ $(LIBS)
@@ -41,6 +54,10 @@ finit-mod: finit-mod.o helpers.o
$(LD) $(LDFLAGS) -o $@ $+ $(LIBS)
strip $@
finit-alt: finit-alt.o helpers.o
$(LD) $(LDFLAGS) -o $@ $+ $(LIBS)
strip $@
finit-mdv: finit-mdv.o helpers.o
$(LD) $(LDFLAGS) -o $@ $+ $(LIBS)
strip $@
@@ -48,17 +65,27 @@ finit-mdv: finit-mdv.o helpers.o
finit-mdv.o: finit-alt.c Makefile
$(CC) -c $(CFLAGS) -DDIST_MDV -o $@ finit-alt.c
finit-exb: finit-exb.o helpers.o
$(LD) $(LDFLAGS) -o $@ $+ $(LIBS)
strip $@
finit-exb.o: finit-alt.c Makefile
$(CC) -c $(CFLAGS) -DDIST_EEEXUBUNTU -o $@ finit-alt.c
clean:
rm -f *.o core *~
rm -f *.o core *~ $(BINS)
finit.o: finit.c Makefile
finit-mod.o: finit-mod.c Makefile
helpers.o: helpers.c Makefile
dist:
rm -Rf $(PKG)
mkdir $(PKG)
cp Makefile $(DFILES) $(PKG)
mkdir -p $(PKG)/contrib $(PKG)/patches
for i in $(DFILES); do cp $$i $(PKG)/`dirname $$i`; done
tar cf - $(PKG) | gzip -c > $(PKG).tar.gz
rm -Rf $(PKG)
ls -l $(PKG).tar.gz
+30 -57
View File
@@ -1,75 +1,48 @@
Eeepc "fastinit" reimplementations
----------------------------------
Finit is a reimplementation of the Eeepc "fastinit" program based on its
system calls with gaps filled with frog DNA.
finit.c is a reimplementation of the Asus Eeepc fastinit program based
on its library calls. It tries to be an accurate re-creation and keeps
the original bugs and lack of optimization.
Finit's purpose is to build upon the general workings of fastinit and
improve/optimize it for Xandros or alternative distributions running on
the Eeepc. Finit comes in three flavors: finit is a replica of the Asus
fastinit, finit-mod is an improved drop-in replacement for fastinit,
and finit-alt is a generic replacement for other systems. Finit-mod
and finit-alt were much improved with patches from Metalshark.
finit-mod.c is a fixed/improved version of finit.c.
finit-alt.c is a fixed/improved version of finit.c for alternative Linux
distributions running on the Eeepc (previously ffinit.c). Currently able
to boot unmodified Mandriva Linux.
See Makefile for configurable parameters to better suit your system.
See more information at http://helllabs.org/finit/
* Eeepc boot process
Usage scenarios
---------------
The essential steps in the boot process carried out in initramfs are:
1. Replace the original Eeepc 702 fastinit (finit-mod)
ROOT=`sed 's!.*root=\([^ ]*\).*!\1!' < /proc/cmdline`
mount -t proc proc /proc
mount -t ext2 -o ro $ROOT /mnt-system
mount -t ext3 -o rw /dev/sda2 /mnt-user
mount -t unionfs -o dirs=/mnt-user=rw:/mnt-system=ro unionfs /mnt
mount --move /mnt-system /mnt/mnt
umount -l /mnt-user
umount /proc
exec switch_root /mnt /sbin/fastinit "$@" </mnt/dev/console >/mnt/dev/console
If mounting the root filesystem fails, execute a maintenance shell. If
mounting the user filesystem fails, fsck and reboot.
2. Allow fast booting in alternative Linux distributions running on the
Eeepc and other netbooks (finit-alt)
* Utilities available in the Eeepc initramfs busybox:
[ cat cp cut dd
dmesg echo env expr false
grep insmod ln losetup ls
mdev mkdir mknod mount mv
pivot_root realpath rm rmmod sed
sh sleep switch_root test true
umount vi
Finit-alt is distribution-specific. Currently it generates a finit-mdv
executable for Mandriva 2008/2008.1 systems. Smurfy ported it to
eeeXubuntu, and parts of his port have been merged to finit-alt.
* Devices in the Eeepc initramfs /dev:
Finit-alt features
------------------
console fb null ram0 sda1 sda2 sda3 sr0 tty0
Finit-alt reads configuration information from /etc/finit.conf. See
the source code for available options.
Rebooting and halting
---------------------
Using finit with alternative systems
------------------------------------
Finit handles SIGUSR1 and SIGUSR2 for reboot and halt, and listens to
/dev/initctl so standard Linux reboot and halt commands should also
work.
Currently tested only with Mandriva 2008. Proceed with caution, there are
problems related to udev and pam.
1 - Add init=/sbin/finit-mdv to the kernel boot line
2 - Provide a suitable /usr/sbin/services.sh, this is the one I use in my
test system:
mkdir /var/lock/subsys
chmod 1777 /var/lock/subsys
/etc/init.d/network start
dhclient eth0
/sbin/start_udev&
/etc/init.d/portmap start
/etc/init.d/nfs-common start
3 - Provide /etc/hostname if you don't have it already
4 - Set the pointer device in the X server configuration to /dev/input/mice
Debugging
---------
Add finit_debug to the kernel parameter line to enable trace messages
and to run a shell after the X server.
+4
View File
@@ -0,0 +1,4 @@
Experimental eeeXubuntu support merged from smurfy's port, see
http://forum.eeeuser.com/viewtopic.php?id=15685
+33
View File
@@ -0,0 +1,33 @@
Mandriva 2008
-------------
1 - Add init=/sbin/finit-mdv to the kernel boot line
2 - Provide a suitable /usr/sbin/services.sh, this is the one I use in my
test system running e17:
mkdir /var/lock/subsys
chmod 1777 /var/lock/subsys
/etc/init.d/network start
dhclient eth0
/sbin/start_udev&
/etc/init.d/portmap start
/etc/init.d/nfs-common start
If you use KDE or need more services, see examples in contrib/
3 - Create /etc/finit.conf with user, module, filesystems to check and
hostname parameters. See the included finit.conf for more information.
If no user is specified, user "user" will be used as default.
4 - Set the pointer device in the X server configuration to /dev/input/mice
Mandriva 2008.1
---------------
If you have a stuck nash-hotplug consuming 100% of CPU after the boot, you
may want to patch mkinitrd using patches/mkinitrd-6.0.34-nash-hotplug.patch
+88
View File
@@ -0,0 +1,88 @@
CC = gcc
CFLAGS = -Os -Wall -DVERSION=\"$(VERSION)\" -DWHOAMI=\"`whoami`@`hostname`\"
LD = gcc
LDFLAGS =
LIBS =
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*
BINS = finit-mod finit-alt finit-mdv #finit-exb
#### Configurable parameters
# Default user for finit-alt if not "user"
#DEFUSER = fred
# Use -march=pentium-m to build for Eeepc
#CFLAGS += -march=pentium-m
# Omit the first /sbin/hwclock if CONFIG_RTC_HCTOSYS is enabled in the kernel
CFLAGS += -DNO_HCTOSYS
# Append -directisa to /sbin/hwclock lines if the user has disabled
# CONFIG_GENRTC and enabled CONFIG_RTC but not enabled CONFIG_HPET_TIMER
# and CONFIG_HPET_RTC_IRQ.
#CFLAGS += -DDIRECTISA
# Use built-in run-parts instead of /bin/run-parts
CFLAGS += -DBUILTIN_RUNPARTS
#### End of configurable parameters
ifneq ($(DEFUSER),)
CFLAGS += -DDEFUSER=\"$(DEFUSER)\"
endif
.c.o:
$(CC) -c $(CFLAGS) -o $*.o $<
all: $(BINS)
finit: finit.o
$(LD) $(LDFLAGS) -o $@ $+ $(LIBS)
strip $@
finit-mod: finit-mod.o helpers.o
$(LD) $(LDFLAGS) -o $@ $+ $(LIBS)
strip $@
finit-alt: finit-alt.o helpers.o
$(LD) $(LDFLAGS) -o $@ $+ $(LIBS)
strip $@
finit-mdv: finit-mdv.o helpers.o
$(LD) $(LDFLAGS) -o $@ $+ $(LIBS)
strip $@
finit-mdv.o: finit-alt.c Makefile
$(CC) -c $(CFLAGS) -DDIST_MDV -o $@ finit-alt.c
finit-exb: finit-exb.o helpers.o
$(LD) $(LDFLAGS) -o $@ $+ $(LIBS)
strip $@
finit-exb.o: finit-alt.c Makefile
$(CC) -c $(CFLAGS) -DDIST_EEEXUBUNTU -o $@ finit-alt.c
clean:
rm -f *.o core *~ $(BINS)
finit.o: finit.c Makefile
finit-mod.o: finit-mod.c Makefile
helpers.o: helpers.c Makefile
dist:
rm -Rf $(PKG)
mkdir -p $(PKG)/contrib $(PKG)/patches
for i in $(DFILES); do cp $$i $(PKG)/`dirname $$i`; done
tar cf - $(PKG) | gzip -c > $(PKG).tar.gz
rm -Rf $(PKG)
ls -l $(PKG).tar.gz
+20
View File
@@ -0,0 +1,20 @@
#!/bin/sh
#
# Example /usr/sbin/services.sh that can be used in a Mandriva 2008 system
# running KDE
mkdir /var/lock/subsys
chmod 1777 /var/lock/subsys
/sbin/start_udev
mkdir /var/run/dbus
/etc/init.d/messagebus start
/etc/init.d/haldaemon start
/etc/init.d/alsa start
/etc/init.d/sound start
/etc/init.d/crond start
/etc/init.d/network-up start
/etc/init.d/network start
#/etc/init.d/sshd start
/etc/init.d/syslog start
/sbin/pam_console_apply
#kbuildsycoca --noincremental
+28
View File
@@ -0,0 +1,28 @@
#!/bin/sh
# 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
/etc/init.d/messagebus start
/sbin/start_udev.simple
for module in `/bin/grep -hv '#' /etc/modprobe.preload /etc/modprobe.preload.d/*`; do
/sbin/modprobe $module
done
# Need to find a way to apply udev config
chmod 0666 /dev/ptmx
/etc/init.d/network-up start
/etc/init.d/network start
/etc/init.d/acpid start
/etc/init.d/haldaemon start
sleep 10
for i in /etc/rc5.d/S*; do
$i status > /dev/null 2>&1 || $i start
done
+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)&
+337 -101
View File
@@ -37,36 +37,44 @@ THE SOFTWARE.
#include <sys/reboot.h>
#include <sys/wait.h>
#include <linux/fs.h>
#include <utmp.h>
#include "helpers.h"
#ifdef DEBUG
#define debug(x...) do { \
printf("finit: %d: ", __LINE__); printf(x); printf("\n"); \
} while (0)
#else
#define debug(x...)
#ifndef DEFUSER
#define DEFUSER "user"
#endif
/* Distribution configuration */
#ifdef DIST_MDV /* Mandriva */
#if defined DIST_MDV /* Mandriva */
#define RANDOMSEED "/var/lib/random-seed"
#define SYSROOT "/sysroot"
#define GETTY "/sbin/mingetty tty3"
#define RUNPARTS "/usr/bin/run-parts --arg=-i"
#define DEFUSER "user"
#define HOMEDEV "/dev/sda6"
#define AGPDRV "intel-agp"
#define GETTY "/usr/bin/openvt /sbin/mingetty tty2"
#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_MESSAGE_BUS
#elif defined DIST_EEEXUBUNTU /* eeeXubuntu */
#define RANDOMSEED "/var/lib/urandom/random-seed"
#define SYSROOT "/sysroot"
#define GETTY "/usr/bin/openvt /sbin/getty 38400 tty2"
#define RUNPARTS "/bin/run-parts"
#define REMOUNT_ROOTFS_RW
#define MAKE_DEVICES
#define TOUCH_ETC_NETWORK_RUN_IFSTATE
#define LISTEN_INITCTL
#else /* original Eeepc distribution */
#define RANDOMSEED "/var/lib/urandom/random-seed"
#define SYSROOT "/mnt"
#define GETTY "/sbin/getty 38400 tty3"
#define RUNPARTS "/bin/run-parts --arg=-i"
#define DEFUSER "user"
#define GETTY "/usr/bin/openvt /sbin/getty 38400 tty2"
#define RUNPARTS "/bin/run-parts"
#define TOUCH_ETC_NETWORK_RUN_IFSTATE
#define USE_ETC_RESOLVCONF_RUN
#endif
#ifdef DIRECTISA
@@ -86,30 +94,122 @@ THE SOFTWARE.
sigaction(sig, &sa, NULL); \
} while (0)
#ifdef LISTEN_INITCTL
#define INIT_MAGIC 0x03091969
#define INIT_CMD_RUNLVL 1
struct init_request {
int magic; /* Magic number */
int cmd; /* What kind of request */
int runlevel; /* Runlevel to change to */
int sleeptime; /* Time between TERM and KILL */
char data[368];
};
#endif
#define touch(x) mknod((x), S_IFREG|0644, 0)
#define chardev(x,m,maj,min) mknod((x), S_IFCHR|(m), makedev((maj),(min)))
#define blkdev(x,m,maj,min) mknod((x), S_IFBLK|(m), makedev((maj),(min)))
#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
#define HOSTNAME_SIZE 32
void shutdown(int);
void signal_handler(int);
void chld_handler(int);
static int debug = 0;
static char sdown[CMD_SIZE];
static void build_cmd(char *cmd, char *x, int len)
{
int l;
char *c;
c = cmd + strlen(cmd);
/* skip spaces */
for (; *x && (*x == ' ' || *x == '\t'); x++);
/* copy next arg */
for (l = 0; *x && *x != '#' && *x != '\t' && l < len; l++)
*c++ = *x++;
*c = 0;
_d("cmd = %s", cmd);
}
#ifdef LISTEN_INITCTL
/* Standard reboot/shutdown utilities talk to init using /dev/initctl.
* We should check if the fifo was recreated and reopen it.
*/
static void listen_initctl()
{
if (!fork()) {
int ctl;
fd_set fds;
struct init_request request;
mkfifo("/dev/initctl", 0600);
ctl = open("/dev/initctl", O_RDONLY);
while (1) {
FD_ZERO(&fds);
FD_SET(ctl, &fds);
if (select(ctl + 1, &fds, NULL, NULL, NULL) <= 0)
continue;
read(ctl, &request, sizeof(request));
if (request.magic != INIT_MAGIC)
continue;
if (request.cmd == INIT_CMD_RUNLVL) {
switch (request.runlevel) {
case '0':
shutdown(SIGUSR2);
break;
case '6':
shutdown(SIGUSR1);
}
}
}
}
}
#endif
int main()
{
int i;
FILE *f;
char line[2096];
int fd;
char line[LINE_SIZE];
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;
char filename[1024];
struct sigaction sa, act;
char hline[1024];
char *x;
sigset_t nmask, nmask2;
puts("finit-alt " VERSION " (built " __DATE__ " by " WHOAMI ")");
#endif
#ifdef RUNLEVEL
struct utmp entry;
#endif
#ifdef PAM_CONSOLE
int fd;
#endif
chdir("/");
umask(022);
@@ -120,15 +220,15 @@ int main()
for (i = 1; i < NSIG; i++)
SETSIG(sa, i, SIG_IGN, SA_RESTART);
SETSIG(sa, SIGINT, shutdown, 0);
SETSIG(sa, SIGPWR, signal_handler, 0);
SETSIG(sa, SIGUSR1, shutdown, 0);
SETSIG(sa, SIGUSR2, shutdown, 0);
SETSIG(sa, SIGTERM, signal_handler, 0);
SETSIG(sa, SIGALRM, signal_handler, 0);
SETSIG(sa, SIGHUP, signal_handler, 0);
SETSIG(sa, SIGCONT, signal_handler, SA_RESTART);
SETSIG(sa, SIGCHLD, chld_handler, SA_RESTART);
SETSIG(sa, SIGINT, shutdown, 0);
SETSIG(sa, SIGPWR, SIG_IGN, 0);
SETSIG(sa, SIGUSR1, shutdown, 0);
SETSIG(sa, SIGUSR2, shutdown, 0);
SETSIG(sa, SIGTERM, SIG_IGN, 0);
SETSIG(sa, SIGALRM, SIG_IGN, 0);
SETSIG(sa, SIGHUP, SIG_IGN, 0);
SETSIG(sa, SIGCONT, SIG_IGN, SA_RESTART);
SETSIG(sa, SIGCHLD, chld_handler, SA_RESTART);
/* Block sigchild while forking */
sigemptyset(&nmask);
@@ -137,13 +237,17 @@ int main()
reboot(RB_DISABLE_CAD);
mount("proc", "/proc", "proc", 0, NULL);
mount("none", "/proc", "proc", 0, NULL);
mount("none", "/sys", "sysfs", 0, NULL);
/*
* Parse kernel parameters
*/
if ((f = fopen("/proc/cmdline", "r")) != NULL) {
fgets(line, 2095, f);
fgets(line, LINE_SIZE, f);
if ((strstr(line, "finit_debug"))) {
debug = 1;
}
if (strstr(line, "quiet")) {
close(0);
close(1);
@@ -152,61 +256,155 @@ int main()
fclose(f);
}
_d("finit-alt " VERSION " (built " __DATE__ " " __TIME__ " by " WHOAMI ")");
setsid();
/*
* Parse configuration file
*/
if ((f = fopen("/etc/finit.conf", "r")) != NULL) {
char *x;
while (!feof(f)) {
fgets(line, LINE_SIZE, f);
chomp(line);
_d("conf: %s", line);
/* Do this before mounting / read-write */
if (MATCH_CMD(line, "check ", x)) {
strcpy(cmd, "/sbin/fsck -C -a ");
build_cmd(cmd, x, CMD_SIZE);
system(cmd);
continue;
}
if (MATCH_CMD(line, "user ", x)) {
*username = 0;
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);
system(cmd);
continue;
}
#ifdef MAKE_DEVICES
/* This is used if the system uses udev and doesn't
* mount /dev as tmpfs in the initrd, or if it doesn't
* use an initrd. Mount /dev as tmpfs and create basic
* device nodes.
*/
if (MATCH_CMD(line, "mountdev", x)) {
mount("none", "/dev", "tmpfs", 0, "mode=0755");
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
* devices statically on the filesystem
*/
if (MATCH_CMD(line, "mknod ", x)) {
strcpy(cmd, "/bin/mknod ");
build_cmd(cmd, x, CMD_SIZE);
system(cmd);
continue;
}
#endif
}
fclose(f);
}
/*
* Mount filesystems
*/
debug("mount filesystems");
_d("mount filesystems");
#ifdef REMOUNT_ROOTFS_RW
system("/bin/mount -n -o remount,rw /");
#endif
umask(0);
#ifdef MAKE_DEVICES
mkdir("/dev/shm", 0755);
mkdir("/dev/pts", 0755);
#endif
mount("sysfs", "/sys", "sysfs", 0, NULL);
mount("devpts", "/dev/pts", "devpts", 0, "gid=5,mode=620");
mount("tmpfs", "/dev/shm", "tmpfs", 0, NULL);
mount("tmpfs", "/tmp", "tmpfs", 0, "mode=1777,size=128m");
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");
mount("none", "/var/run", "tmpfs", 0, "mode=0755");
mount("none", "/var/lock", "tmpfs", 0, "mode=1777");
mount("none", "/proc/bus/usb", "usbfs", 0, NULL);
mount(SYSROOT, "/", NULL, MS_MOVE, NULL);
unlink("/etc/mtab");
system("mount -a");
_d("make devices");
#ifdef MAKE_DEVICES
debug("make devices");
mkdir("/dev/input", 0755);
chardev("/dev/urandom", 0666, 1, 9);
chardev("/dev/ptmx", 0666, 5, 2);
chardev("/dev/null", 0666, 1, 3);
chmod("/dev/null", 0666);
chardev("/dev/mem", 0640, 1, 1);
chmod("/dev/null", 0667);
chmod("/dev/mem", 0640);
chardev("/dev/tty", 0666, 5, 0);
chardev("/dev/tty0", 0660, 4, 0);
chardev("/dev/tty1", 0660, 4, 1);
chardev("/dev/tty2", 0660, 4, 2);
chardev("/dev/tty3", 0660, 4, 3);
chardev("/dev/input/mice", 0660, 13, 63);
chardev("/dev/input/event0", 0660, 13, 64);
chardev("/dev/agpgart", 0660, 10, 175);
blkdev("/dev/loop0", 0600, 7, 0);
#endif
unlink("/etc/mtab");
system("mount -a");
umask(0022);
/*
* 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
system("/sbin/hwclock --hctosys --localtime" HWCLOCK_DIRECTISA);
system("/sbin/hwclock --hctosys" HWCLOCK_DIRECTISA);
#endif
/*
* Network stuff
*/
#ifdef USE_ETC_RESOLVCONF_RUN
makepath("/dev/shm/network");
makepath("/dev/shm/resolvconf/interface");
@@ -214,34 +412,57 @@ int main()
while ((d = readdir(dir)) != NULL) {
if (isalnum(d->d_name[0]))
continue;
sprintf(filename, "/etc/resolvconf/run/interface/%s",
d->d_name);
unlink(filename);
snprintf(line, LINE_SIZE,
"/etc/resolvconf/run/interface/%s", d->d_name);
unlink(line);
}
closedir(dir);
}
#endif
#ifdef USE_VAR_RUN_RESOLVCONF
makepath("/var/run/resolvconf/interface");
symlink("../../../etc/resolv.conf", "/var/run/resolvconf/resolv.conf");
#endif
touch("/var/run/utmp");
chown("/var/run/utmp", 0, getgroup("utmp"));
chmod("/var/run/utmp", 0664);
#ifdef RUNLEVEL
memset(&entry, 0, sizeof(struct utmp));
entry.ut_type = RUN_LVL;
entry.ut_pid = '0' + RUNLEVEL;
setutent();
pututline(&entry);
endutent();
#endif
#ifdef USE_ETC_RESOLVCONF_RUN
touch("/etc/resolvconf/run/enable-updates");
chdir("/etc/resolvconf/run/interface");
system(RUNPARTS " /etc/resolvconf/update.d");
#ifdef BUILTIN_RUNPARTS
run_parts("/etc/resolvconf/update.d", "-i", NULL);
#else
system(RUNPARTS " --arg=i /etc/resolvconf/update.d");
#endif
chdir("/");
#endif
#ifdef TOUCH_ETC_NETWORK_RUN_IFSTATE
touch("/etc/network/run/ifstate");
#endif
if ((f = fopen("/etc/hostname", "r")) != NULL) {
fgets(hline, 1023, f);
if ((x = strchr(hline, 0x0a)) != NULL)
*x = 0;
sethostname(hline, strlen(hline));
fgets(hostname, HOSTNAME_SIZE, f);
chomp(hostname);
fclose(f);
}
sethostname(hostname, strlen(hostname));
ifconfig("lo", "127.0.0.1", "255.0.0.0", 1);
/*
@@ -251,19 +472,33 @@ int main()
unlink(RANDOMSEED);
umask(077);
copyfile("/dev/urandom", RANDOMSEED, 4096);
umask(0);
/*
* Console setup (for X)
*/
makepath("/var/run/console");
snprintf(line, LINE_SIZE, "/var/run/console/%s", username);
touch(line);
#ifdef PAM_CONSOLE
if ((fd = open("/var/run/console/console.lock", O_CREAT|O_WRONLY|O_TRUNC, 0644)) >= 0) {
write(fd, username, strlen(username));
close(fd);
system("/sbin/pam_console_apply");
}
#endif
/*
* Misc setup
*/
unlink("/var/run/.clean");
unlink("/var/lock/.clean");
umask(0);
mkdir("/tmp/.X11-unix", 01777);
mkdir("/tmp/.ICE-unix", 01777);
umask(022);
debug("forking");
system(GETTY "&");
_d("forking");
if (!fork()) {
/* child process */
@@ -273,7 +508,7 @@ int main()
close(1);
close(0);
if (open("/dev/tty1", O_RDWR, 0))
if (open("/dev/tty1", O_RDWR) != 0)
exit(1);
sigemptyset(&act.sa_mask);
@@ -290,21 +525,36 @@ int main()
dup2(0, 1);
dup2(0, 2);
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");
#endif
#ifdef AGPDRV
system("/sbin/modprobe agpgart");
system("/sbin/modprobe " AGPDRV);
#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) {
debug("start X as " DEFUSER);
#ifdef DEBUG
system("su -c startx -l " DEFUSER);
system("/bin/sh");
#else
system("su -c startx -l " DEFUSER " &> /dev/null");
#endif
_d("start X as %s\n", username);
if (debug) {
snprintf(line, LINE_SIZE,
"su -l %s -c \"%s\"", username, startx);
system(line);
system("/bin/sh");
} else {
snprintf(line, LINE_SIZE,
"su -l %s -c \"%s\" &> /dev/null",
username, startx);
system(line);
}
}
exit(0);
@@ -312,8 +562,8 @@ int main()
/* parent process */
system(GETTY "&");
sleep(1);
/* sleep(1); */
system("/usr/sbin/services.sh &>/dev/null&");
while (1) {
@@ -328,10 +578,10 @@ int main()
*/
void shutdown(int sig)
{
int fd;
debug("shutdown");
touch("/tmp/shutdown");
if (sdown) {
system(sdown);
}
kill(-1, SIGTERM);
@@ -340,24 +590,19 @@ void shutdown(int sig)
sleep(2);
system("/usr/sbin/alsactl store > /dev/null 2>&1");
system("/sbin/hwclock --systohc --localtime" HWCLOCK_DIRECTISA);
system("/sbin/unionctl.static / --remove / > /dev/null 2>&1");
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);
if ((fd = open("/sys/power/state", O_WRONLY)) >= 0) {
write(fd, "5", 1);
close(fd);
}
reboot(RB_POWER_OFF);
}
@@ -374,12 +619,3 @@ void chld_handler(int sig)
}
}
/*
* We got a signal (PWR TERM ALRM HUP CONT)
*/
void signal_handler(int sig)
{
/* do nothing */
}
+37 -42
View File
@@ -34,10 +34,15 @@ Changelog from the original Eeepc fastinit:
- Add –directisa to hwclock if user has disabled CONFIG_GENRTC and enabled
CONFIG_RTC but not CONFIG_HPET_TIMER and CONFIG_HPET_RTC_IRQ (by Metalshark)
- Drop system() call to clean /tmp, it's a fresh mounted tmpfs
- Change /proc/acpi/sleep to /sys/power/state (by Metalshark)
- Set loopback interface using direct calls instead of system("ifconfig")
- Copy 4096 data block in C instead of system("cat") or system("dd")
- Draw shutdown splash screen using C calls instead of system("echo;cat")
- Change poweroff method to reboot(RB_POWER_OFF) (by Metalshark)
- Mount /var/run and /var/lock as tmpfs
- Use SIG_IGN instead of empty signal handler (by Metalshark)
- Add built-in run-parts option to be used instead of system("run-parts")
- Reuse cmdline buffer as hostname and filename buffers
- Open terminal in vt2 using openvt
*/
@@ -74,13 +79,13 @@ Changelog from the original Eeepc fastinit:
sa.sa_flags = flags; \
sigemptyset(&sa.sa_mask); \
sigaction(sig, &sa, NULL); \
} while(0)
} while (0)
#define touch(x) mknod((x), S_IFREG|0644, 0)
#define LINE_SIZE 1024
void shutdown(int);
void signal_handler(int);
void chld_handler(int);
@@ -88,17 +93,16 @@ int main()
{
int i;
FILE *f;
char line[2096];
char line[LINE_SIZE];
int fd;
DIR *dir;
struct dirent *d;
char filename[1024];
struct sigaction sa, act;
char hline[1024];
char *x;
sigset_t nmask, nmask2;
puts("finit-mod " VERSION " (built " __DATE__ " by " WHOAMI ")");
puts("finit-mod " VERSION " (built " __DATE__ " " __TIME__
" by " WHOAMI ")");
chdir("/");
umask(022);
@@ -109,15 +113,15 @@ int main()
for (i = 1; i < NSIG; i++)
SETSIG(sa, i, SIG_IGN, SA_RESTART);
SETSIG(sa, SIGINT, shutdown, 0);
SETSIG(sa, SIGPWR, signal_handler, 0);
SETSIG(sa, SIGUSR1, shutdown, 0);
SETSIG(sa, SIGUSR2, shutdown, 0);
SETSIG(sa, SIGTERM, signal_handler, 0);
SETSIG(sa, SIGALRM, signal_handler, 0);
SETSIG(sa, SIGHUP, signal_handler, 0);
SETSIG(sa, SIGCONT, signal_handler, SA_RESTART);
SETSIG(sa, SIGCHLD, chld_handler, SA_RESTART);
SETSIG(sa, SIGINT, shutdown, 0);
SETSIG(sa, SIGPWR, SIG_IGN, 0);
SETSIG(sa, SIGUSR1, shutdown, 0);
SETSIG(sa, SIGUSR2, shutdown, 0);
SETSIG(sa, SIGTERM, SIG_IGN, 0);
SETSIG(sa, SIGALRM, SIG_IGN, 0);
SETSIG(sa, SIGHUP, SIG_IGN, 0);
SETSIG(sa, SIGCONT, SIG_IGN, SA_RESTART);
SETSIG(sa, SIGCHLD, chld_handler, SA_RESTART);
/* Block sigchild while forking */
sigemptyset(&nmask);
@@ -130,7 +134,7 @@ int main()
* Parse kernel parameters
*/
if ((f = fopen("/proc/cmdline", "r")) != NULL) {
fgets(line, 2095, f);
fgets(line, LINE_SIZE, f);
if (strstr(line, "quiet")) {
close(0);
close(1);
@@ -149,6 +153,8 @@ int main()
mount("devpts", "/dev/pts", "devpts", 0, "gid=5,mode=620");
mount("tmpfs", "/dev/shm", "tmpfs", 0, NULL);
mount("tmpfs", "/tmp", "tmpfs", 0, "mode=1777,size=128m");
mount("tmpfs", "/var/run", "tmpfs", 0, "mode=0755");
mount("tmpfs", "/var/lock", "tmpfs", 0, "mode=1777");
mount("/mnt", "/", NULL, MS_MOVE, NULL);
/*
@@ -172,9 +178,9 @@ int main()
while ((d = readdir(dir)) != NULL) {
if (isalnum(d->d_name[0]))
continue;
sprintf(filename, "/etc/resolvconf/run/interface/%s",
d->d_name);
unlink(filename);
snprintf(line, LINE_SIZE,
"/etc/resolvconf/run/interface/%s", d->d_name);
unlink(line);
}
closedir(dir);
@@ -184,17 +190,21 @@ int main()
touch("/etc/resolvconf/run/enable-updates");
chdir("/etc/resolvconf/run/interface");
#ifdef BUILTIN_RUNPARTS
run_parts("/etc/resolvconf/update.d", "-i", NULL);
#else
system("/bin/run-parts --arg=-i /etc/resolvconf/update.d");
#endif
chdir("/");
touch("/etc/network/run/ifstate");
if ((f = fopen("/etc/hostname", "r")) != NULL) {
fgets(hline, 1023, f);
if ((x = strchr(hline, 0x0a)) != NULL)
fgets(line, LINE_SIZE, f);
if ((x = strchr(line, 0x0a)) != NULL)
*x = 0;
sethostname(hline, strlen(hline));
sethostname(line, strlen(line));
fclose(f);
}
@@ -219,6 +229,8 @@ int main()
mkdir("/tmp/.ICE-unix", 01777);
umask(022);
system("/usr/bin/openvt /sbin/getty 38400 tty2&");
if (!fork()) {
/* child process */
@@ -228,7 +240,7 @@ int main()
close(1);
close(0);
if (open("/dev/tty1", O_RDWR, 0))
if (open("/dev/tty1", O_RDWR) != 0)
exit(1);
sigemptyset(&act.sa_mask);
@@ -255,7 +267,6 @@ int main()
/* parent process */
system("/sbin/getty 38400 tty3&");
sleep(1);
system("/usr/sbin/services.sh &>/dev/null&");
@@ -271,8 +282,6 @@ int main()
*/
void shutdown(int sig)
{
int fd;
touch("/tmp/shutdown");
kill(-1, SIGTERM);
@@ -283,23 +292,18 @@ void shutdown(int sig)
system("/usr/sbin/alsactl store > /dev/null 2>&1");
system("/sbin/hwclock --systohc --localtime" HWCLOCK_DIRECTISA);
system("/sbin/unionctl.static / --remove / > /dev/null 2>&1");
kill(-1, SIGKILL);
sync();
sync();
system("/bin/mount -n -o remount,ro /");
system("/sbin/unionctl.static / --remove / > /dev/null 2>&1");
if (sig == SIGINT || sig == SIGUSR1)
reboot(RB_AUTOBOOT);
if ((fd = open("/sys/power/state", O_WRONLY)) >= 0) {
write(fd, "5", 1);
close(fd);
}
reboot(RB_POWER_OFF);
}
@@ -316,12 +320,3 @@ void chld_handler(int sig)
}
}
/*
* We got a signal (PWR TERM ALRM HUP CONT)
*/
void signal_handler(int sig)
{
/* do nothing */
}
-2
View File
@@ -240,14 +240,12 @@ void shutdown(int sig)
system("/usr/sbin/alsactl store > /dev/null 2>&1");
system("/sbin/hwclock --systohc --localtime");
system("/sbin/unionctl.static / --remove / > /dev/null 2>&1");
kill(-1, SIGKILL);
sync();
sync();
system("/bin/mount -n -o remount,ro /");
system("/sbin/unionctl.static / --remove / > /dev/null 2>&1");
if (sig == SIGINT || sig == SIGUSR1)
+6
View File
@@ -0,0 +1,6 @@
user fred
module intel-agp
module p4-clockmod
check /dev/sda3
host eviltwin
startx /usr/bin/startx
+94
View File
@@ -1,5 +1,7 @@
#include <string.h>
#include <limits.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
@@ -10,6 +12,14 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#ifdef BUILTIN_RUNPARTS
#include <dirent.h>
#include <stdarg.h>
#include <sys/wait.h>
#endif
#include <grp.h>
#include "helpers.h"
/*
@@ -25,6 +35,7 @@ int makepath(char *p)
do {
do { *x++ = *p++; } while (*p && *p != '/');
*x = 0;
ret = mkdir(path, 0777);
} while (*p && (*p != '/' || *(p + 1))); /* ignore trailing slash */
@@ -89,3 +100,86 @@ void copyfile(char *src, char *dst, int size)
}
}
#ifdef BUILTIN_RUNPARTS
#define NUM_SCRIPTS 128 /* ought to be enough for anyone */
#define NUM_ARGS 16
static int cmp(const void *s1, const void *s2)
{
return strcmp(*(char **)s1, *(char **)s2);
}
int run_parts(char *dir, ...)
{
DIR *d;
struct dirent *e;
struct stat st;
char *ent[NUM_SCRIPTS];
int i, num = 0, argnum = 1;
char *args[NUM_ARGS];
va_list ap;
if (chdir(dir))
return -1;
if ((d = opendir(dir)) == NULL)
return -1;
va_start(ap, dir);
while (argnum < NUM_ARGS && (args[argnum++] = va_arg(ap, char *)));
va_end(ap);
while ((e = readdir(d))) {
if (e->d_type == DT_REG && stat(e->d_name, &st) == 0) {
if (st.st_mode & S_IXUSR) {
ent[num++] = strdup(e->d_name);
if (num >= NUM_SCRIPTS)
break;
}
}
}
closedir(d);
if (num == 0)
return 0;
qsort(ent, num, sizeof(char *), cmp);
for (i = 0; i < num; i++) {
args[0] = ent[i];
if (!fork()) {
execv(ent[i], args);
exit(0);
}
wait(NULL);
free(ent[i]);
}
return 0;
}
int getgroup(char *s)
{
struct group *grp;
if ((grp = getgrnam(s)) == NULL)
return -1;
return grp->gr_gid;
}
/*
* Other convenience functions
*/
void chomp(char *s)
{
char *x;
if ((x = strchr((s), 0x0a)) != NULL)
*x = 0;
}
#endif
+6
View File
@@ -4,5 +4,11 @@
int makepath (char *);
void ifconfig (char *, char *, char *, int);
void copyfile (char *, char *, int);
void chomp (char *);
int getgroup (char *);
#ifdef BUILTIN_RUNPARTS
int run_parts (char *, ...);
#endif
#endif
@@ -0,0 +1,14 @@
Prevent nash-hotplug to keep running after boot using 100% of cpu
diff -rud mkinitrd-6.0.34-orig/nash/hotplug.c mkinitrd-6.0.34/nash/hotplug.c
--- mkinitrd-6.0.34-orig/nash/hotplug.c 2008-03-06 21:20:34.000000000 -0300
+++ mkinitrd-6.0.34/nash/hotplug.c 2008-03-12 18:48:46.000000000 -0300
@@ -547,7 +547,7 @@
nashLogger(nc, NASH_ERROR, "parent exited without telling us\n");
close(nc->hp_childfd);
nc->hp_childfd = -1;
- break;
+ exit(1);
}
count += rc;
}