Check-in [6ddf124baf]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

SHA1 Hash:6ddf124baf135218208cb84dc9b098ad68afc37a
Date: 2012-04-09 13:10:24
User: BarryK
Comment:support minit, process-1 service manager alternative to init

Tags And Properties
Changes

Changes to woof-code/rootfs-skeleton/sbin/initNEW

@@ -1,17 +1,22 @@
 #!/bin/sh
 #(c) Copyright Barry Kauler 2010, bkhome.org
 #Lesser GPL license v2 (/usr/share/doc/legal/lgpl-2.1.txt
+#note, 3builddistro (in Woof) renames rootfs-skeleton/sbin/initNEW to init.
 #perform a f.s. check if file /fsckme.flg exits, otherwise normal startup.
 #/etc/rc.d/rc.sysinit creates /fsckme.flg at bootup, rc.shutdown deletes it.
 #this script is /sbin/init in the main Puppy f.s., which is the very first to run.
 #in the case of not a full hd install, this script just passes execution to busybox init.
 #100911 fsckme.err filename changed to fsckme.flg. see also init (initramfs), rc.sysinit, rc.shutdown.
 #101020 no longer have /etc/modprobe.conf.
+#120408 support minit
+
+INITEXE='/bin/busybox init'
+[ -f /sbin/minit ] && INITEXE='/sbin/minit'
 
-[ -d /initrd ] && exec /bin/busybox init #not a full hd install.
-[ ! -e /fsckme.flg ] && exec /bin/busybox init #no error.
+[ -d /initrd ] && exec ${INITEXE} #not a full hd install.
+[ ! -e /fsckme.flg ] && exec ${INITEXE} #no error.
 
 PATH='/bin:/sbin'
 export LANG=C
 
 #only come here if full hd install, and previous improper shutdown.
@@ -132,10 +137,10 @@
  *)
   echo -e "\\033[1;31m"  >/dev/console #34=blue, 33=yellow, 32=green, 31=red, 35=purple, 36=aquablue, 38=black.
   echo -n "Previous improper shutdown, sorry can only do f.s. check of ext2/3/4. Rebooting..." > /dev/console
   echo -e "\\033[0;39m" >/dev/console
   sleep 5
-  exec /bin/busybox init
+  exec ${INITEXE}
  ;;
 esac
 
 ###END###

Changes to woof-code/rootfs-skeleton/sbin/poweroff

@@ -1,8 +1,13 @@
 #!/bin/sh
 #110505 support sudo for non-root user.
+#120408 support minit
 
 [ "`whoami`" != "root" ] && exec sudo -A ${0} ${@} #110505
 
 /etc/rc.d/rc.shutdown
 
-exec /bin/busybox poweroff
+POWEROFFEXE='/bin/busybox poweroff'
+#[ -f /sbin/minit ] && POWEROFFEXE='/sbin/shutdown -o' #-o means poweroff. note: shutdown is part of minit pkg.
+[ -f /sbin/minit ] && POWEROFFEXE='hard-reboot POWER_OFF' #note: hard-reboot is part of minit pkg.
+
+exec ${POWEROFFEXE} #>/dev/null 2>&1

Changes to woof-code/rootfs-skeleton/sbin/reboot

@@ -1,8 +1,13 @@
 #!/bin/sh
 #110505 support sudo for non-root user.
+#120408 support minit
 
 [ "`whoami`" != "root" ] && exec sudo -A ${0} ${@} #110505
 
 /etc/rc.d/rc.shutdown
 
-exec /bin/busybox reboot
+REBOOTEXE='/bin/busybox reboot'
+#[ -f /sbin/minit ] && REBOOTEXE='/sbin/shutdown -r' #-r means reboot. note, shutdown is part of minit pkg.
+[ -f /sbin/minit ] && REBOOTEXE='hard-reboot RESTART' #note, hard-reboot is part of minit pkg.
+
+exec ${REBOOTEXE} #>/dev/null 2>&1

Changes to woof-code/rootfs-skeleton/usr/sbin/loginmanager

@@ -1,9 +1,11 @@
 #!/bin/sh
+#note, root2user called via shutdownconfig, changes root to fido.
 #110507 TaZOC bug fix.
 #120201 rodin.s: internationalized.
 #120323 replace 'xmessage' with 'pupmessage'.
+#120409 if using minit instead of busybox init.
 
 export TEXTDOMAIN=loginmanager
 export TEXTDOMAINDIR=/usr/share/locale
 export OUTPUT_CHARSET=UTF-8
 
@@ -59,8 +61,13 @@
    pupmessage -bg red -title "$(gettext 'LoginManager: error')" -center "$(gettext 'Sorry, admin password is wrong')"
    exit
   fi
   rootEXPR="s%^tty1.*%tty1::respawn:/sbin/mingetty --autologin root tty1%"
   sed -i -e "$rootEXPR" /etc/inittab #110507 TaZOC bug fix.
+  #120409 if using minit instead of busybox init...
+  if [ -f /etc/minit/getty/1/params  ];then #see my minit pet pkg.
+   EXPR2='s%^fido$%root%'
+   sed -i -e "$EXPR2" /etc/minit/getty/1/params
+  fi
   pupmessage -bg green -center -title "$(gettext 'Login Manager: OK')" "$(gettext 'Ok, you will be administrator at next boot')"
  fi
 #fi

Changes to woof-code/rootfs-skeleton/usr/sbin/root2user

@@ -1,11 +1,13 @@
 #!/bin/sh
 #Barry Kauler, April 2011, GPL3 (/usr/share/doc/legal)
 #intended to be called by rc.shutdown on 1st boot, create a non-root saved session.
+#note, /usr/sbin/loginmanager is able to revert fido back to root.
 #110918 run with or without X.
 #111003 change from Xdialog to pupdialog.
 #120317 L18L: set group/permissions for /dev/console
+#120409 if using minit instead of busybox init.
 
 . /etc/rc.d/PUPSTATE
 
 #ask for a username? i don't think that is required.
 NEWUSER='fido'
@@ -59,10 +61,15 @@
 #chown -h -R ${NEWUSER}:users /tmp
 
 #modify /etc/inittab to autologin as fido...
 userEXPR='s%autologin root %autologin fido %'
 sed -i -e "$userEXPR" /etc/inittab
+#120409 if using minit instead of busybox init...
+if [ -f /etc/minit/getty/1/params  ];then #see my minit pet pkg.
+ EXPR2='s%^root$%fido%'
+ sed -i -e "$EXPR2" /etc/minit/getty/1/params
+fi
 
 #stuff from pizzasgood, http://www.murga-linux.com/puppy/viewtopic.php?t=47410
 #i don't know why setting these /dev permissions reverts to that in rootfs-skeleton
 #on next boot, so have changed them in rootfs-skeleton also...
 # ...oh, i think snapmergepuppy (when boot from usb) does not save /dev.