Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: bonbob on August 01, 2017, 04:01:23 AM

Title: Load extension without saving on disk
Post by: bonbob on August 01, 2017, 04:01:23 AM
Is it possible to install *.tcz directly from repository, without saving on disk?
Such possibility allow user make demo-installation. If something goes wrong with app, after reboot directory with *.tcz files stay clear, without garbage of unused or problematic demo-packages and it's dependences. As i know, tce-ab can't safely delete unusing apps.  "on the fly" installation mode make possible run TCL from devices with a lot of onboard flash-memory. I try to realize this idea and made shell-script loading and installing *.tcz from remote network storage. How about the same function in tce-ab?
Title: Re: Load extension without saving on disk
Post by: Juanito on August 01, 2017, 04:48:50 AM
As long as you do not have anything (or only extensions known to be good) set onboot, a simple reboot would fix things?
Title: Re: Load extension without saving on disk
Post by: andyj on August 01, 2017, 09:02:13 AM
You could use PXE booting to create a diskless device so extensions are reloaded from the network each time on boot, but then you would need to set up a bootp server. It works for me.
Title: Re: Load extension without saving on disk
Post by: bonbob on August 01, 2017, 12:08:53 PM
Yep. But it's not the same. You can boot TCL with minimum extensions to get internet connection. When connection with repository will be established, other extensions will be installed directly from repo. Without copying to tce/optional. No boot server needed. Only internet connection and a few megabytes for booting core. This is the first reason of my idea. The second - demo-install mode. When content of folder tce/optional stay without any changes after installation.
Title: Re: Load extension without saving on disk
Post by: curaga on August 01, 2017, 02:26:16 PM
Yes, that's how the default "cloud mode" works. If you haven't set up a tce directory, or are using just a cde directory (intended for cd like the name, but possible on writable media too), extensions are only downloaded to RAM.

However, if you plan to use it a lot that way, please set up your own mirror - would be rude to mirrors to download libreoffice several times a day, for example. :P
Title: Load extension without saving on disk
Post by: bonbob on August 02, 2017, 04:41:50 AM
As i understand, tce-ab has no option that give user possibility to choose between "cloud mode" and permanent installation. For example i have device with only 64Mb onboard flash-memory. It enought to install base *.tcz's to use device as wrieless router, but "heavy" packets as samba and mariadb require more free space on onboard storage. As i write earlier this packets are loading by local network from remote file storage. I think Loading directly from repository by tce-ab with "cloud-mode" installation option will be more convenient.
Title: Re: Load extension without saving on disk
Post by: bonbob on August 02, 2017, 09:33:27 AM
I made shell-script for myself and it work:

Code: [Select]
TEMPDIR="/tmp/tmpextdir/"
REPOURI="PATH_TO_REPOSITORY"

mkdir -p $TEMPDIR

function loadTCZ()
{
 wget -P $TEMPDIR "$REPOURI$1"
 wget -P $TEMPDIR "$REPOURI$1.md5.txt"
 wget -q -P $TEMPDIR "$REPOURI$1.dep"
 echo "$1 loaded"
 if [ -s "$TEMPDIR$1.dep" ]; then
  FILE="$TEMPDIR$1.dep"
   while read line; do
    if [ -z $line ]; then
     continue
    fi
    loadTCZ $line
   done < $FILE
  fi
}

loadTCZ $1
su tc -c "tce-load -i $TEMPDIR$1"
rm -r $TEMPDIR
Title: Re: Load extension without saving on disk
Post by: gerald_clark on August 02, 2017, 09:54:03 AM
Touch /etc/sysconfig/tcedir/copy2fs.flg and do a backup.
Title: Load extension without saving on disk
Post by: bonbob on August 02, 2017, 05:16:05 PM
What file copy2fs.flg do?

I made a few improvements to my script. You can see it  here http://tinycorelinux.sytes.net/tce-cloud.txt (http://tinycorelinux.sytes.net/tce-cloud.txt)

Also i can made repository mirror on my server for all who interested of Tiny Core Linux. If it possible.   ::)
Title: Re: Load extension without saving on disk
Post by: polikuo on August 02, 2017, 11:26:13 PM
What file copy2fs.flg do?

It enables copy mode, meaning every file is copied into the RAM rather than symbol-linked from a mounted squash file system.
Read the book for more details.
Title: Re: Load extension without saving on disk
Post by: curaga on August 03, 2017, 04:08:21 AM
It doesn't affect the download destination for new files, though.

To make a mirror, do a recursive wget from your closest mirror, then keep it up to date once per day with rsync from repo.tinycorelinux.net.
Title: Load extension without saving on disk
Post by: bonbob on August 03, 2017, 04:51:33 AM
Few lines from CoreBook:
Quote
Selected application extensions are copied into RAM instead of
mounted. Applications can be RAM-loaded in bulk (copy2fs.flg),
selectively loaded into RAM (copy2fs.lst), or mounted.

From what sourse Application extensions are copied into RAM instead? Remotely from internet? What will happened if internet connection will be unavialable while booting core? I think that "copy mode" is not the same as "cloud install". Nearest is "cloud/internet mode", but in that case user install apps manualy, by himself. And he has no ability to choose, what extension will be installed in "mount mode" or in "cloud mode".

Nevertheless i found decision by making my personal script.

I will try to make a repository mirror later, as adviced Mr. curaga
Title: Re: Load extension without saving on disk
Post by: polikuo on August 03, 2017, 05:19:56 AM
Don't reinvent the wheel.
tce-load takes cares of what you need.

Cloud mode:
Extensions are stored in /tmp/tce/optional
i.e. in the RAM

Mount mode:
Extensions are stored in /your/disk/tce/optional
tce-load first creates a loop file system at /tmp/tcloop, then symbol-links all the files in the tcz to their respected position in the system.

Copy mode:
Extensions are also stored in /your/disk/tce/optional
The contents in the tcz are copied into the RAM.

If the file tce/copy2fs.flg exists, every extension will be load in copy mode.
If only the tce/copy2fs.lst exists, only the extensions listed in that file will be load in copy mode.

From what sourse Application extensions are copied into RAM instead?

The local tce directory.
The difference between mount mode and copy mode is that, when you boot up by copy mode, no partition in your disk is mounted (except for swap).
Title: Load extension without saving on disk
Post by: bonbob on August 03, 2017, 07:31:39 AM
Oh, seems we are misunderstanding each other.

Main question is not "where extension files stored and how it will be copyied to system", but how to automaticaly load extensions from repository after TCL-core is booted and interner connection has been established?

Mount & Copy modes always needs local storage (usb stick, onboard flash-memory, HDD). This mode is not for me. I have no enough free drive space to keep all of extension files, but enough RAM.

Cloud mode losing all extensions after reboot. And it's will not appear again till user manually installed from repo with "tce-ab". I need to make it automaticaly, following by list of my extensions. And after loading from repo apply backup.

can "tce-load" do this for me?
Title: Re: Load extension without saving on disk
Post by: coreplayer2 on August 03, 2017, 08:44:32 AM
I think the simple solution to this is get a USB thumb drive and store your downloaded extensions there, then you may load extension any way you choose.  USB thumb drives are cheap and readily available.  Otherwise, downloading from a repo each time you boot up threatens our relationship with the kind folks who offer repo mirrors.

You wouldn't want to jeopardize that relationship, would you??

 
 
Title: Re: Load extension without saving on disk
Post by: bonbob on August 04, 2017, 02:52:46 AM
It's nearly philosophical question.
Now i know that technically my idea is working, but "cloud-mode" newer be realised by TCL developers.
Only because millions or billions of TCL users will be downloading heaviest extensions from repositories each second. And all repo-servers will lay down ;)

Do you know why i like Tiny Core Linux, even if it far from ideal?
It's easy to understand how it works, easy to change for user's needs, even for noob like me. Enough to be smarty and enthusiastic.

Your advice to buy a USB-storage sounds like "this is a dead end my friend. Linux not for you, go back to Windows" :D
Title: Re: Load extension without saving on disk
Post by: polikuo on August 04, 2017, 05:03:12 AM
So, if I understand you correctly.
Firstly, you want a persistent tce directory that stores mydata.tgz but without all the tczs storing in optional.
Secondly, you want to do a cloud mode tce-load every time you boot up.
Finally, you want to automate all the process.
Is that what you want ?
Title: Re: Load extension without saving on disk
Post by: bonbob on August 04, 2017, 05:45:46 AM
persistent tce directory that stores mydata.tgz with all the tczs that user want to be stored locally

It may be extensions for establishing internet-connection. pppd, wireless-firmware, wpa-supplicant, usb-modeswitch for usb-modems etc. Also some important packages, openssh for example.
So it may be two files: onboot.lst and oncloud.lst First load extension on boot from local storage, other load remotely from cloud automatically after internet connection has been established. By editing this files you can set which extension will be loaded quckly and guaranteed from disk, and other will be loaded from repository. Slowly and requiring internet connection but releasing free space on onboard storage.
Title: Re: Load extension without saving on disk
Post by: coreplayer2 on August 04, 2017, 11:36:13 AM
What I like about Tinycore is that you can build it any way you choose.  But knowing what you can accomplish with this resource and respecting the resource are two entirely different matters.   Don't expect a corporate network supporting these mirrors is all..

I'm just saying..