WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Modifying init.d scripts (udhcpc.sh, to be exact)  (Read 4338 times)

Offline Fazzah

  • Newbie
  • *
  • Posts: 20
Modifying init.d scripts (udhcpc.sh, to be exact)
« on: April 20, 2012, 01: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.
My extensions: lcdproc-server | lcdproc-client | darkiceWIP | icecast2WIP

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10970
Re: Modifying init.d scripts (udhcpc.sh, to be exact)
« Reply #1 on: April 20, 2012, 01:46:29 AM »
Since dhcp.sh is called after restore, you can just edit it and add to your backup.
The only barriers that can stop you are the ones you create yourself.

Offline Fazzah

  • Newbie
  • *
  • Posts: 20
Re: Modifying init.d scripts (udhcpc.sh, to be exact)
« Reply #2 on: April 20, 2012, 01: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.
My extensions: lcdproc-server | lcdproc-client | darkiceWIP | icecast2WIP

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10970
Re: Modifying init.d scripts (udhcpc.sh, to be exact)
« Reply #3 on: April 20, 2012, 02:15:01 AM »
Then you need a remaster.
The only barriers that can stop you are the ones you create yourself.

Offline Fazzah

  • Newbie
  • *
  • Posts: 20
Re: Modifying init.d scripts (udhcpc.sh, to be exact)
« Reply #4 on: April 20, 2012, 02: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.
My extensions: lcdproc-server | lcdproc-client | darkiceWIP | icecast2WIP

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10970
Re: Modifying init.d scripts (udhcpc.sh, to be exact)
« Reply #5 on: April 20, 2012, 03:31:24 AM »
Please give more info. What method, what options etc.
The only barriers that can stop you are the ones you create yourself.

Offline Fazzah

  • Newbie
  • *
  • Posts: 20
Re: Modifying init.d scripts (udhcpc.sh, to be exact)
« Reply #6 on: April 20, 2012, 03: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.
My extensions: lcdproc-server | lcdproc-client | darkiceWIP | icecast2WIP

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10970
Re: Modifying init.d scripts (udhcpc.sh, to be exact)
« Reply #7 on: April 20, 2012, 04:22:04 AM »
No idea then. Maybe there was something already in the dir? You can compare the images' cpio -t output, for example.
The only barriers that can stop you are the ones you create yourself.

Offline Fazzah

  • Newbie
  • *
  • Posts: 20
Re: Modifying init.d scripts (udhcpc.sh, to be exact)
« Reply #8 on: April 20, 2012, 04: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.
My extensions: lcdproc-server | lcdproc-client | darkiceWIP | icecast2WIP

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11257
Re: Modifying init.d scripts (udhcpc.sh, to be exact)
« Reply #9 on: April 20, 2012, 05:26:24 AM »
Hi Fazzah
Maybe when you repacked, the original  core.gz  file was somewhere that the  find  command could see it.

Offline Fazzah

  • Newbie
  • *
  • Posts: 20
Re: Modifying init.d scripts (udhcpc.sh, to be exact)
« Reply #10 on: April 20, 2012, 06: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
My extensions: lcdproc-server | lcdproc-client | darkiceWIP | icecast2WIP

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11257
Re: Modifying init.d scripts (udhcpc.sh, to be exact)
« Reply #11 on: April 20, 2012, 06: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.