Tiny Core Linux

General TC => Programming & Scripting - Unofficial => Topic started by: mofosyne on April 09, 2012, 05:28:51 AM

Title: Can you implement a sort of Script Wiki access for tinycore?
Post by: mofosyne on April 09, 2012, 05:28:51 AM
TL;DR: I would like a "script browser" (as opposed to appBrowser), where you can browse for automated scripts for tinycore. This would allow for one click install of multiple apps, like say a 'familiar web desktop' script for newbies, where it will automagically download and run xfce, firefox, and flash.

---------------
I think it would be nice if we can have a program next to application browser, where you can browse, view, and execute various automated Bourne shell scripts.  (And bash scripts if extension is installed already perhaps)

The reason this would be nice, is that tinycore is very hard for newcomers to understand, and it would be nice to have a wiki where we can collaborate and create various Bourne shell script to make tinycore easier to use for various task.

e.g. you can create a custom installation script for tinycore that is better suited for super low ram install (e.g. on a thinclient), bypassing the tedious steps needed to manually install tinycore without a install GUI.


Example of this concept in use in other programs:
WxSand - fsg-4_4.exe - Added "Download physics from wiki". - http://www.piettes.com/fallingsandgame/download.html

In WxSand, you can download different physic, like http://www.fallingsandgame.com/wiki/index.php/Zombie_mod . Basically, it would download that page, and only read the text between "<!-- start content -->" and "<!-- end content -->" (excluding html codes)

In tinycore, we already have a main tinycore wiki. Hope it is not too much of a stretch to add a database of example bash scripts for users to use.
Title: Re: Can you implement a sort of Script Wiki access for tinycore?
Post by: mofosyne on April 09, 2012, 05:47:58 AM
Oh and one last thing. This would fit with tinycore's philosophy I'm sure, as nothing is ever installed (though I'm sure you can backup and copy scripts).

I would also recommend that you make this service 'console' based so that you can access it within 'microcore'. You can then perhaps make a GUI wrapper over it, so it can be easily used in tinycore as well.

If this console program is called "ScriptBrowser" (like AppBrowser) in microcore/tinycore terminal, then this could be it's command.

>>ScriptBrowser
Shows a browse able index of Bourne shell scripts

>>ScriptBrowser [Search term]
Shows top ten scripts for that search term (perhaps type 'next' to go to next page, if there is more than 10 results)

>>ScriptBrowser /run (ScriptName in wiki)
Runs the script as named

>>ScriptBrowser /src (ScriptName in wiki)
Show the script source as named

>>ScriptBrowser /about (ScriptName in wiki)
Shows the other text in that wiki page that is not the source text

------ For pastebin users (optional but may be useful to consider) -----

>>ScriptBrowser /pastebinrun [PasteBinID]
Would grab a script from pastebin and run it
Title: Re: Can you implement a sort of Script Wiki access for tinycore?
Post by: tinypoodle on April 09, 2012, 05:53:46 AM
Why bash scripts when core does not contain any such and bash.tcz would be an optional extension?
Title: Re: Can you implement a sort of Script Wiki access for tinycore?
Post by: mofosyne on April 09, 2012, 06:06:56 AM
Oh? I had an impression that bash is part of all linuxes. Whats the standard scripting automation language does TinyCore support by default, if there is any?

=====

Evidence for my assumption of default bash support for tinycore: http://distro.ibiblio.org/tinycorelinux/faq.html#startup_scripts

Quote
The actual startup script could be anything that is executeable.
Using the same example, my /usr/local/tce.installed/915resolution is a simple as this:

#/bin/sh
/usr/local/sbin/915resolution 50 1024 600

#/bin/sh
I believe the above indicate it's a bash script
Title: Re: Can you implement a sort of Script Wiki access for tinycore?
Post by: mofosyne on April 09, 2012, 06:12:22 AM
Okay... I did further research. I see now that the default script language is called Bourne shell, not bash.

http://en.wikipedia.org/wiki/Bourne_shell

I shall now amend my previous post to refer to 'Bourne shell'. Pardon me for my confusion
Title: Re: Can you implement a sort of Script Wiki access for tinycore?
Post by: tinypoodle on April 09, 2012, 06:14:23 AM
The header for bash scripts would be #!/bin/bash

Core's default shell is ash as a busybox applet.
Title: Re: Can you implement a sort of Script Wiki access for tinycore?
Post by: mofosyne on April 10, 2012, 07:24:42 AM
hmmmmm...

Do you think a good alternative would be to insert metadata, specifying type of 'script'?

Perhaps, depending on if ash, bash, python, etc... is present or not, it will show that particular script.

e.g.

script_type: python
info: this is a hello world script in python
Targeted_OS: tinycore, all_linuxes
<!--start content -->
print "hello world"
<!--end content -->


---------------

Additional reason for this feature in tinycore!

With a single click (or maybe even a bootcode), you can automatically install a number of applications. E.g. you can tell a newcomer who wants a simple familiar desktop with flash browser to run an ash script. It will then download and execute a command instructing appbrowser or scm manager to download xfce, firefox, and flash automagically.

---------------

Second potential idea to making this more powerful.
Allow for 'constants to be defined' before running a script. The script may show a number of predefined variables that needs to be defined in GUI/Console (But will always give the user full control to enter any text in that field). The program will then do a simple search and replace command to fill in the blanks.

e.g.
script_type: python
info: this is a hello world script in python
Targeted_OS: tinycore, all_linuxes
<!--start parameters-->
MSG_STRING: "Hello world"
CHOICES: "option1" | "option2" | "option3" | "option4"
<!--end parameters-->
<!--start content -->
print "Message"
print MSG_STRING
print "You picked"
print CHOICES
<!--end content -->
Title: Re: Can you implement a sort of Script Wiki access for tinycore?
Post by: vinnie on April 10, 2012, 08:29:33 AM
Scripting is one of the powers of gnu/linux as compared to other platforms.
There is a script section in the forum that actually is a shame not to see valorized.
However structure an automated script management is not trivial, but Core has a long life in its future  :)
Title: Re: Can you implement a sort of Script Wiki access for tinycore?
Post by: mofosyne on April 10, 2012, 10:29:16 AM
Well I think it is plausible. If appbrowser can be created to look up and download from a tinycore repo site (which looks htmlish), why not from a wiki? What is appbrowser's language anyway, and who made it? maybe that guy might be up to the job.

I imagine that this scriptbrowser is a console based app, that simply downloads scripts to /tmp/script dir, and runs it from there.

And yes the power of scripting in linux is a great thing that is yet untapped, and imagine if all the people coding scripts in forums, does it in a wiki instead.
Title: Re: Can you implement a sort of Script Wiki access for tinycore?
Post by: solorin on April 10, 2012, 11:00:08 PM
Appbrowser is written in C using the ftlk toolkit. You can find sources here. http://distro.ibiblio.org/tinycorelinux/4.x/x86/release/src/fltk_projects/
And as far as I know it and most other fltk apps that ship default with Tinycore, were coded by the roberts/core team.

Busybox ash is fairly capable. It's a good idea to make your scripts portable anyway. http://www.amazon.com/dp/1430210435/.

It doesn't seem that hard to implement what you would like in ash. You'd just need to set up an ftp/http repository somewhere, and write a script with a few wget's and chmod's in it. If you want to implement it with something faster, lua is fairly compact and in the repository.

For whatever scripts you are thinking of, I'd just as soon do that by hand.
I'd want to see what my system downloads and runs. And if you just want a place to store scripts, just make a wiki page and start sharing scripts you think are useful.

I can't speak for the core team, but I think they're already pretty busy releasing Core itself. So if you've got the hosting & the chops you should implement it yourself and share it on the Unofficial Programming & Scripting Forum if you would like. Don't ask for permission, but don't ask for somebody else to do the work for you (well you can ask but nobody's obligated to answer). AFAICT, the core team is fairly conservative as to suggestions for things in the official 'core' (that's what keeps the iso sizes down), but extensions seem to be welcomed liberally as long as they don't interfere with 'core' functions. Again just my 2 cents, they may say something different.

good luck.

cheerio,
solorin
Title: Re: Can you implement a sort of Script Wiki access for tinycore?
Post by: mofosyne on April 11, 2012, 01:46:51 AM
So you mean that this 'remote script browser' can be entirely coded in 'ash' scripting?
Title: Re: Can you implement a sort of Script Wiki access for tinycore?
Post by: solorin on April 11, 2012, 06:51:10 AM
less /usr/bin/ab

cheerio,
solorin
Title: Re: Can you implement a sort of Script Wiki access for tinycore?
Post by: roberts on April 11, 2012, 07:59:20 AM
The stated goal of this can already be achieved via meta-extensions.
Title: Re: Can you implement a sort of Script Wiki access for tinycore?
Post by: mofosyne on April 11, 2012, 08:55:58 AM
meta-extentions? what is that
Title: Re: Can you implement a sort of Script Wiki access for tinycore?
Post by: Rich on April 11, 2012, 11:23:10 AM
Hi mofosyne
Meta extensions are basically extensions that get their content elsewhere. Here are a couple of examples:
compiletc: This extension contains only a readme file. Its dependency file contains a list of extensions required
                    for compiling programs. When you install compiletc, the readme file is installed along with all of the
                    extensions listed in its dependency file.
getFlash11: This extension basically contains a script that retrieves Flashplayer version 11 from Adobe. It packages
                       it into an extension that you can then put in your /tce directory with your other extensions. Once you
                       have run it, you typically would not run it again.
Title: Re: Can you implement a sort of Script Wiki access for tinycore?
Post by: mofosyne on April 12, 2012, 04:00:19 AM
I guess it functions more like getflash11, except it reads parses pages from a wiki, and extract the script from there to execute.
Title: Re: Can you implement a sort of Script Wiki access for tinycore?
Post by: Rich on April 12, 2012, 06:34:15 AM
Hi mofosyne
Personally, parsing a Wikis page content to retrieve script content sounds like an awkward and inefficient form of
file I/O to me. That aside, it sounds like it could be a wonderful source of mayhem. You now have a situation where
someone could simply sign up as a forum member, go straight to the Wiki, and alter a script to do their bidding, no
questions ask.
Title: Re: Can you implement a sort of Script Wiki access for tinycore?
Post by: gerald_clark on April 12, 2012, 09:01:40 AM
Yes, sounds like an extremely bad idea to me too.
Title: Re: Can you implement a sort of Script Wiki access for tinycore?
Post by: roberts on April 12, 2012, 12:35:02 PM
I too believe that the Wiki should only be used as it is, i.e., community contributed documentation.  It is too open for code of any kind and system integrity could easiler be compromised, as aleady noted.

We aleady have inplace, and working nicely, a procedure for community code contributions where not everyone could be changing the code. In fact this smacks of trying to go around that procedure.

If the goal is more meta extensions to ease the installation of complex collection of related extensions then that would be welcomed via our normal "submit" extension procedure.