09

January
2013

Best practices for building Slax modules

If you're writing build scripts to produce Slax modules, always bear in mind that there will be other users using your module. Here are some of the best practices you should follow in order to make your modules smaller, easier to install, and more useful for Slax users:

  • Use minimum runtime dependencies. If the software you're compiling requires other libraries, which are not absolutely essential for the software to run properly, always check if there are some compile-time options to compile it without the given dependency. If the compilation requires perl or python or other module but the software itself runs without it, make sure to distinguish compile-time dependencies and do not include those in regular dependency list.

  • Write good descriptions. The better description you write for your module, the easier it will be for the user to find your module (by fulltext search) and to understand what is it useful for.

  • That is all what I can think of for now. I will add this to the documentation section and I will be happy for your suggestions what you feel is a good practice for building modules (writing build scripts). Thank you.

    User comments
    Prcek 2013-01-09 20:47

    When I find some broken module, should I report it to you, or are you aware of it? For example ktorrent or k3b modules have zero size and there is comment that the build script failed.

    Mark De Silva 2013-01-09 21:42

    @Tomas,

    Would it be possible for you to give us a list of the apps contained within each of the base modules? I know we can do unsquashfs -l <module.sb> but I'd like to know at perhaps package level, what is contained within each base module so that if decide to remove certain base modules, what kind of impact we will be looking at.

    Thank you.

    Lukas Nemec 2013-01-09 23:57

    Hi, guys, I was wondering is it possible to somehow get to older posts?
    I wanted to check if user's changes file has some limit, it seems to fix on 4GB for me (running sys, didn't reboot yet) and I'm experiencing some lags with option toram.. system seems to pause every ~30s when accessing disk - I'm compiling few stuff to get dropbox and it is kind of annoying .. :)

    Prcek 2013-01-10 00:20

    You can find older modules with google, if you know some keywords from the blog posts. Or wait if Tomas implements paging on the blog :-).

    The limit of changes.dat file is the filesystem underneath it. You are probably using FAT filesystem, which can handle files up to 4 GB, but not more. If you want bigger files on your flash drive, then you have to use another filesystem (for example Ext4).

    Prcek 2013-01-10 00:21

    I meant older blog posts, not modules :-).

    Lukas Nemec 2013-01-10 00:39

    Well it is 32GB flash and I used it for 1080p movies with min 10GB a piece so I think it is NTFS, but for some reason fdisk shows it as unknown and shows me some SpeedStor partition which I didn't put there, I'll check it out more closely once I compile it, but I'm 90% sure it is NTFS

    Lukas Nemec 2013-01-10 00:42

    And one more think, did anyone notice date tags on these comments? :D 00:39 at 12:19 UTC?

    Tomas M 2013-01-10 01:19

    @Mark: you can see /var/log/packages in each bundle to see what packages were installed into thebundle.

    @Lukas: regarding the changes limit, it is limited to 4GB if you run it from a FAT/NTFS filesystem. If you wish to get rid of the limit, you'll have to reformat the USB device with ext2/3/4 or other native linux filesystem and then install Slax to it again.

    OrionRed 2013-01-10 04:27

    I asked about start up scripts the other day, and I got my environment variables working OK, but I've hit another problem creating a module for Tomcat.

    I set up a script to run in /etc/profile.d. I added some pauses so I could tell it was running. It does NOT seem to run during start up. I named it z-tomcat.sh so that it would run last (I think). It checks for the existence/execute flag of jdk.sh.

    If I go to that directory after start up and manually run the command, it works OK and tomcat starts running.

    The exports from the jdk.sh are working fine, and that file is in the same directory as my tomcat start script.

    Any pointers to get this working?

    Mark De Silva 2013-01-10 05:23

    Scripts in /etc/profile.d get run when the user logs in. I assume the z-tomcat.sh script is chmod +x? Whats the content of this script like?

    Lukas Nemec 2013-01-10 07:52

    guys you were right! changing slax to different FS fixed the lagging, but I think it should be considered quite a bug, because even with toram option it tries to save some changes to usb and there seems to be some kind of cache on NTFS and it blocks all IO until it saves the changes, so entire system freezes, and this happens every 20~30s, I think someone who understands it more than I should look into it :)

    Cheers

    OrionRed 2013-01-10 08:01

    Here is an ls -l listing of my profile.d directory after everything is up and running:
    root@slax~# cd /etc/profile.d
    root@slaxprofile.d# ls -l
    total 10
    -rwxr-xr-x 1 root root 1822 Sep 4 16:40 coreutils-dircolors.sh
    -rwxr-xr-x 1 root root 325 Sep 14 2006 glibc.sh
    -rwxr-xr-x 1 root root 44 Dec 9 2010 gtk+.sh
    -rwxr-xr-x 1 root root 146 Aug 29 2007 jdk.sh
    -rwxr-xr-x 1 root root 263 Dec 9 10:11 kde.sh
    -rwxr-xr-x 1 root root 1138 Dec 21 17:16 lang.sh
    -rwxr-xr-x 1 root root 982 Mar 18 2008 libglib2.sh
    -rwxr-xr-x 1 root root 45 Nov 29 2008 mc.sh
    -rwxr-xr-x 1 root root 210 Jul 29 2010 pkgconfig.sh
    -rwxr-xr-x 1 root root 567 Nov 7 22:44 qt4.sh
    -rwxr-xr-x 1 root root 148 Sep 17 14:28 slax.sh
    -rwxr-xr-x 1 root root 513 Jan 10 10:53 z-tomcat.sh
    root@slaxprofile.d#

    Here is the content of the file:
    #!/bin/sh
    # Start tomcat.
    #
    # Start tomcat:
    if [ -x /usr/lib/apache-tomcat/bin/startup.sh ]; then
    echo "found tomcat startup script"
    read -p "Press [Enter] key to continue..."
    if [ -x /etc/profile.d/jdk.sh ]; then
    echo "starting tomcat"
    /usr/lib/apache-tomcat/bin/startup.sh
    else
    echo "did NOT find jdk.sh file!!"
    read -p "Press [Enter] key to continue..."
    fi
    else
    echo "did NOT find tomcat startup script!!!"
    read -p "Press [Enter] key to continue..."
    fi

    Mark De Silva 2013-01-10 08:35

    I think you should remove the 'read -p "Press [Enter] key to continue..."' lines.

    Tomas M 2013-01-10 08:50

    Files from /etc/profile.d/ are NOT executed during startup. Those are executed only upon login. If you wish to make your script run on startup, put it to /etc/rc.d/rc3.d/ and make its filename start with uppercase S, for example, Stomcat.sh. It will be started when user switches to runlevel 3. If you need to run a script on system shutdown, put it to the same folder, but make its name start with uppercase K, like Ktomcat.sh

    This is standard sysvinit behavior, common for most Linux distributions.

    Somewhat Reticent 2013-01-10 09:51

    Will there be a tag/database for modules - and - their dependencies?
    (How do we prevent accumulating an unsearchable pile?)

    Kadalka 2013-01-10 15:31

    1/ Sometimes we need ALL the options in a module.
    This may occur when we would like appropriate software in authentication.

    2/ Sometimes we just need the minimal to run.

    3/ SO I rather prefer that Two releases of the same software is provided with correct numbering and naming so everyone are not hurted for nothing...

    4/ As an example, I've got git without SSL just to run it for my needs.
    Some people, because they use github for example may need the full options ...

    5/ Kernel should have most options checked.
    In the past, I've only checked the options I do need but when I changed my computer, I've seen that some options do not exists.
    Finally, I did understand that most users may need full options because they do not have time to compile a kernel for their needs...

    Tomáš 2013-01-12 07:36

    Dobrý den, rád bych se vás zeptal jak bych mohl přispět do sekce Modules. Zkompiloval jsem gphoto2 + jeho závislosti pro 64bit. Testováno na Canon D350, funguje.

    André 2013-01-12 10:22

    Hi Tomás, since you are talking about modules i will ask you to put on the site the version of the module, or at least when it was update for the last time, it not possible to know if a module was update or not.
    And if its possible to remove the perl dependency from vim module.

    Tomas M 2013-01-12 12:28

    vim module has been fixed. For Tomas: if you want to contribute to Modules section, you have to make a buildscript. Read more in Documentation section. Thank you