WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Simple script  (Read 6448 times)

Offline TC_Noob

  • Newbie
  • *
  • Posts: 8
Simple script
« on: May 16, 2014, 04:11:28 PM »
Hi, Linux noob here.  I want to modify the isolinux.cfg file:
Code: [Select]
display boot.msg
default microcore
label microcore
kernel /boot/vmlinuz
append initrd=/boot/core.gz loglevel=3

label mc
kernel /boot/vmlinuz
append initrd=/boot/core.gz loglevel=3
implicit 0
prompt 1
timeout 300
F1 boot.msg
F2 f2
F3 f3
F4 f4
...to bypass the prompt to press <Enter>, F2, F3 or F4 and instead boot to a message like "hello world, press any key", and when the user presses a key it displays the current IP address (by invoking IFCONFIG ETH0). 

Sounds simple enough, just need help getting started...

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Simple script
« Reply #1 on: May 16, 2014, 04:38:36 PM »
There is no current IP address.  Core is not running at this point.

Offline TC_Noob

  • Newbie
  • *
  • Posts: 8
Re: Simple script
« Reply #2 on: May 16, 2014, 04:54:47 PM »
Ok, but when booting, I hit enter and get to the prompt and IFCONFIG eth0 works.  How would I remove the need to press Enter (I assume to remove a few lines from the isolinux.cfg file) and display the address?

Offline TC_Noob

  • Newbie
  • *
  • Posts: 8
Re: Simple script
« Reply #3 on: May 16, 2014, 04:59:23 PM »
Ok, but when booting, I hit enter and get to the prompt and IFCONFIG eth0 works.  How would I remove the need to press Enter (I assume to remove a few lines from the isolinux.cfg file) and display the address?

- Confirmed.  It goes straight to the prompt when modified to:
Code: [Select]
display boot.msg
default microcore
label microcore
kernel /boot/vmlinuz
append initrd=/boot/core.gz loglevel=3

label mc
kernel /boot/vmlinuz
append initrd=/boot/core.gz loglevel=3

So at this point, I just want a prompt to press a key, then after pressing a key to display the result of IFCONFIG ETH0.
« Last Edit: May 16, 2014, 05:02:44 PM by TC_Noob »

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Simple script
« Reply #4 on: May 16, 2014, 05:13:12 PM »
If you hit enter, you boot core.
When you get a prompt, you are in core, not the boot loader.
If you want to show your IP address, you need to have a persistent tce directory.
Then you can add a script to /opt/bootlocal that loops until an IP address has been assigned, and then displays the IP address.
Look at /etc/init.d/settime.sh as an example on how to wait until an IP address is assigned.

Offline TC_Noob

  • Newbie
  • *
  • Posts: 8
Re: Simple script
« Reply #5 on: June 03, 2014, 05:02:46 PM »
Thanks for your help, gerald_clark

I was able to use settime.sh as a starting point to get my script working (in bootsync.sh).  Now I'd like to create an ISO out of my small TinyCore USB "distro" that I can share with colleagues, but the line in syslinux.cfg:
Code: [Select]
APPEND initrd=/tce/boot/core.gz quiet  waitusb=5:UUID="A4C9-9126" tce=UUID="A4C9-9126" ...seems to personalize the environment to my specific USB drive.  It gives an error "no caching mode page present" and goes straight to the CLI prompt when booting from another USB drive.

How can I modify my working USB utility so that an ISO can be created and installed on other USB drives?
« Last Edit: June 03, 2014, 05:06:45 PM by TC_Noob »

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Simple script
« Reply #6 on: June 03, 2014, 05:23:44 PM »
You need to change the syslinux.cfg to contain the UUID of the partition on the new drive.

You might want to look at ezremaster.

Offline TC_Noob

  • Newbie
  • *
  • Posts: 8
Re: Simple script
« Reply #7 on: June 03, 2014, 06:00:10 PM »
Isn't there a "drive agnostic" setting?  We are in a Windows environment and I'd like people to create their own USB drives from an ISO file (which they know how to do in win). 

It doesn't have to be writeable, can't it just be like a read-only version?

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Simple script
« Reply #8 on: June 03, 2014, 06:14:17 PM »
If there is only one tce directory on all attached drives, it is not necessary to specify the tce= boot option.
Just include 'waitusb=5'

Offline TC_Noob

  • Newbie
  • *
  • Posts: 8
Re: Simple script
« Reply #9 on: June 03, 2014, 06:30:43 PM »
So syslinux.cfg now reads:
Code: [Select]
DEFAULT core
LABEL core
KERNEL /tce/boot/vmlinuz
APPEND initrd=/tce/boot/core.gz quiet  waitusb=5

The script now runs correctly but it still gives three
Quote
sd 6:0:0:0: [sdb] No Caching mode page present
right after it starts the udev daemon.

Offline TC_Noob

  • Newbie
  • *
  • Posts: 8
Re: Simple script
« Reply #10 on: June 04, 2014, 12:24:40 PM »
I just used ezremaster to get a working ISO.  Thanks for your help!

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: Simple script
« Reply #11 on: June 04, 2014, 01:52:12 PM »

The script now runs correctly but it still gives three
Quote
sd 6:0:0:0: [sdb] No Caching mode page present
right after it starts the udev daemon.
you may use loglevel=3 in place of quiet to hide the erroneous message which is normal response to a USB thumb drive

Code: [Select]
APPEND initrd=/tce/boot/core.gz loglevel=3 waitusb=5
« Last Edit: June 04, 2014, 01:53:43 PM by coreplayer2 »