Friday, February 01, 2008

Creating a tar.gz MyDSL extension

This HOWTO is meant to be a correction for the steps found in the DSL wiki to create a MyDSL extension for 4.2.4.

I'll be focusing on the steps to package the extension itself, assuming that the application has already been tested to work from within the /opt folder.

The program for the instructions will be called my_program ;)

Step 1:
Create working folder to hold all the needed files for the extension. Note that all commands following this step will be run from the /home/dsl/work folder, and not from the / folder.
sudo su
mkdir -p /home/dsl/work/opt
cd /home/dsl/work/

If we want an icon on the desktop for the extension.
mkdir -p ./home/dsl/.xtdesktop

Copy in the icons to ./home/dsl/.xtdesktop!
cp [location_of_icon] ./home/dsl/.xtdesktop

Create the .lnk file neeeded.
touch ./home/dsl/.xtdesktop/my_program.lnk
nano ./home/dsl/.xtdesktop/my_program.lnk

A sample of the .lnk file:
table Icon
Type: Program
Caption: ImageMagick
Command: /opt/imagemagick/bin/display
Icon: /home/dsl/.xtdesktop/imagemagick.xpm
X: 420 (X position)
Y: 384 (Y position)

If we want a menu entry in the DSL menu for the extension (most probably, unless the application is mainly run from console with parameters)
mkdir -p tmp/
touch tmp/

Edit the menu entry file.
nano tmp/

The format for the contents of the file is as follows:
[exec] (display name) {command}

An example:
[exec] (Launch my_program) {sh /opt/my_program/}

Just add more lines to the file using the same format for additional menu entries.

Step 2:
Copy the program files.
cp -Pr /opt/my_program ./opt/

# only if there are other files needed in /home/dsl
cp -Pr /home/dsl/whatever ./home/dsl/

Step 3:
Change ownerships.
chown -R 0.0 ./opt/
chown -R 0.0 ./tmp/
chown -R 1001.50 ./home/dsl/
chown 1001.50 ./tmp/

Step 4:
Create file list.
find . > files.txt

Step 5:
Edit the file list, remove all entries that're directories &/or dot paths (refer to wiki)
nano files.txt

Step 6:
Create the archive.
tar cvf my_program.tar --no-recursion \
--numeric-owner -T files.txt

gzip -9 my_program.tar

If this is an extension for the official DSL repository, be sure to create an info file (check some of the others for reference) and md5sum:
md5sum my_program.tar.gz > my_program.tar.gz.md5.txt

- If the extension might not work at first, try checking the shell scripts for dot (/relative) paths and changing them to absolute paths.

PS: Do drop me a comment if you found this useful, or if you have any comments/suggestions to leave behind!

No comments: