WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: adding commands to bootlocal.sh  (Read 6430 times)

Offline Raven72

  • Newbie
  • *
  • Posts: 6
adding commands to bootlocal.sh
« on: November 27, 2018, 06:58:23 PM »
Hi All,

New to the forum and Tiny Core LInux (but have experience with Puppy Linux)

I would like to add simple commands to bootlocal.sh in the /opt/ folder such as  cd /  .... mount mnt/sda1 .... vi some.txt (to automatically open a text file in vi) and other simple shell comands

My problem is that bootlocal.sh is write protected and I have been unable to change the permission with chmod

I have looked at the FAQ and are more confused than when I started

any assistance would be appriciated

Cheers,
Matt

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11705
Re: adding commands to bootlocal.sh
« Reply #1 on: November 27, 2018, 08:07:01 PM »
Hi Raven72
Did you try:
Code: [Select]
sudo chown tc:staff /opt/bootlocal.sh
sudo chmod 775 /opt/bootlocal.sh

Offline Raven72

  • Newbie
  • *
  • Posts: 6
Re: adding commands to bootlocal.sh
« Reply #2 on: November 27, 2018, 09:23:38 PM »
thank you this worked for saving the changes to bootlocal.sh - the only issue now is when I re-boot the changes are not there and bootlocal.sh has gone back to it's 'default' file

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11705
Re: adding commands to bootlocal.sh
« Reply #3 on: November 27, 2018, 09:28:35 PM »
Hi Raven72
Sounds like you didn't run a backup. Make your changes again, then run:
Code: [Select]
filetool.sh -bvI would also suggest you take an hour to read this really fine book:
http://tinycorelinux.net/book.html

Offline Raven72

  • Newbie
  • *
  • Posts: 6
Re: adding commands to bootlocal.sh
« Reply #4 on: November 27, 2018, 09:38:23 PM »
and where is filetool.sh located?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11705
Re: adding commands to bootlocal.sh
« Reply #5 on: November 27, 2018, 09:46:08 PM »
Hi Raven72
filetool.sh  is the script that performs your backup and is located in  /usr/bin/.

Offline Raven72

  • Newbie
  • *
  • Posts: 6
Re: adding commands to bootlocal.sh
« Reply #6 on: November 27, 2018, 10:03:32 PM »
does sda1 need to be mounted with a directory to save the changes to?

I got filetool.sh -b to work (without v) - but on reboot the changes were not saved - is there any particular shutdown procedure I need to perform, or just a ctrl-alt-del reboot is fine (I am working command line only without a GUI) ?
« Last Edit: November 27, 2018, 10:09:29 PM by Raven72 »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11705
Re: adding commands to bootlocal.sh
« Reply #7 on: November 27, 2018, 10:19:39 PM »
Hi Raven72
Quote
... is there any particular shutdown procedure I need to perform ...
You can run:
Code: [Select]
exitcheck.sh rebootor
Code: [Select]
exitcheck.sh shutdown
What is the result for this command:
Code: [Select]
showbootcodes

Offline Raven72

  • Newbie
  • *
  • Posts: 6
Re: adding commands to bootlocal.sh
« Reply #8 on: November 27, 2018, 11:03:13 PM »
still will not save the changes for reboot

showbootcodes returns:-

initrd=ubninit loglevel=3 BOOT_IMAGE=/ubnkern


on the bootup screen there are 3 choices:-

default
microcore
mc


is there any diffrence between them as far as saving the bootlocal.sh for reboot?

Offline Raven72

  • Newbie
  • *
  • Posts: 6
Re: adding commands to bootlocal.sh
« Reply #9 on: November 28, 2018, 02:47:26 AM »
Success!!!!!

I needed the bootcodes "waitusb=5  tce=sda1" for the USB drive to be ready to save/load things, i think - at any rate, I think i understand how everything is working together


Now, I was wondering if lines can be added to bootlocal.sh like:-

cd /
cd bin
vi

in order to start vi at bootup, kind of like an MS DOS autoexec.bat file?

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14851
Re: adding commands to bootlocal.sh
« Reply #10 on: November 28, 2018, 02:57:35 AM »
If you want bootlocal to run a script, it is perhaps better to call a separate script, for example:
Code: [Select]
$ cat /opt/bootlocal.sh
~/myscript.sh
..be aware that bootlocal runs as root.

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Re: adding commands to bootlocal.sh
« Reply #11 on: November 28, 2018, 03:59:08 AM »
I think the good variant to run user startup progs as $USER ( probably tc) is to add commands to "~/.profile".

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11050
Re: adding commands to bootlocal.sh
« Reply #12 on: November 28, 2018, 04:37:03 AM »
Bootlocal is backgrounded, so you absolutely don't want to start an editor like vi there.
The only barriers that can stop you are the ones you create yourself.