General TC > Programming & Scripting - Unofficial

Quick hack to convert Debian packages.

(1/9) > >>

Jason W:
This may come in handy for grabbing a .deb and making it into a tce/tcz.  This is a tool for personal means of easily installing debs as tce/tcz, it is not meant as a way to create submittable extensions.
Example:  Save script as deb2tc, make executable.  Then:

deb2tc emelfm_0.9.2-8_i386.deb emelfm.tcz

Will place emelfm.tcz in your home directory.

Depends: squashfs-tools, findutils

Script is attached.

Download the script, then enter the directory where you have the script.  Also have your .deb package in the same directory.

Then enter these commands, without the #, and run as root:

#chmod a+x deb2tcz
#./deb2tcz package.deb package.tcz

bigpcman:
Thanks for the handy script. I wonder if this could be used to install openoffice?

Jason W:
I had small things in mind like libdvdcss for Xine, but the openoffice debs would get converted.  But getting such a big and complex set of packages made for another distro to work on TC could be a challenge.

bigpcman:

--- Quote from: Jason W on July 11, 2009, 11:22:58 PM ---This may come in handy for grabbing a .deb and making it into a tce/tcz.  This is a tool for personal means of easily installing debs as tce/tcz, it is not meant as a way to create submittable extensions.
Example:  Save script as deb2tc, make executable.  Then:

deb2tc emelfm_0.9.2-8_i386.deb emelfm.tcz

Will place emelfm.tcz in your home directory.

Depends: squashfs-tools


--- Code: ---#!/bin/sh
# Create tce/tcz from Debian package
# Usage: $ scriptname packagename.deb packaganame.tce


TMP1="`mktemp -d /tmp/tce.1.XXXXXX`"
TMP2="$TMP1"/pkg
FILE="$1"
APPNAME="$2"
INPUT=${FILE##*.}

make_tce() {
mkdir "$TMP2"
ar p "$FILE" data.tar.gz > "$TMP1"/data.tar.gz
tar xzvf "$TMP1"/data.tar.gz -C "$TMP2"
cd "$TMP2"
[ -d usr/share/doc ] && rm -r usr/share/doc
[ -d usr/share/man ] && rm -r usr/share/man
[ -d usr/share/menu ] && rm -r usr/share/menu
find . -type d -empty | xargs rmdir > /dev/null 2&>1
find `ls` -not -type d > "$TMP1"/list
tar -T "$TMP1"/list -czvf /home/"$USER"/"$APPNAME"
cd
rm -r "$TMP1"
}

make_tcz() {
mkdir "$TMP2"
ar p "$FILE" data.tar.gz > "$TMP1"/data.tar.gz
tar xzvf "$TMP1"/data.tar.gz -C "$TMP2"
cd "$TMP2"
[ -d usr/share/doc ] && rm -r usr/share/doc
[ -d usr/share/man ] && rm -r usr/share/man
[ -d usr/share/menu ] && rm -r usr/share/menu
find . -type d -empty | xargs rmdir > /dev/null 2&>1
mksquashfs "$TMP2" /home/"$USER"/"$APPNAME"
cd
rm -r "$TMP1"
}

[ "$USER" == "root" ] && echo "Do not run as root." && exit 1
[ -z "$APPNAME" ] && echo "You must specify an extension name." && exit 1
[ -f /home/"$USER"/"$APPNAME" ] && echo "You have an existing extension in your \
home directory, you need to move or delete it before trying again." && exit 1
[ -z "$1" ] && echo "You must specify a file."
if [ ! "$INPUT" == "deb" ] ; then
echo "Only Debian packages work with this."
exit 1
fi
EXT=${APPNAME##*.}
if [ `echo "$EXT" | grep "tce"` 2>/dev/null ]; then
make_tce
elif [ `echo "$EXT" | grep "tcz"` 2>/dev/null ]; then
make_tcz
else
echo "You need to specify either a tcz or tce for the output file."
exit 1
fi

if [ -f /home/"$USER"/"$APPNAME" ]; then
echo "Success."
else
echo "Something went wrong."
fi



--- End code ---

--- End quote ---
Does this still work in tc2.4rc5?

Jason W:
Updated for tcz only and added some fixes.

Navigation

[0] Message Index

[#] Next page

Go to full version