Page 1 of 1

Module Creation: Best Practices

Posted: 05 Jun 2016, 21:17
by igreka
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.

Re: Module Creation: Best Practices

Posted: 05 Jun 2016, 22:43
by Evan
<removed>

Re: Module Creation: Best Practices

Posted: 05 Jun 2016, 23:44
by brokenman
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)

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

Re: Module Creation: Best Practices

Posted: 06 Jun 2016, 00:05
by Evan
<removed>

Re: Module Creation: Best Practices

Posted: 06 Jun 2016, 01:56
by brokenman
No they are not mine but yes the coincidence is there. I plan on creating tutorial videos when I get a chance.

Re: Module Creation: Best Practices

Posted: 06 Jun 2016, 04:47
by Evan
<removed>

Re: Module Creation: Best Practices

Posted: 06 Jun 2016, 20:20
by Bogomips

Re: Module Creation: Best Practices

Posted: 06 Jun 2016, 23:45
by brokenman
Thanks Bogomips. I was looking for that link for a bit. Also added a late reply to it.

Re: Module Creation: Best Practices

Posted: 13 Jun 2016, 13:49
by igreka
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. :good:

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. :)