WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Core-11.1 Executing Bash script from profile.d - Runs 2 times before Exiting  (Read 8748 times)

Offline polikuo

  • Hero Member
  • *****
  • Posts: 758
I have to go the remastering path then.

You don't have to remaster.

Remastering means creating a new ISO of your taste.

You just have to modify specific files and backup to mydata.tgz

Pretty simple, edit the filles then run filetool.sh -b

Offline pek

  • Full Member
  • ***
  • Posts: 111
Hi polikuo,
Wow..!! I did not know this. ;)
Quote
You just have to modify specific files and backup to mydata.tgz

I'll re-read the book again and also find more info about this. See, I think there are many things I still missed and don't understand just by reading.

Meanwhile, I guess I can just do this to make mydata.tgz ??
1. Boot in to Core-11.1
2. Do as you suggested below
Quote
Just copy that script to /home/tc/.local/bin
Then add
Code: [Select]
su tc -c '/home/tc/.local/bin/the_script'
to your /opt/bootlocal.sh instead.
3. run filetool.sh -b

And that will produce mydata.tgz which then I can put eg. in root of my USB stick and it will be loaded upon boot. Is that correct?

Thank you for pointing this out. This is probably the best solution for me.
Because this mydata.tgz is also portable as similar to tcz (I can just copy and reuse them easily). ;D

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11704
Hi pek
... And that will produce mydata.tgz which then I can put eg. in root of my USB stick and it will be loaded upon boot. Is that correct? ...
That will leave  mydata.tgz  in your  tce  directory, which is where you should leave it. When you boot, Tinycore
automatically restores the contents of  mydata.tgz  to the file system after it finishes loading extensions.

Offline pek

  • Full Member
  • ***
  • Posts: 111
Hi Rich & polikuo,
I run filetool.sh -b
then I also tries sudo filetool.sh -b
But I can not find mydata.tgz anywhere  :'(
No error messages whatsoever. So I guess it went well. But where is it??

What I did was:
1. Boot Core-11.1.iso
2. mount my USB drive
3. copy test.txt to /home/tc/
4. filetool.sh -b

Quote
That will leave  mydata.tgz  in your  tce  directory, which is where you should leave it.
where is this tce directory??

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Hi, pek!

You can easily find Your actual tce  directory using
Code: [Select]
readlink /etc/sysconfig/tcedir
/etc/sysconfig/tcedir link is being created during every boot, pointing the actual tce directory, which can vary according to the "tce=" bootcode in Your bootloder config.

Have a nice Core!

Offline pek

  • Full Member
  • ***
  • Posts: 111
Hi jazzbiker,
Thanks for your reply. It pointed to /tmp/tce

But there's no mydata.tgz in there.

I tried filetool.sh -b again and again.. But still no mydata.gz can be found.

Help please anyone?? Thanks.

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Hi, pek!

Have You created "copy2fs.flg"? If true, can You remember where this file resides?

Offline pek

  • Full Member
  • ***
  • Posts: 111
Hi, pek!

Have You created "copy2fs.flg"? If true, can You remember where this file resides?
No. I booted from unmodified Core-11.1.iso

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Oops, if You boot from CD where do You expect Your backup will be stored? You can backup or use persistent directories only using writeable storage - flash or magnetic.

I've relooked at the previous posts, sorry if I missed the point but if You will work using CD You really need remaster...
« Last Edit: October 14, 2020, 07:16:54 AM by jazzbiker »

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Seems I've caught the cause of Your struggle: You've dd-ed the .iso to flash drive, yeah? But the .iso is intended to be used with read-only media, that's why it places tce directory in memory.
In order to benefit some backuping activities You need to install TinyCore on the flash drive, not simply copy .iso.
« Last Edit: October 14, 2020, 07:32:41 AM by jazzbiker »

Offline pek

  • Full Member
  • ***
  • Posts: 111
Hi jazzbiker,
I actually booted the iso through virtualbox.
So that's the problem..  ::)

I will try to install to flash disk tomorrow.
I hope I can simply use rufus for that. Otherwise I need to learn to do it in tinycore way.

And at the end.. Probably to remaster is easier for me  ;D

But all good.. Now I've learn sooo many things from all of you guys. Thank you very much!!!

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Hi, pek!

I never used virtualbox, only qemu, but i think that You can tell virtualbox to use 2 drives - boot from iso and use one more hd image. There exists tc-install extension in the repo, so You can try boot from iso, then load tc-install and use it for installing TC on hd image.

Good luck!

Offline polikuo

  • Hero Member
  • *****
  • Posts: 758
I actually booted the iso through virtualbox.

If you're running a virtual machine, just create a virtual disk.

Use tc-install or tc-install-GUI to install the system on the disk.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11704
Hi pek
... I hope I can simply use rufus for that. Otherwise I need to learn to do it in tinycore way. ...
From the FAQs:
Quote
Note using other third party installation tools, such as, unetbootin is not and cannnot be automatic. Obviously unetbootin does not "know" about our distribution, i.e., not listed in the drop choices. Therefore using unetbootin simply copies the entire iso to target.

 On a cdrom we cannot have a tce dir. It would be READ_ONLY and nothing would work insofar as adding extensions. That is why there is a cde directory in the iso! It is also a fact that one cannot have two tce directores in the same partition. Nothing new about that,

 It should be obvious that one can use the TinyCore CD or the CorePlus CD READ_ONLY devices to process and access any tce directory on a writable store, i.e., works as expected.

 Therefore if one insists on using a third party installation tool and one that does not officially support Core and thereby copies the entirety of the TinyCore iso then you are faced with manual setup of either creating a second partition for your tce dir, or renaming the cde to tce thus indicating that this is not a CD and editing the syslinux.cfg changing cde to waitusb=5 to indicate that is a pendrive.

 It is not recommended to have a cde directory on any live working system. The whole point of modularity is the ability to easily upgrade the X/GUI extension separate from the base Core.
Found here:
http://tinycorelinux.net/faq.html#pendrives

If you're running a virtual machine, just create a virtual disk.

Use tc-install or tc-install-GUI to install the system on the disk.
This is what you should do.

Offline pek

  • Full Member
  • ***
  • Posts: 111
Hi All,
I finally got it to work.

I installed Tinycore. Copy and mofify files. Created mydata.tgz
All good.

Except if I do this, the script will run all the way ignoring READ or loops.
Quote
... su tc -c '/home/tc/.local/bin/the_script'
to your /opt/bootlocal.sh instead.

So, instead of /opt/bootlocal.sh I call it from ~/.profile and it works well now.

Thank you very much everyone..!!!  ;D