grub2 a runlevel

Daniel Dawid Majewski light-i at o2.pl
Tue Dec 29 18:34:50 CET 2009


W odpowiedzi na wiadomość z dnia 12.29.2009 r. 15:13, od Patryka Zawadzkiego:
>>> Ja myślałem, żeby to porządnie zrobić, a nie każdą cyferkę osobno
>>> traktować. No i "yesX" nie po angielsku i chyba zbędne :)
Patrz załącznik. Ograniczyłem runlevele numeryczne do 1-5, jako, że 0 i 6 jako domyślne są raczej nieprzydatne, a innych
nie mamy... ;)
Wszelkie uwagi pożądane... ;)
-- 
Pozdrawiam,
Daniel Dawid Majewski
jabber:light-i/pld-users.org
-------------- next part --------------
--- /etc/init/jobs.d/rc-default.oryg	2009-03-19 18:02:13.000000000 +0100
+++ /etc/init/jobs.d/rc-default	2009-12-29 18:00:30.000000000 +0100
@@ -9,12 +9,12 @@
 script
 	runlevel --reboot || true
 
-	if grep -q -w -- "-s\|single\|S" /proc/cmdline; then
-	    telinit S
-	elif grep -q -w -- "noX" /proc/cmdline; then
-	    telinit 3
+RL="$(sed -n -e 's/.*\(^\|\s\)\([1-5]\|S\|single\|-s\|noX\|X\)\(\s\|$\).*/\2/p' /proc/cmdline | sed  -e 's/single\|-s/S/;s/noX/3/;s/X/5/' || true)"
+
+if [ -n "$RL" ]; then
+		telinit $RL
 	elif [ -r /etc/inittab ]; then
-	    RL="$(sed -n -e "/^id:[0-9]*:initdefault:/{s/^id://;s/:.*//;p}" /etc/inittab || true)"
+	    RL="$(sed -n -e "/^id:[1-5]*:initdefault:/{s/^id://;s/:.*//;p}" /etc/inittab || true)"
 	    if [ -n "$RL" ]; then
 		telinit $RL
 	    else


More information about the pld-devel-pl mailing list