Code: Select all
#!/bin/bash
# convert Slackware's TGZ (or TXZ) package into .xzm compressed file
# which can be used as a LiveCD module
#
# Author: Tomas M. <http://www.linux-live.org>
# Modifications for Porteus by fanthom
mod=`readlink -f $1`
mod2=`readlink -f $2`
# Switch to root
if [ "$DISPLAY" ]; then
if [ `whoami` != "root" ]; then
ktsuss "/opt/porteus-scripts/txz2xzm $mod $mod2"
exit
fi
else
if [ `whoami` != "root" ]; then
echo "Please enter root's password below"
su - -c "/opt/porteus-scripts/txz2xzm $mod $mod2"
exit
fi
fi
if [ "$1" = "" -o "$2" = "" ]; then
echo
echo "Convert Slackware's TXZ package into .xzm compressed module"
echo "usage: $0 source_filename.txz output_file.xzm"
exit 1
fi
TMPDIR=/tmp/txz2xzm$$
installpkg -root $TMPDIR $1
if [ $? != 0 ]; then echo "error installing package"; exit; fi
# optimalization procedures, this doesn't hurt
find $TMPDIR/usr{/local/,/share/,/}{man,info} -type l -name "*.gz" 2>/dev/null | xargs -r gunzip -f
find $TMPDIR/usr{/local/,/share/,/}{man,info} -type f -name "*.gz" 2>/dev/null | xargs -r gunzip
cp -a $TMPDIR/usr/share/man $TMPDIR/usr 2>/dev/null; rm -rf $TMPDIR/usr/share/man
rm -f $TMPDIR/{usr,usr/local,var}/man/cat*/*
dir2xzm $TMPDIR "$2"
if [ $? != 0 ]; then echo "error building compressed image"; exit; fi
rm -Rf $TMPDIR