WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

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

Offline Raven72

  • WikiUser
  • *
  • Posts: 6
adding commands to bootlocal.sh
« on: November 27, 2018, 03: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

Online Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 6004
Re: adding commands to bootlocal.sh
« Reply #1 on: November 27, 2018, 05: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

  • WikiUser
  • *
  • Posts: 6
Re: adding commands to bootlocal.sh
« Reply #2 on: November 27, 2018, 06: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

Online Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 6004
Re: adding commands to bootlocal.sh
« Reply #3 on: November 27, 2018, 06: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

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

Online Rich

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

Offline Raven72

  • WikiUser
  • *
  • Posts: 6
Re: adding commands to bootlocal.sh
« Reply #6 on: November 27, 2018, 07: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, 07:09:29 PM by Raven72 »

Online Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 6004
Re: adding commands to bootlocal.sh
« Reply #7 on: November 27, 2018, 07: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

  • WikiUser
  • *
  • Posts: 6
Re: adding commands to bootlocal.sh
« Reply #8 on: November 27, 2018, 08: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

  • WikiUser
  • *
  • Posts: 6
Re: adding commands to bootlocal.sh
« Reply #9 on: November 27, 2018, 11:47:26 PM »
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: 10199
Re: adding commands to bootlocal.sh
« Reply #10 on: November 27, 2018, 11:57:35 PM »
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

  • WikiUser
  • *
  • Posts: 13
Re: adding commands to bootlocal.sh
« Reply #11 on: November 28, 2018, 12: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: 9879
Re: adding commands to bootlocal.sh
« Reply #12 on: November 28, 2018, 01: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.