Tiny Core Linux

Tiny Core Base => TCB Tips & Tricks => Topic started by: mocore on March 22, 2023, 02:55:19 PM

Title: avoid remaster? modify core base via extensions ?
Post by: mocore on March 22, 2023, 02:55:19 PM
reading through the forum on some vaguely related tangents
that requite modification of tc base core gz files.

avoid remaster! modify system via extensions (processed before the autologin)
the technique described in this post  https://forum.tinycorelinux.net/index.php/topic,2754.msg14168.html#msg14168 ( Multi-user system? )

I tried this very thing. I discovered you cannot effect a change in /etc/inittab until after tc-config exits because it is run by init. Therefore there is no opportunity to prevent auto-login via this method unless you remaster. However, since extensions are processed before the autologin you have the opportunity to modify /root/.profile.

I created an extension that saves the current /root/.profile and replaces it with one which will:
1) Copy /etc/inittab-save over /etc/inittab (you may wish to copy a custom one or otherwise modify the original /etc/inittab)
2) Reload init (kill -SIGHUP 1)
3) Restore the original /root/.profile
4) Logout (via exit)

The autologin processes this new /root/.profile. It reloads the desired /etc/inittab and logs out. Thus, autologin never occurs more than once, and the user is never presented with a shell. The TC developers could modify the stock /root/.profile to detect a boot parameter and execute logic that effects the same changes.

With some other extensions to enable NIS, LDAP, or create local users, this can enable a conventional multi-user system. My extension contains two files:

usr/local/tce.installed/noautologin
mv /root/.profile /root/.profile.orig
mv /root/.profile.noautologin /root/.profile

root/.profile.noautologin
#!/bin/sh
if [ -e /root/.profile.orig ]; then
cp /etc/inittab-save /etc/inittab
kill -SIGHUP 1
mv /root/.profile.orig /root/.profile
exit
fi


 
it appears a boot code was added to handle multi-user case ,
Tiny Core V2.3 is now posted at http://distro.ibiblio.org/pub/linux/distributions/tinycorelinux/2.x/release/
...
* New noautologin boot code. Be sure to have passwords setup, working, and saved.
...

i wander *(if its still works/ is relevant? .. i guess alot has changed since 2.2  :o)
..could this method be utilized beyond the scope  of  multi-user cfg? 
eg : for other functions requiring the modification of /etc/inittab ...

..if so perhaps the pretce boot code (to load (driver?).tcz's "early" could have potential ?

wrt :  vaguely related tangents
could the modifications mentioned in  "Console on a Serial Port" https://forum.tinycorelinux.net/index.php/topic,11218.msg58783.html#msg58783
achievable via tcz ???