Showing posts with label Damn Small Linux. Show all posts
Showing posts with label Damn Small Linux. Show all posts

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/


Optional:
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)
end


Optional:
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/mydsl.menu
touch tmp/mydsl.menu/my_program

Edit the menu entry file.
nano tmp/mydsl.menu/my_program

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/launch.sh}

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/mydsl.menu/my_program


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


Optional:
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


Troubleshooting:
- 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!

Making a new DSL cloop file

This HOWTO is meant to be a correction for the steps found in the DSL wiki to create a new cloop file for 4.2.4. I'll leave the why for your reading from that page itself. ;)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Some things to note before we start:

DSL usually represents the path and file of the KNOPPIX image as
/cdrom/knoppix/knoppix
when in MSDOS/Windows it's represented as
[drive]:\KNOPPIX\KNOPPIX

You should always type the image filenames in DSL as all caps even though it shows up otherwise, in case of any incompatibilities with syslinux/isolinux. ;)

I use /tmp as the base working folder. Feel free to use any other folder that has enough space.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Step 1:
Locate where the KNOPPIX image is stored and setup a loop device to access the image.
sudo su
losetup /dev/cloop1 /cdrom/KNOPPIX/KNOPPIX


Step 2:
Mount the cloop.
mkdir -p /mnt/loop
mount /dev/cloop1 /mnt/loop


Step 3:
Copy everything to the temporary storage.
cp -a /mnt/loop /tmp
SAND_BOX=/tmp/loop
cd $SAND_BOX


Step 4:
Do what you want with the temporary storage ;)

Step 5:
Create a new compressed image.
mkisofs -hide-rr-moved -allow-leading-dots \
-R -l -V "KNOPPIX ISO9660" \
-v -allow-multidot $SAND_BOX | \
create_compressed_fs - \
65536 > [location_for_new_image_file]/KNOPPIX2


Step 6:
Unmount and detach.
cd $HOME
umount /mnt/loop
losetup -d /dev/cloop1


Optional:
If you're storing the new image file on a USB thumb drive, remember to make sure that the file is properly written to it before unplugging it. The way I do it is to unmount the volume, wait for the command to complete, then unplug.
umount [mount_point_for_USB_thumbdrive]


Testing:
We can test the new image file using this cheat code at startup (for syslinux/isolinus) :
dsl knoppix_file=KNOPPIX2



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

DSL articles

Will be writing a couple of short HOWTOs for Damn Small Linux (DSL). Both to record down the steps, and also to correct the steps as shown in the original DSL wiki.

[update]
Making a new DSL cloop file (adapted and modified from here)
Creating a tar.gz MyDSL extension (adapted and modified from here)