Module Creation: Best Practices
Module Creation: Best Practices
Hi all,
I have been experimenting with Linux via Porteus for a while now given that I use it for web development. This means that I have installed a bunch of tools on it, from editors such as Atom and Sublime Text 3 to browsers like Vivaldi and Firefox to package managers like npm, nvm and such.
The problem is that none of these are modules. I could easily turn their containing directories into modules. But given that I also create symbolic links into /bin or /usr/bin and add executables to PATH, I don't know how to include those in my modules so they are removed / injected as the module is (des)activated.
It would be great if someone could update the module creation tutorials to reflect those use cases. Or just show me how to effectively create modules that have CLI commands, start menu items, etc.
Thanks.
I have been experimenting with Linux via Porteus for a while now given that I use it for web development. This means that I have installed a bunch of tools on it, from editors such as Atom and Sublime Text 3 to browsers like Vivaldi and Firefox to package managers like npm, nvm and such.
The problem is that none of these are modules. I could easily turn their containing directories into modules. But given that I also create symbolic links into /bin or /usr/bin and add executables to PATH, I don't know how to include those in my modules so they are removed / injected as the module is (des)activated.
It would be great if someone could update the module creation tutorials to reflect those use cases. Or just show me how to effectively create modules that have CLI commands, start menu items, etc.
Thanks.
Re: Module Creation: Best Practices
<removed>
Last edited by Evan on 24 Jun 2016, 12:52, edited 1 time in total.
- brokenman
- Site Admin
- Posts: 6105
- Joined: 27 Dec 2010, 03:50
- Distribution: Porteus v4 all desktops
- Location: Brazil
Re: Module Creation: Best Practices
You can create the module as per tutorials/videos and a script can be executed upon activation by placing it (the executable script) at:
/etc/rc.d/rc.scriptname (in the module obviously)
/etc/rc.d/rc.scriptname (in the module obviously)
Code: Select all
#!/bin/sh
test_start() {
touch /tmp/testme
}
test_stop() {
rm -f /tmp/testme
}
case "$1" in
start)
test_start
;;
stop)
test_stop
;;
restart)
test_stop
sleep 1
test_start
;;
*)
echo "Usage: $N {start|stop|restart}\n"
exit 1
;;
esac
How do i become super user?
Wear your underpants on the outside and put on a cape.
Wear your underpants on the outside and put on a cape.
Re: Module Creation: Best Practices
<removed>
Last edited by Evan on 24 Jun 2016, 12:51, edited 1 time in total.
- brokenman
- Site Admin
- Posts: 6105
- Joined: 27 Dec 2010, 03:50
- Distribution: Porteus v4 all desktops
- Location: Brazil
Re: Module Creation: Best Practices
No they are not mine but yes the coincidence is there. I plan on creating tutorial videos when I get a chance.
How do i become super user?
Wear your underpants on the outside and put on a cape.
Wear your underpants on the outside and put on a cape.
Re: Module Creation: Best Practices
<removed>
Last edited by Evan on 24 Jun 2016, 12:51, edited 1 time in total.
-
- Full of knowledge
- Posts: 2564
- Joined: 25 Jun 2014, 15:21
- Distribution: 3.2.2 Cinnamon & KDE5
- Location: London
Re: Module Creation: Best Practices
Further Example: viewtopic.php?f=48&t=4719&p=36659#p34124
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB
- brokenman
- Site Admin
- Posts: 6105
- Joined: 27 Dec 2010, 03:50
- Distribution: Porteus v4 all desktops
- Location: Brazil
Re: Module Creation: Best Practices
Thanks Bogomips. I was looking for that link for a bit. Also added a late reply to it.
How do i become super user?
Wear your underpants on the outside and put on a cape.
Wear your underpants on the outside and put on a cape.
Re: Module Creation: Best Practices
Hi all,
Thank you so much for your answers. I'll have a look at the tutorials and the links and try to make the best out of them to apply them to my case.
I really think we need to update the 'tutorials' link and resources on the site to show noobs things like 'updating Porteus', 'injecting files into the file system via modules', 'creating modules (with a much better explanation of how activating modules alters the file system or the start menu)' . You know, practical blog style tutorials.
Thank you so much for your answers. I'll have a look at the tutorials and the links and try to make the best out of them to apply them to my case.

I really think we need to update the 'tutorials' link and resources on the site to show noobs things like 'updating Porteus', 'injecting files into the file system via modules', 'creating modules (with a much better explanation of how activating modules alters the file system or the start menu)' . You know, practical blog style tutorials.
