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 | ||
|
|
7360ef1f08 | ||
|
|
529224153f | ||
|
|
0f8393ef0e | ||
|
|
a1d7e48225 | ||
|
|
938773765c | ||
|
|
367049a11c | ||
|
|
efcdc141c8 | ||
|
|
dfed328d47 | ||
|
|
804aa3c747 | ||
|
|
3ce7638dab | ||
|
|
b0746f5220 | ||
|
|
c324eff01a | ||
|
|
a6f534621c | ||
|
|
b0e3dbc47f | ||
|
|
220b2c9ae3 | ||
|
|
173853ca17 | ||
|
|
9f83bbe788 | ||
|
|
a187b88dd9 | ||
|
|
134d9f3463 | ||
|
|
25e9d84673 | ||
|
|
765bef0991 | ||
|
|
7d10388158 | ||
|
|
a0382dfab8 | ||
|
|
ead2eb7076 | ||
|
|
0f2a14bf4f | ||
|
|
4e8be438e9 | ||
|
|
2f3404165f | ||
|
|
ca9ee99f59 | ||
|
|
0ab62c8871 | ||
|
|
efdac3fc2d | ||
|
|
c127735e2d | ||
|
|
d621b0ba15 | ||
|
|
33469873a5 | ||
|
|
36043c04f9 | ||
|
|
ec10fecd8d | ||
|
|
0fc7654a83 | ||
|
|
ba9c897e83 | ||
|
|
4948844f82 | ||
|
|
9f99f38561 | ||
|
|
f516108ca6 | ||
|
|
04b91da9f9 | ||
|
|
f94504ad96 | ||
|
|
698c5a1852 | ||
|
|
d5037d1352 | ||
|
|
57ad91136b | ||
|
|
9488e65998 | ||
|
|
19540d148e | ||
|
|
df14fd5255 |
@@ -0,0 +1,2 @@
|
|||||||
|
*.o
|
||||||
|
*.gz
|
||||||
@@ -1,3 +1,19 @@
|
|||||||
|
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)
|
||||||
|
- 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)
|
O.4 (20080516)
|
||||||
- default username for finit-alt configurable in Makefile
|
- default username for finit-alt configurable in Makefile
|
||||||
- create loopback device node in finit-alt (for squashfs)
|
- create loopback device node in finit-alt (for squashfs)
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ CFLAGS = -Os -Wall -DVERSION=\"$(VERSION)\" -DWHOAMI=\"`whoami`@`hostname`\"
|
|||||||
LD = gcc
|
LD = gcc
|
||||||
LDFLAGS =
|
LDFLAGS =
|
||||||
LIBS =
|
LIBS =
|
||||||
VERSION = 0.4
|
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* contrib/Makefile.*
|
||||||
BINS = finit finit-mod finit-mdv
|
BINS = finit-mod finit-alt finit-mdv #finit-exb
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -16,8 +16,11 @@ BINS = finit finit-mod finit-mdv
|
|||||||
# 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
|
||||||
@@ -51,6 +54,10 @@ finit-mod: finit-mod.o helpers.o
|
|||||||
$(LD) $(LDFLAGS) -o $@ $+ $(LIBS)
|
$(LD) $(LDFLAGS) -o $@ $+ $(LIBS)
|
||||||
strip $@
|
strip $@
|
||||||
|
|
||||||
|
finit-alt: finit-alt.o helpers.o
|
||||||
|
$(LD) $(LDFLAGS) -o $@ $+ $(LIBS)
|
||||||
|
strip $@
|
||||||
|
|
||||||
finit-mdv: finit-mdv.o helpers.o
|
finit-mdv: finit-mdv.o helpers.o
|
||||||
$(LD) $(LDFLAGS) -o $@ $+ $(LIBS)
|
$(LD) $(LDFLAGS) -o $@ $+ $(LIBS)
|
||||||
strip $@
|
strip $@
|
||||||
@@ -58,6 +65,13 @@ finit-mdv: finit-mdv.o helpers.o
|
|||||||
finit-mdv.o: finit-alt.c Makefile
|
finit-mdv.o: finit-alt.c Makefile
|
||||||
$(CC) -c $(CFLAGS) -DDIST_MDV -o $@ finit-alt.c
|
$(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:
|
clean:
|
||||||
rm -f *.o core *~ $(BINS)
|
rm -f *.o core *~ $(BINS)
|
||||||
|
|
||||||
|
|||||||
@@ -1,68 +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
|
Finit's purpose is to build upon the general workings of fastinit and
|
||||||
on its library calls. It tries to be an accurate re-creation and keeps
|
improve/optimize it for Xandros or alternative distributions running on
|
||||||
the original bugs and unoptimized calls.
|
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 intended to be a drop-in
|
See more information at http://helllabs.org/finit/
|
||||||
replacement for the original Eeepc OS.
|
|
||||||
|
|
||||||
finit-alt.c is a fixed/improved version of finit.c for alternative Linux
|
|
||||||
distributions running on the Eeepc (previously ffinit.c). It's currently
|
|
||||||
able to boot Mandriva Linux 2008.0/2008.1.
|
|
||||||
|
|
||||||
See Makefile for configurable parameters to better suit your system.
|
|
||||||
|
|
||||||
|
|
||||||
* 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`
|
2. Allow fast booting in alternative Linux distributions running on the
|
||||||
mount -t proc proc /proc
|
Eeepc and other netbooks (finit-alt)
|
||||||
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.
|
|
||||||
|
|
||||||
|
|
||||||
* Utilities available in the Eeepc initramfs busybox:
|
Finit-alt is distribution-specific. Currently it generates a finit-mdv
|
||||||
|
executable for Mandriva 2008/2008.1 systems. Smurfy ported it to
|
||||||
[ cat cp cut dd
|
eeeXubuntu, and parts of his port have been merged to finit-alt.
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
* 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.
|
||||||
|
|
||||||
|
|
||||||
Reboot and poweroff
|
Rebooting and halting
|
||||||
-------------------
|
---------------------
|
||||||
|
|
||||||
Stock reboot and poweroff utilities of a modern Linux distribution may not
|
Finit handles SIGUSR1 and SIGUSR2 for reboot and halt, and listens to
|
||||||
work correctly with finit. You can replace them with simple scripts that
|
/dev/initctl so standard Linux reboot and halt commands should also
|
||||||
send SIGUSR1 to finit for reboot, SIGUSR2 for poweroff.
|
work.
|
||||||
|
|
||||||
|
|
||||||
Using finit with KDE
|
Debugging
|
||||||
--------------------
|
---------
|
||||||
|
|
||||||
If you use finit to start KDE with auto-login enabled, hal-based device
|
|
||||||
automounting may not work correctly. That happens because the session
|
|
||||||
is started before the system message bus, so add a "dcop kded mediamanager
|
|
||||||
reloadBackends" call in the user AutoStart to restart the client.
|
|
||||||
|
|
||||||
|
Add finit_debug to the kernel parameter line to enable trace messages
|
||||||
|
and to run a shell after the X server.
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
Experimental eeeXubuntu support merged from smurfy's port, see
|
||||||
|
http://forum.eeeuser.com/viewtopic.php?id=15685
|
||||||
|
|
||||||
@@ -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
|
||||||
|
|
||||||
@@ -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
|
||||||
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)&
|
||||||
+210
-38
@@ -37,6 +37,7 @@ THE SOFTWARE.
|
|||||||
#include <sys/reboot.h>
|
#include <sys/reboot.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <linux/fs.h>
|
#include <linux/fs.h>
|
||||||
|
#include <utmp.h>
|
||||||
|
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
|
||||||
@@ -46,20 +47,34 @@ THE SOFTWARE.
|
|||||||
|
|
||||||
/* Distribution configuration */
|
/* Distribution configuration */
|
||||||
|
|
||||||
#ifdef DIST_MDV /* Mandriva */
|
#if defined DIST_MDV /* Mandriva */
|
||||||
#define RANDOMSEED "/var/lib/random-seed"
|
#define RANDOMSEED "/var/lib/random-seed"
|
||||||
#define SYSROOT "/sysroot"
|
#define SYSROOT "/sysroot"
|
||||||
#define GETTY "/usr/bin/openvt /sbin/mingetty tty2"
|
#define GETTY "/usr/bin/openvt /sbin/mingetty tty2"
|
||||||
#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 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 */
|
#else /* original Eeepc distribution */
|
||||||
#define RANDOMSEED "/var/lib/urandom/random-seed"
|
#define RANDOMSEED "/var/lib/urandom/random-seed"
|
||||||
#define SYSROOT "/mnt"
|
#define SYSROOT "/mnt"
|
||||||
#define GETTY "/usr/bin/openvt /sbin/getty 38400 tty2"
|
#define GETTY "/usr/bin/openvt /sbin/getty 38400 tty2"
|
||||||
#define RUNPARTS "/bin/run-parts"
|
#define RUNPARTS "/bin/run-parts"
|
||||||
#define TOUCH_ETC_NETWORK_RUN_IFSTATE
|
#define TOUCH_ETC_NETWORK_RUN_IFSTATE
|
||||||
|
#define USE_ETC_RESOLVCONF_RUN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DIRECTISA
|
#ifdef DIRECTISA
|
||||||
@@ -79,6 +94,20 @@ THE SOFTWARE.
|
|||||||
sigaction(sig, &sa, NULL); \
|
sigaction(sig, &sa, NULL); \
|
||||||
} while (0)
|
} 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 touch(x) mknod((x), S_IFREG|0644, 0)
|
||||||
#define chardev(x,m,maj,min) mknod((x), S_IFCHR|(m), makedev((maj),(min)))
|
#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 blkdev(x,m,maj,min) mknod((x), S_IFBLK|(m), makedev((maj),(min)))
|
||||||
@@ -86,6 +115,8 @@ THE SOFTWARE.
|
|||||||
#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
|
||||||
@@ -96,6 +127,7 @@ void signal_handler(int);
|
|||||||
void chld_handler(int);
|
void chld_handler(int);
|
||||||
|
|
||||||
static int debug = 0;
|
static int debug = 0;
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
@@ -103,30 +135,81 @@ static void build_cmd(char *cmd, char *x, int len)
|
|||||||
char *c;
|
char *c;
|
||||||
|
|
||||||
c = cmd + strlen(cmd);
|
c = cmd + strlen(cmd);
|
||||||
|
|
||||||
|
/* skip spaces */
|
||||||
for (; *x && (*x == ' ' || *x == '\t'); x++);
|
for (; *x && (*x == ' ' || *x == '\t'); x++);
|
||||||
for (l = 0; *x && *x != ' ' && *x != '\t' && l < len; l++)
|
|
||||||
|
/* copy next arg */
|
||||||
|
for (l = 0; *x && *x != '#' && *x != '\t' && l < len; l++)
|
||||||
*c++ = *x++;
|
*c++ = *x++;
|
||||||
*c = 0;
|
*c = 0;
|
||||||
if (debug)
|
|
||||||
printf("cmd = %s\n", cmd);
|
_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 main()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char line[LINE_SIZE];
|
char line[LINE_SIZE];
|
||||||
int fd;
|
|
||||||
DIR *dir;
|
|
||||||
struct dirent *d;
|
|
||||||
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";
|
||||||
puts("finit-alt " VERSION " (built " __DATE__ " by " WHOAMI ")");
|
#ifdef USE_ETC_RESOLVCONF_RUN
|
||||||
|
DIR *dir;
|
||||||
|
struct dirent *d;
|
||||||
|
#endif
|
||||||
|
#ifdef RUNLEVEL
|
||||||
|
struct utmp entry;
|
||||||
|
#endif
|
||||||
|
#ifdef PAM_CONSOLE
|
||||||
|
int fd;
|
||||||
|
#endif
|
||||||
|
|
||||||
chdir("/");
|
chdir("/");
|
||||||
umask(022);
|
umask(022);
|
||||||
@@ -155,23 +238,28 @@ 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();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse configuration file
|
* Parse configuration file
|
||||||
*/
|
*/
|
||||||
@@ -181,9 +269,9 @@ int main()
|
|||||||
fgets(line, LINE_SIZE, f);
|
fgets(line, LINE_SIZE, f);
|
||||||
chomp(line);
|
chomp(line);
|
||||||
|
|
||||||
if (debug)
|
_d("conf: %s", line);
|
||||||
printf("conf: %s\n", line);
|
|
||||||
|
|
||||||
|
/* Do this before mounting / read-write */
|
||||||
if (MATCH_CMD(line, "check ", x)) {
|
if (MATCH_CMD(line, "check ", x)) {
|
||||||
strcpy(cmd, "/sbin/fsck -C -a ");
|
strcpy(cmd, "/sbin/fsck -C -a ");
|
||||||
build_cmd(cmd, x, CMD_SIZE);
|
build_cmd(cmd, x, CMD_SIZE);
|
||||||
@@ -195,26 +283,74 @@ 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);
|
||||||
system(cmd);
|
system(cmd);
|
||||||
continue;
|
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);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
setsid();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mount filesystems
|
* Mount filesystems
|
||||||
*/
|
*/
|
||||||
|
_d("mount filesystems");
|
||||||
|
|
||||||
#ifdef REMOUNT_ROOTFS_RW
|
#ifdef REMOUNT_ROOTFS_RW
|
||||||
system("/bin/mount -n -o remount,rw /");
|
system("/bin/mount -n -o remount,rw /");
|
||||||
#endif
|
#endif
|
||||||
@@ -225,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");
|
||||||
@@ -234,15 +369,18 @@ int main()
|
|||||||
mount("none", "/proc/bus/usb", "usbfs", 0, NULL);
|
mount("none", "/proc/bus/usb", "usbfs", 0, NULL);
|
||||||
mount(SYSROOT, "/", NULL, MS_MOVE, NULL);
|
mount(SYSROOT, "/", NULL, MS_MOVE, NULL);
|
||||||
|
|
||||||
|
_d("make devices");
|
||||||
#ifdef MAKE_DEVICES
|
#ifdef MAKE_DEVICES
|
||||||
mkdir("/dev/input", 0755);
|
mkdir("/dev/input", 0755);
|
||||||
chardev("/dev/urandom", 0666, 1, 9);
|
chardev("/dev/urandom", 0666, 1, 9);
|
||||||
chardev("/dev/ptmx", 0666, 5, 2);
|
chardev("/dev/ptmx", 0666, 5, 2);
|
||||||
chardev("/dev/null", 0666, 1, 3);
|
chardev("/dev/null", 0666, 1, 3);
|
||||||
|
chmod("/dev/null", 0666);
|
||||||
chardev("/dev/mem", 0640, 1, 1);
|
chardev("/dev/mem", 0640, 1, 1);
|
||||||
chmod("/dev/null", 0667);
|
|
||||||
chmod("/dev/mem", 0640);
|
|
||||||
chardev("/dev/tty0", 0660, 4, 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/mice", 0660, 13, 63);
|
||||||
chardev("/dev/input/event0", 0660, 13, 64);
|
chardev("/dev/input/event0", 0660, 13, 64);
|
||||||
chardev("/dev/agpgart", 0660, 10, 175);
|
chardev("/dev/agpgart", 0660, 10, 175);
|
||||||
@@ -257,17 +395,16 @@ int main()
|
|||||||
/*
|
/*
|
||||||
* Time adjustments
|
* Time adjustments
|
||||||
*/
|
*/
|
||||||
if ((fd = open("/etc/adjtime", O_CREAT|O_WRONLY|O_TRUNC, 0644)) >= 0) {
|
_d("adjust clock");
|
||||||
write(fd, "0.0 0 0.0\n", 10);
|
|
||||||
close(fd);
|
|
||||||
}
|
|
||||||
#ifndef NO_HCTOSYS
|
#ifndef NO_HCTOSYS
|
||||||
system("/sbin/hwclock --hctosys --localtime" HWCLOCK_DIRECTISA);
|
system("/sbin/hwclock --hctosys" HWCLOCK_DIRECTISA);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Network stuff
|
* Network stuff
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef USE_ETC_RESOLVCONF_RUN
|
||||||
makepath("/dev/shm/network");
|
makepath("/dev/shm/network");
|
||||||
makepath("/dev/shm/resolvconf/interface");
|
makepath("/dev/shm/resolvconf/interface");
|
||||||
|
|
||||||
@@ -282,8 +419,27 @@ int main()
|
|||||||
|
|
||||||
closedir(dir);
|
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");
|
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");
|
touch("/etc/resolvconf/run/enable-updates");
|
||||||
|
|
||||||
chdir("/etc/resolvconf/run/interface");
|
chdir("/etc/resolvconf/run/interface");
|
||||||
@@ -293,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");
|
||||||
@@ -341,6 +498,7 @@ int main()
|
|||||||
|
|
||||||
system(GETTY "&");
|
system(GETTY "&");
|
||||||
|
|
||||||
|
_d("forking");
|
||||||
if (!fork()) {
|
if (!fork()) {
|
||||||
/* child process */
|
/* child process */
|
||||||
|
|
||||||
@@ -367,24 +525,34 @@ int main()
|
|||||||
dup2(0, 1);
|
dup2(0, 1);
|
||||||
dup2(0, 2);
|
dup2(0, 2);
|
||||||
|
|
||||||
touch("/tmp/nologin");
|
#ifdef USE_MESSAGE_BUS
|
||||||
|
_d("dbus");
|
||||||
#ifdef AGPDRV
|
mkdir("/var/run/dbus", 0755);
|
||||||
system("/sbin/modprobe agpgart");
|
mkdir("/var/lock/subsys/messagebus", 0755);
|
||||||
system("/sbin/modprobe " AGPDRV);
|
system("dbus-uuidgen --ensure;dbus-daemon --system");
|
||||||
#endif
|
#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) {
|
while (access("/tmp/shutdown", F_OK) < 0) {
|
||||||
|
_d("start X as %s\n", username);
|
||||||
if (debug) {
|
if (debug) {
|
||||||
printf("Starting X as %s\n", username);
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -394,7 +562,8 @@ 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) {
|
||||||
@@ -410,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);
|
||||||
|
|
||||||
@@ -418,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);
|
||||||
|
|||||||
+4
-5
@@ -34,12 +34,10 @@ Changelog from the original Eeepc fastinit:
|
|||||||
- Add –directisa to hwclock if user has disabled CONFIG_GENRTC and enabled
|
- 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)
|
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
|
- 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")
|
- Set loopback interface using direct calls instead of system("ifconfig")
|
||||||
- Copy 4096 data block in C instead of system("cat") or system("dd")
|
- 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")
|
- Draw shutdown splash screen using C calls instead of system("echo;cat")
|
||||||
- Change poweroff method from writing 5 to /sys/power/state to
|
- Change poweroff method to reboot(RB_POWER_OFF) (by Metalshark)
|
||||||
reboot(RB_POWER_OFF) (by Metalshark)
|
|
||||||
- Mount /var/run and /var/lock as tmpfs
|
- Mount /var/run and /var/lock as tmpfs
|
||||||
- Use SIG_IGN instead of empty signal handler (by Metalshark)
|
- Use SIG_IGN instead of empty signal handler (by Metalshark)
|
||||||
- Add built-in run-parts option to be used instead of system("run-parts")
|
- Add built-in run-parts option to be used instead of system("run-parts")
|
||||||
@@ -81,7 +79,7 @@ Changelog from the original Eeepc fastinit:
|
|||||||
sa.sa_flags = flags; \
|
sa.sa_flags = flags; \
|
||||||
sigemptyset(&sa.sa_mask); \
|
sigemptyset(&sa.sa_mask); \
|
||||||
sigaction(sig, &sa, NULL); \
|
sigaction(sig, &sa, NULL); \
|
||||||
} while(0)
|
} while (0)
|
||||||
|
|
||||||
#define touch(x) mknod((x), S_IFREG|0644, 0)
|
#define touch(x) mknod((x), S_IFREG|0644, 0)
|
||||||
|
|
||||||
@@ -103,7 +101,8 @@ int main()
|
|||||||
char *x;
|
char *x;
|
||||||
sigset_t nmask, nmask2;
|
sigset_t nmask, nmask2;
|
||||||
|
|
||||||
puts("finit-mod " VERSION " (built " __DATE__ " by " WHOAMI ")");
|
puts("finit-mod " VERSION " (built " __DATE__ " " __TIME__
|
||||||
|
" by " WHOAMI ")");
|
||||||
|
|
||||||
chdir("/");
|
chdir("/");
|
||||||
umask(022);
|
umask(022);
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <limits.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@@ -17,6 +18,8 @@
|
|||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <grp.h>
|
||||||
|
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -157,6 +160,16 @@ int run_parts(char *dir, ...)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getgroup(char *s)
|
||||||
|
{
|
||||||
|
struct group *grp;
|
||||||
|
|
||||||
|
if ((grp = getgrnam(s)) == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return grp->gr_gid;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Other convenience functions
|
* Other convenience functions
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ int makepath (char *);
|
|||||||
void ifconfig (char *, char *, char *, int);
|
void ifconfig (char *, char *, char *, int);
|
||||||
void copyfile (char *, char *, int);
|
void copyfile (char *, char *, int);
|
||||||
void chomp (char *);
|
void chomp (char *);
|
||||||
|
int getgroup (char *);
|
||||||
|
|
||||||
#ifdef BUILTIN_RUNPARTS
|
#ifdef BUILTIN_RUNPARTS
|
||||||
int run_parts (char *, ...);
|
int run_parts (char *, ...);
|
||||||
|
|||||||
Reference in New Issue
Block a user