mirror of
https://github.com/troglobit/finit.git
synced 2026-10-12 10:12:32 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
08d0dc6ee9 | ||
|
|
6e2ea43e97 | ||
|
|
2679c1b1c5 | ||
|
|
d05900368f | ||
|
|
a1de36c163 | ||
|
|
8206803762 | ||
|
|
fb8c341168 | ||
|
|
7137573534 |
@@ -1,5 +1,10 @@
|
|||||||
|
0.3 ()
|
||||||
|
- 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 ()
|
0.2 (20080219)
|
||||||
- replace system("touch") with touch() in finit-mod (Metalshark)
|
- replace system("touch") with touch() in finit-mod (Metalshark)
|
||||||
- disable NO_HCTOSYS by default to match stock Eeepc kernel
|
- disable NO_HCTOSYS by default to match stock Eeepc kernel
|
||||||
- drop system("rm -f") to clean /tmp, its a fresh mounted tmpfs
|
- drop system("rm -f") to clean /tmp, its a fresh mounted tmpfs
|
||||||
|
|||||||
@@ -3,9 +3,10 @@ CFLAGS = -Os -Wall -DVERSION=\"$(VERSION)\" -DWHOAMI=\"`whoami`@`hostname`\"
|
|||||||
LD = gcc
|
LD = gcc
|
||||||
LDFLAGS =
|
LDFLAGS =
|
||||||
LIBS =
|
LIBS =
|
||||||
VERSION = 0.2
|
VERSION = 0.3
|
||||||
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
|
||||||
|
BINS = finit finit-mod finit-mdv
|
||||||
|
|
||||||
|
|
||||||
#### Configurable parameters
|
#### Configurable parameters
|
||||||
@@ -31,7 +32,7 @@ CFLAGS += -march=pentium-m
|
|||||||
.c.o:
|
.c.o:
|
||||||
$(CC) -c $(CFLAGS) -o $*.o $<
|
$(CC) -c $(CFLAGS) -o $*.o $<
|
||||||
|
|
||||||
all: finit finit-mod finit-mdv
|
all: $(BINS)
|
||||||
|
|
||||||
finit: finit.o
|
finit: finit.o
|
||||||
$(LD) $(LDFLAGS) -o $@ $+ $(LIBS)
|
$(LD) $(LDFLAGS) -o $@ $+ $(LIBS)
|
||||||
@@ -49,7 +50,7 @@ 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
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o core *~
|
rm -f *.o core *~ $(BINS)
|
||||||
|
|
||||||
finit.o: finit.c Makefile
|
finit.o: finit.c Makefile
|
||||||
|
|
||||||
|
|||||||
@@ -73,3 +73,5 @@ problems related to udev and pam.
|
|||||||
|
|
||||||
4 - Set the pointer device in the X server configuration to /dev/input/mice
|
4 - Set the pointer device in the X server configuration to /dev/input/mice
|
||||||
|
|
||||||
|
5 - Have a user named "user", or change DEFUSER in the source file
|
||||||
|
|
||||||
|
|||||||
+10
-11
@@ -171,6 +171,8 @@ int main()
|
|||||||
mount("devpts", "/dev/pts", "devpts", 0, "gid=5,mode=620");
|
mount("devpts", "/dev/pts", "devpts", 0, "gid=5,mode=620");
|
||||||
mount("tmpfs", "/dev/shm", "tmpfs", 0, NULL);
|
mount("tmpfs", "/dev/shm", "tmpfs", 0, NULL);
|
||||||
mount("tmpfs", "/tmp", "tmpfs", 0, "mode=1777,size=128m");
|
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(SYSROOT, "/", NULL, MS_MOVE, NULL);
|
mount(SYSROOT, "/", NULL, MS_MOVE, NULL);
|
||||||
|
|
||||||
unlink("/etc/mtab");
|
unlink("/etc/mtab");
|
||||||
@@ -251,13 +253,17 @@ int main()
|
|||||||
unlink(RANDOMSEED);
|
unlink(RANDOMSEED);
|
||||||
umask(077);
|
umask(077);
|
||||||
copyfile("/dev/urandom", RANDOMSEED, 4096);
|
copyfile("/dev/urandom", RANDOMSEED, 4096);
|
||||||
|
umask(0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Console setup (for X)
|
||||||
|
*/
|
||||||
|
makepath("/var/run/console");
|
||||||
|
touch("/var/run/console/" DEFUSER);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Misc setup
|
* Misc setup
|
||||||
*/
|
*/
|
||||||
unlink("/var/run/.clean");
|
|
||||||
unlink("/var/lock/.clean");
|
|
||||||
umask(0);
|
|
||||||
mkdir("/tmp/.X11-unix", 01777);
|
mkdir("/tmp/.X11-unix", 01777);
|
||||||
mkdir("/tmp/.ICE-unix", 01777);
|
mkdir("/tmp/.ICE-unix", 01777);
|
||||||
umask(022);
|
umask(022);
|
||||||
@@ -328,8 +334,6 @@ int main()
|
|||||||
*/
|
*/
|
||||||
void shutdown(int sig)
|
void shutdown(int sig)
|
||||||
{
|
{
|
||||||
int fd;
|
|
||||||
|
|
||||||
debug("shutdown");
|
debug("shutdown");
|
||||||
touch("/tmp/shutdown");
|
touch("/tmp/shutdown");
|
||||||
|
|
||||||
@@ -341,23 +345,18 @@ void shutdown(int sig)
|
|||||||
|
|
||||||
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 --localtime" HWCLOCK_DIRECTISA);
|
||||||
system("/sbin/unionctl.static / --remove / > /dev/null 2>&1");
|
|
||||||
|
|
||||||
kill(-1, SIGKILL);
|
kill(-1, SIGKILL);
|
||||||
|
|
||||||
sync();
|
sync();
|
||||||
sync();
|
sync();
|
||||||
system("/bin/mount -n -o remount,ro /");
|
system("/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);
|
||||||
|
|
||||||
if ((fd = open("/sys/power/state", O_WRONLY)) >= 0) {
|
reboot(RB_POWER_OFF);
|
||||||
write(fd, "5", 1);
|
|
||||||
close(fd);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+6
-8
@@ -38,6 +38,9 @@ Changelog from the original Eeepc fastinit:
|
|||||||
- 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
|
||||||
|
reboot(RB_POWER_OFF) (by Metalshark)
|
||||||
|
- Mount /var/run and /var/lock as tmpfs
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -149,6 +152,8 @@ int main()
|
|||||||
mount("devpts", "/dev/pts", "devpts", 0, "gid=5,mode=620");
|
mount("devpts", "/dev/pts", "devpts", 0, "gid=5,mode=620");
|
||||||
mount("tmpfs", "/dev/shm", "tmpfs", 0, NULL);
|
mount("tmpfs", "/dev/shm", "tmpfs", 0, NULL);
|
||||||
mount("tmpfs", "/tmp", "tmpfs", 0, "mode=1777,size=128m");
|
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);
|
mount("/mnt", "/", NULL, MS_MOVE, NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -271,8 +276,6 @@ int main()
|
|||||||
*/
|
*/
|
||||||
void shutdown(int sig)
|
void shutdown(int sig)
|
||||||
{
|
{
|
||||||
int fd;
|
|
||||||
|
|
||||||
touch("/tmp/shutdown");
|
touch("/tmp/shutdown");
|
||||||
|
|
||||||
kill(-1, SIGTERM);
|
kill(-1, SIGTERM);
|
||||||
@@ -283,23 +286,18 @@ void shutdown(int sig)
|
|||||||
|
|
||||||
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 --localtime" HWCLOCK_DIRECTISA);
|
||||||
system("/sbin/unionctl.static / --remove / > /dev/null 2>&1");
|
|
||||||
|
|
||||||
kill(-1, SIGKILL);
|
kill(-1, SIGKILL);
|
||||||
|
|
||||||
sync();
|
sync();
|
||||||
sync();
|
sync();
|
||||||
system("/bin/mount -n -o remount,ro /");
|
system("/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);
|
||||||
|
|
||||||
if ((fd = open("/sys/power/state", O_WRONLY)) >= 0) {
|
reboot(RB_POWER_OFF);
|
||||||
write(fd, "5", 1);
|
|
||||||
close(fd);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -240,14 +240,12 @@ void shutdown(int sig)
|
|||||||
|
|
||||||
system("/usr/sbin/alsactl store > /dev/null 2>&1");
|
system("/usr/sbin/alsactl store > /dev/null 2>&1");
|
||||||
system("/sbin/hwclock --systohc --localtime");
|
system("/sbin/hwclock --systohc --localtime");
|
||||||
system("/sbin/unionctl.static / --remove / > /dev/null 2>&1");
|
|
||||||
|
|
||||||
kill(-1, SIGKILL);
|
kill(-1, SIGKILL);
|
||||||
|
|
||||||
sync();
|
sync();
|
||||||
sync();
|
sync();
|
||||||
system("/bin/mount -n -o remount,ro /");
|
system("/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)
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ int makepath(char *p)
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
do { *x++ = *p++; } while (*p && *p != '/');
|
do { *x++ = *p++; } while (*p && *p != '/');
|
||||||
|
*x = 0;
|
||||||
ret = mkdir(path, 0777);
|
ret = mkdir(path, 0777);
|
||||||
} while (*p && (*p != '/' || *(p + 1))); /* ignore trailing slash */
|
} while (*p && (*p != '/' || *(p + 1))); /* ignore trailing slash */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user