Tiny Core Extensions > TCE Q&A Forum

Running a script on click

(1/3) > >>

edmazing:
So far I've managed to package a quick bash script to run a few commands. I tossed a few scripts into /usr/sbin
One to load a few packages and one to setup a p9 file system (setup & startp9 respectively)

--- Code: ---xterm -title "setting up..." -e sh -c "tce-load -i gcc.tcz;tce-load -i linux-6.18_api_headers.tcz;" (and so on)
--- End code ---

--- Code: ---xterm -e sh -c "sudo insmod /lib/modules/6.18.2-tinycore/kernel/net/9p/p9net_virtio.ko.gz; sudo mkdir /home/tc/p9; sudo mount -t 9p -o trans=virtio,version=9p2000.L host9p /home/tc/p9"
--- End code ---

Then I packaged a simple script setupdev

--- Code: ---#!/bin/sh
xterm -e sh -c "setup; startp9"
--- End code ---


(I didn't put the tcz's in onboot because the start up time becomes >5minutes for all the extensions)
tl;dr: Adding a bash script to an extension seems to loop and open a never ending number of terminal windows with just a single click of the icon.

Rich:
Hi edmazing

--- Quote from: edmazing on March 15, 2026, 09:51:06 PM --- ...
--- Code: ---xterm -title "setting up..." -e sh -c "tce-load -i gcc.tcz;tce-load -i linux-6.18_api_headers.tcz;" (and so on)
--- End code ---
...
--- End quote ---
You don't need to call tce-load over and over again:

--- Code: ---tce-load -i gcc linux-6.18_api_headers (and so on)
--- End code ---
You can list multiple extensions in one command.
You don't need to include the  .tcz  when calling  tce-load.
If you are planning on compiling, the toolchain is called  compiletc.

edmazing:
That's good news. Not planning on compiling anything, just want to run a script when an icon is clicked... maybe I should be adjusting .wbar but I don't see a safe way to add an entry and an icon. I figured I'd create an extension for it but the extension seems to endlessly run the script once the desktop icon is pressed.

edmazing:
Still no luck.

I tried adding
--- Code: ---if [ -f "home/tc/.wbar" ]; then
--- End code ---
to the bootlocal.sh script but it seems like it's not created the .wbar file yet.
Is there a better way to add an entry to .wbar when the flwm desktop starts up?

Juanito:
Why note create an extension containing your script, a minimal *.desktop file and an icon?

i.e.
/usr/local/bin/myscript.sh
/usr/local/share/applications/myscript.desktop
/usr/local/share/pixmaps/myscript.png

Navigation

[0] Message Index

[#] Next page

Go to full version