WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Minor clean-up in tinycore.gz  (Read 5284 times)

Offline dmoerner

  • Newbie
  • *
  • Posts: 14
Minor clean-up in tinycore.gz
« on: December 05, 2008, 01:09:27 AM »
So I was bored this evening and decided to open up tinycore.gz and try to figure out how TCL boots.  I also found a few things you might want to fix (mostly cruft).

etc/init.d/tc-config (and rcS by symlink): The first fix uses grep -q in the actual if function without the intermediate test, this is also the same behavior as used in line 267 so I don't believe this was a coding style choice.  The two methods should produce the same results unless I'm missing something.

The second part of the patch fixes an incorrect path to crond.

Code: [Select]
diff -pruN initrd.old/etc/init.d/tc-config initrd/etc/init.d/tc-config
--- initrd.old/etc/init.d/tc-config 2008-12-04 21:36:58.000000000 -0800
+++ initrd/etc/init.d/tc-config 2008-12-04 21:49:30.000000000 -0800
@@ -248,8 +248,7 @@ else
      fi
    fi
    # Final test for /usr/local mount and call setup routines for libraries, modules, and menu.
-   grep -q \/usr\/local /etc/mtab
-   if [ "$?" == "0" ]; then
+   if grep -q \/usr\/local /etc/mtab; then
      /sbin/ldconfig
      /sbin/depmod -a
      cp /opt/.tce_menu/jwm/menu_template /usr/local/tce.menu/menu
@@ -340,7 +339,7 @@ fi
 [ -n "$SSH" ] && /etc/init.d/dropbear start >/dev/null && echo " ${GREEN}ssh started.${NORMAL}"
 
 if [ -n "$CRON" ]; then
-  /usr/sbin/bin/crond
+  /usr/sbin/crond
   if [ "$?" == 0 ]; then echo " ${GREEN}cron started.${NORMAL}"; fi
 fi
 if [ -n "$LAPTOP" ]; then

etc/init.d/tc-functions: This function was probably written for a reason and isn't worth actually deleting, but (a) /etc/init.d/hwclockfirst.sh doesn't exist anymore and (b) the function isn't used when the time is set in /etc/init.d/tc-config anyway.

Code: [Select]
diff -pruN initrd.old/etc/init.d/tc-functions initrd/etc/init.d/tc-functions
--- initrd.old/etc/init.d/tc-functions 2008-12-04 21:36:58.000000000 -0800
+++ initrd/etc/init.d/tc-functions 2008-12-04 21:39:23.000000000 -0800
@@ -58,15 +58,6 @@ echo $INFO
 return 0
 }
 
-settime(){
-TZ="$(getbootparam 'tz')"
-if [ -n "$TZ" ]; then
-   export TZ="$TZ"
-   /etc/init.d/hwclockfirst.sh start
-fi
-return 0
-}
-
 rotdash(){
 p=$1
 while [ -d /proc/$p ]

root/.ash_history: This is a relic I think...

Code: [Select]
diff -pruN initrd.old/root/.ash_history initrd/root/.ash_history
--- initrd.old/root/.ash_history 2008-12-04 21:36:58.000000000 -0800
+++ initrd/root/.ash_history 1969-12-31 16:00:00.000000000 -0800
@@ -1,39 +0,0 @@
-cd /dev/
-ls -l fd0*
-mknod /dev/fd0D360 b 2 12
-mknod /dev/fd0D720 b 2 16
-mknod /dev/fd0H1440 b 2 28
-mknod /dev/fd0H1722 b 2 60
-chmod g+w /dev/fd0*
-cat /etc/group
-cat /etc/passwd
-delgroup audio
-cat /etc/gshadow
-vi /etc/group
-cat /etc/group
-cat /etc/group /etc/gshadow
-delgroup www
-cat /etc/group /etc/gshadow
-cat /etc/group
-cat /etc/gshadow
-addgroup --help
-addgroup -g 25 dsl floppy
-addgroup -g 25 floppy
-cat /etc/group
-cat /etc/gshadow
-cat /etc/group
-adduser --help
-adduser -g floppy dsl
-addgroup --help
-addgroup dsl floppy
-cat /etc/group
-cat /etc/gshadow
-pwd
-ls -la fdo*
-ls -la fd0*
-chown root.floppy fd0*
-ls -la fd0*
-exit
-depmod -a
-uname -a
-exit

A couple more questions:

First, the cdrom is not mounted once the system has fully booted.  However, I'm not sure when it is mounted/unmounted.  If it is mounted during the boot process then:

Code: [Select]
./rcS:471:[ -n "$EJECT" ] && eject /dev/cdrom
might want to take advantage of getbootdevice in /etc/init.d/tc-functions.

Second, are there any plans to integrate ethernet device autodetection into the startup scripts?  This certainly seems to be a common question in the IRC channel.  You could probably use udev to do this but I'm not familiar with the method.  Alternatively, you could use a shell script for it:

Code: [Select]
for i in `lspci -k | grep Ethernet -A 2 | awk -F : '/Kernel module/{print $2}'`; do
    modprobe "$i" 2>&1 >/dev/null
done

Once again--this looks like a very well implemented boot system to my untrained eye.  Excellent work.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11050
Re: Minor clean-up in tinycore.gz
« Reply #1 on: December 05, 2008, 11:02:06 AM »
It always takes new eyes to see things. Nice fixes IMO.

The cdrom is not mounted at all specifically, temporarily during the tce and backup scan though. It should only be mounted at that time if there is a tce dir on it, and since it takes a boot argument to reach that, I doubt anyone who wants to use the cd makes it eject.

The ethernet scan should not be needed, as udev loads every module with a matching id automatically. It's however a known thing that not all device id's are yet put in the drivers, testified by the ongoing addition of them. It's being thought of, the best method to do a scan like that.
The only barriers that can stop you are the ones you create yourself.

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Minor clean-up in tinycore.gz
« Reply #2 on: December 05, 2008, 01:39:27 PM »
@dmoerner, Thanks for the input and the crond bug.
There are relics from over the years that I have been writing/updating the config and functions.
I began many years ago and it grew as I was supporting DSL., I retooled it for Tiny Core and curaga and jason also helped streamline and added to it.
10+ Years Contributing to Linux Open Source Projects.