Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (9) </ [1] 2 3 4 5 6 ... >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: deb2dsl script testers needed, convert simple deb packages to dsl's< Next Oldest | Next Newest >
cbagger01 Offline





Group: Members
Posts: 4264
Joined: Oct. 2003
Posted: July 06 2004,05:32 QUOTE

Below you will find my first attempt at creating a "DEB to DSL" conversion script.

This script should convert simple *.deb packages into a *.dsl extension.  By "simple" I mean:
Debian Packages that don't have post-extraction installation scripts
or Debian Packages that attempt to upgrade existing DSL base packages

The script will grab all *.deb files in your home directory AND all *.deb files in your apt archives directory and combine them into one *.dsl file with a myDSL menu entry.

Here are the usage instructions:

(1) Start with a clean boot-up from livecd or from frugal install when building packages.
(2) Use the Apps -> Tools -> Enable Apt menu to install apt-get/dpkg.  If you try and install Synaptic the Synaptic-related packages will accidentally get sucked into your new *.dsl package unless you purge your cache.  If you need synaptic, please use it to find the exact name of your package and write it down on paper.  Then do a clean reboot and use the apt command line to install the package that you wrote down.
(3) Open a regular Xterminal and type "sudo su" to become the root user.
(4) Use 'apt-get install packagename' or 'dpkg -i packagename.deb' or both to install the needed packages. Do NOT delete the *.deb files yet.
(5) Open up scite and use the clipboard functions to copy and paste this script into scite.  Save it as "deb2dsl".
(6) Type 'exit' in the Xterminal from step (3) so that you are no longer the root user. Then type 'chmod 755 deb2dsl' to make the script executable.
(7) Type './deb2dsl' to start up the script.
(8) Answer the prompts for package name, myDSL menu name, program executable name.
(9) Your new *.dsl package should be sitting in your home directory. Save it somewhere like a hard drive or a flash drive.
(10) Test out your new package in the following manner:
Try a bootup test with dsl in root directory or with "dsl mydsl=hda1" style boot parameter
If this works OK, then reboot and try a post-boot install using the "myDSL" button on the emelfm menu.

Good Luck.

Code Sample
#!/bin/bash
#
#   deb2dsl  -  Converts one or more Debian packages (*.deb files) into
# a DSL extension (*.dsl file) with prompts to create a
# myDSL Menu item for the newly created package.
#
# Revision: 0
# Date: 07/05/04
# Original Author: cbagger01 from the DSL forums
#
# This script will grab all *.deb files located in your
# "Home" directory, IE: the /home/username  directory
# It will also grab all *.deb files located in your apt
# cache, IE: /var/cache/apt/archives
#
# Before running this script, you need to actually install
# all of your Debian packages using 'dpkg -i' or
# 'apt-get install' or a package manager like Synaptic.
# Do NOT delete your leftover *.deb files or purge your
# apt-cache until after you have finished running this
# script.
#
# Disclaimer:
# This script is just a file repackaging program that
# can be used for simple Debian packages.  It will not
# perform post-extraction configuration that is done
# by more sophisticated Debian packages.  It also cannot
# be used to upgrade packages from older versions
# that are part of the DSL livecd base installation.


# This script will not work if it is run under the 'root' effective
# user ID which is 0
if [ "$EUID" -eq "0" ]; then
  echo "Do not use 'root' access to run this script. Aborting..."
  exit 1
fi

# Start things out from the home directory so we won't get confused
cd $HOME

# Clean up any leftover temp files if needed
rm -rf /tmp/deb2dsl_files.tmp
rm -rf /tmp/deb2dsl_prompt.tmp

# Find all Debian packages in your home directory and grab the list of
# files that are contained inside each package.  Make sure that directory
# names are not grabbed.  Only file names will be added to the list.
for i in $( ls $HOME/*.deb ); do
   dpkg -c  $i | awk '{ print $6 }' | grep -v "\/$" >> /tmp/deb2dsl_files.tmp
done

# Find all Debian packages in your apt cache directory and grab the list
# of files that are contained inside each package.  Make sure that
# directory names are not grabbed.  Only file names will be added to the
# list.
for i in $( ls /var/cache/apt/archives/*.deb ); do
   dpkg -c  $i | awk '{ print $6 }' | grep -v "\/$" >> /tmp/deb2dsl_files.tmp
done

package_name=
whiptail --clear --nocancel \
  --inputbox "Enter the full name for your DSL package Example: rox.dsl " \
  20 74 2> /tmp/deb2dsl_prompt.tmp
package_name=`cat /tmp/deb2dsl_prompt.tmp`
rm -rf /tmp/deb2dsl_prompt.tmp

menu_name=
whiptail --clear --nocancel \
  --inputbox "Enter the myDSL menu name for your program Example: Rox Filer " \
  20 74 2> /tmp/deb2dsl_prompt.tmp
menu_name=`cat /tmp/deb2dsl_prompt.tmp`
rm -rf /tmp/deb2dsl_prompt.tmp

program_path=
whiptail --clear --nocancel \
  --inputbox "Enter the executable name for your program Example: /usr/bin/rox " \
  20 74 2> /tmp/deb2dsl_prompt.tmp
program_path=`cat /tmp/deb2dsl_prompt.tmp`
rm -rf /tmp/deb2dsl_prompt.tmp

# Create the mydsl menu directory
mkdir /tmp/mydsl.menu

# Create the new mydsl menu item file
echo "[exec] ("$menu_name") {"$program_path"}" > /tmp/mydsl.menu/$package_name

# Add the mydsl menu file to the list of files that will be
# included into the new new dsl package
echo "./tmp/mydsl.menu/"$package_name >> /tmp/deb2dsl_files.tmp

# Create the new DSL package
tar -zcvf $package_name -T /tmp/deb2dsl_files.tmp -C /
rm /tmp/deb2dsl_files.tmp
rm /tmp/mydsl.menu/$package_name
rm -r /tmp/mydsl.menu
exit 0
Back to top
Profile PM 
clivesay Offline





Group: Guests
Posts: 935
Joined: Dec. 2003
Posted: July 06 2004,11:18 QUOTE

cbagger01 -

This sounds great!! I will definitely give it a test drive today. If you do an actual install of the package instead of a -d install will that help my problem that I listed here about a missing lib file (scroll to the bottom of the thread)?
.dsl problem

Thanks again,

Chris
Back to top
Profile PM MSN YIM 
clivesay Offline





Group: Guests
Posts: 935
Joined: Dec. 2003
Posted: July 06 2004,13:33 QUOTE

cbagger -

Here is what I get when I try to run the script. I downloaded tuxpaint. All of the .deb files are in the /var/cache/apt/archive directory. I am running the deb2dsl script from /damnsmall.

damnsmall@box:~$ deb2dsl
ls: /home/damnsmall/*.deb: No such file or directory
./deb2dsl: line 58:  : command not found
./deb2dsl: line 58:  : command not found
./deb2dsl: line 58:  : command not found
./deb2dsl: line 58:  : command not found
./deb2dsl: line 58:  : command not found
./deb2dsl: line 58:  : command not found
./deb2dsl: line 58:  : command not found
./deb2dsl: line 58:  : command not found
./deb2dsl: line 58:  : command not found
./deb2dsl: line 58:  : command not found
./deb2dsl: line 58:  : command not found
./deb2dsl: line 58:  : command not found
./deb2dsl: line 58:  : command not found
./deb2dsl: line 58:  : command not found
./deb2dsl: line 58:  : command not found
./deb2dsl: line 58:  : command not found
./deb2dsl: line 58:  : command not found
./deb2dsl: line 58:  : command not found
./deb2dsl: line 58:  : command not found
./deb2dsl: line 58:  : command not found
./deb2dsl: line 58:  : command not found
./deb2dsl: line 58:  : command not found
./deb2dsl: line 58:  : command not found
./deb2dsl: line 58:  : command not found
./deb2dsl: line 86: /tmp/mydsl.menu/$package_name: ambiguous redirect
tar: bad: Cannot stat: No such file or directory
tar: parameters: Cannot stat: No such file or directory
tar: (see: Cannot stat: No such file or directory
tar: man: Cannot stat: No such file or directory
tar: whiptail(1): Cannot stat: No such file or directory
tar: for: Cannot stat: No such file or directory
tar: details): Cannot stat: No such file or directory
tar: ./tmp/mydsl.menu/whiptail\: bad parameters (see man whiptail(1) for details                                              ): Cannot stat: No such file or directory
rsh: whiptail: Temporary failure in name resolution
tar (child): whiptail\:: Cannot open: Input/output error
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error exit delayed from previous errors
rm: cannot remove `/tmp/mydsl.menu/whiptail:': No such file or directory
rm: cannot remove `bad': No such file or directory
rm: cannot remove `parameters': No such file or directory
rm: cannot remove `(see': No such file or directory
rm: cannot remove `man': No such file or directory
rm: cannot remove `whiptail(1)': No such file or directory
rm: cannot remove `for': No such file or directory
rm: cannot remove `details)': No such file or directory

HTH

Chris
Back to top
Profile PM MSN YIM 
cbagger01 Offline





Group: Members
Posts: 4264
Joined: Oct. 2003
Posted: July 06 2004,16:17 QUOTE

Chris,

Line 58 should be the "dpkg -c" line.

It appears that you have not successfully performed an "Enable Apt" because it seems that the dpkg command is not found.  There is also a slim chance that awk or grep is not found but since these programs come with the default DSL installation it is not likely.

Another possibility is that your cut-and-paste process did not go correctly.

Good Luck.
Back to top
Profile PM 
clivesay Offline





Group: Guests
Posts: 935
Joined: Dec. 2003
Posted: July 06 2004,16:37 QUOTE

I installed the dpkg.dsl file and then did an apt-get update to get the tuxpaint packages. Do I need to specifically run the command from the menu instead of using the .dsl package? Thanks

Chris
Back to top
Profile PM MSN YIM 
43 replies since July 06 2004,05:32 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (9) </ [1] 2 3 4 5 6 ... >/
reply to topic new topic new poll
Quick Reply: deb2dsl script testers needed

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code