Tiny Core Base > Micro Core

Permanent disable DHCP + run script at startup

(1/3) > >>

personage:
I'm working on a customized version of microcore-current, but have ran into problems.
I want the OS to:
1) Permanently skip setting up network (as I won't need it, ever)
2) Run a script when startup is finished.

1)
So basically I've followed the Remaster-guide from wiki, and it seems like I want to edit /etc/init.d/tc-config, right? But I can't understand which part I'll have to delete to skip the network-configuration during boot.

2)
I would probably need to use a cron-job here, right? But where to put the script in that case?
The script looks like this:

--- Code: ---#!/bin/bash
sudo su
cd /home/tc
dd if=/dev/sda of=mbr.backup bs=446 count=1
md5sum -c mbr.backup md5.txt

--- End code ---
I need to view the output, so it can't be hidden in the background.

danielibarnes:
1) You need to prevent dhcp.sh from running. Three solutions:
1.1) The most common way to do this is with the "nodhcp" boot parameter.
1.2) Set NODHCP=1 at the beginning of /etc/init.d/tc-config and remaster.
1.3) To avoid remastering, replace /etc/init.d/dhcp.sh with an empty script in a backup file.

2) No cron job needed. The /opt/bootlocal.sh is executed in the background at the end of /etc/init.d/tc-config. Two solutions:
2.1) Remove the '&' at the end of the "/opt/bootlocal.sh &" line in /etc/init.d/tc-config. It will then run in the foreground.
2.2) To avoid remastering, you could add code to /root/.profile and put that file in your backup.

There are other ways as well, depending on what you are trying to do.

gerald_clark:
1. Add the 'nodhcp' boot option.
2. Add your script to /opt/bootlocal.sh

personage:
1) I made an empty /etc/init.d/dhcp.sh, and it works like a charm, so thanks for the quick replies.

2) This is however still bothering me. I've placed the script in /opt/bootlocal.sh and have removed the "&" after the line in tc-config, but the script refuses to run.

I tried the following command, just to see whether the script could run manually on TC/MC or not, and it seems like a no-go, but why?

--- Code: ---$ sudo su
# cd /opt
# ./bootlocal.sh
sh: ./bootlocal.sh: not found

--- End code ---
Then I used the ls-command to verify, that the script actually existed in /opt, and it did.
I've done chmod u+x before I moved the script to /opt from my native system (Ubuntu)


Current /opt/bootlocal.sh:

--- Code: ---#!/bin/bash
echo helloworld
--- End code ---

gerald_clark:
use ls -l to verify that it is executable.

Navigation

[0] Message Index

[#] Next page

Go to full version