Tiny Core Linux

Tiny Core Base => TCB Talk => Topic started by: Fazzah on April 20, 2012, 04:37:16 AM

Title: Modifying init.d scripts (udhcpc.sh, to be exact)
Post by: Fazzah on April 20, 2012, 04:37:16 AM
Hi all,

maybe it's just my Google-Fu is weak today, but I have no idea how to modify one of the init.d scripts.

Namely, I need to add "-C" option to udhcpc call on boot-time.

Any pointers?

Thanks in advance.
Title: Re: Modifying init.d scripts (udhcpc.sh, to be exact)
Post by: curaga on April 20, 2012, 04:46:29 AM
Since dhcp.sh is called after restore, you can just edit it and add to your backup.
Title: Re: Modifying init.d scripts (udhcpc.sh, to be exact)
Post by: Fazzah on April 20, 2012, 04:49:07 AM
Ok, but the problem is (I should have mentioned that before) that I'm booting off the network. Extensions and backup resides on a NFS share, which is inaccesible at boot time, because without the said option udhcpc won't ask properly for DHCP lease.
Title: Re: Modifying init.d scripts (udhcpc.sh, to be exact)
Post by: curaga on April 20, 2012, 05:15:01 AM
Then you need a remaster.
Title: Re: Modifying init.d scripts (udhcpc.sh, to be exact)
Post by: Fazzah on April 20, 2012, 05:55:36 AM
Ok, I did it according to wiki.

Any idea why original core is ~5Mb when my repackaged is ~10Mb? I've literally added only -C to the said script.
Title: Re: Modifying init.d scripts (udhcpc.sh, to be exact)
Post by: curaga on April 20, 2012, 06:31:24 AM
Please give more info. What method, what options etc.
Title: Re: Modifying init.d scripts (udhcpc.sh, to be exact)
Post by: Fazzah on April 20, 2012, 06:38:56 AM
Okay, here goes.

source image is core.gz as of today's current version.

according to http://wiki.tinycorelinux.net/wiki:remastering these are the steps:

1. zcat core.gz | sudo cpio -i -H newc -d

2. archive unpack, I edit the required file.

because no kernel modules and libs were added, I jumped straight to packing.

3. sudo find | sudo cpio -o -H newc | gzip -2 > ../core.gz

4. advdef -z4 ../core.gz

addev shows only 3% of volume decrease.

I've tried with gzip -11, no difference.
Title: Re: Modifying init.d scripts (udhcpc.sh, to be exact)
Post by: curaga on April 20, 2012, 07:22:04 AM
No idea then. Maybe there was something already in the dir? You can compare the images' cpio -t output, for example.
Title: Re: Modifying init.d scripts (udhcpc.sh, to be exact)
Post by: Fazzah on April 20, 2012, 07:34:15 AM
Well, thanks for looking anyway. It's not a big deal since it's a warehouse PC running on local LAN and is rarely rebooted, so I think I'll live with it. I'm going to throw Python and Qt on it, so i guess 5MB is not a big deal anyway.
Title: Re: Modifying init.d scripts (udhcpc.sh, to be exact)
Post by: Rich on April 20, 2012, 08:26:24 AM
Hi Fazzah
Maybe when you repacked, the original  core.gz  file was somewhere that the  find  command could see it.
Title: Re: Modifying init.d scripts (udhcpc.sh, to be exact)
Post by: Fazzah on April 20, 2012, 09:04:48 AM
the original  core.gz  file was somewhere that the  find  command could see it.

Ladies and gentlemen, we have a winner!

I'm dumb :) I thought that upon unpacking the .gz file is removed in a similar manner like .tar files.
Obviously not.

Case closed, I had my daily dose of linux knowledge with a pinch of humilation :D
Title: Re: Modifying init.d scripts (udhcpc.sh, to be exact)
Post by: Rich on April 20, 2012, 09:32:39 AM
Hi Fazzah
I'm sure everyone here has had their own  "Of course it's wrong, it did exactly what I told it to do!"  moments.