-->
python3-tk_3.10.4-0ubuntu1_i386.deb -- zst compression is used inside this file
therefore deb2xzm can not handle it.
I made some modifications to deb2xzm and also to convert_deb - which is used by the xfce
context menu.
Try them if you like.
deb2xzm goes into /opt/porteus-scripts (rename the original one to deb2xzm.orig first
before
you copy in the new one so you can revert back if it does not work correctly.)
convert_deb is in /opt/porteus-scripts/context-menu (also rename the original one beforehand)
Note: I used a x86_64-xfce porteus system. there may or may not differences in a 32bit system.
deb2xzm
Code: Select all
#!/bin/sh
# Convert .deb. packages to .xzm modules.
# Variables
c='\e[36m'
r='\e[31m'
e=`tput sgr0`
. /usr/share/porteus/porteus-functions
. /usr/share/porteus/gtkdialog-functions
PATH=$PATH:/usr/share/porteus/
get_colors
function chklibs(){
echo "Checking required libraries ..."
echo
if [[ ! `/sbin/ldconfig -p | grep libbfd` ]]; then
bold "#############################"
bold "# Missing library #"
bold "#############################"
echo
echo "You are missing libbfd. Please"
echo "activate 05_devel or run the"
bold "command: getpkg binutils"
echo "and installpkg the file."
echo
exit
fi
}
show_help() {
echo
echo "Convert Debian's DEB package into .xzm compressed module"
echo "usage: $0 <option> <argument> "
echo " options: -x : use xz compression. "
echo " options: -z : use zstd compression. "
echo " if no option is given xz is used. "
echo " -h : show this usage. "
echo
echo "example: $0 /mnt/sda2/debian_packages/package.deb"
echo
}
# Exit if nothing is provided as an argument
if [ "$1" = "" ]; then
show_help
exit 1
fi
chklibs
# Switch to root:
if [ `whoami` != root ]; then
for x in "$@"; do
LIST+=("$x")
done
CURRENTPATH="-current=$PWD"
LIST+=("$CURRENTPATH")
# Re-execute this script with super user privileges:
if [ "$DISPLAY" ] && [ "$QUIETMODE" != "-q" ]; then
/opt/porteus-scripts/xorg/psu /opt/porteus-scripts/deb2xzm "${LIST[@]}"
else
echo "Please enter root's password below:"
ROOTCOMMAND="/opt/porteus-scripts/deb2xzm"$(printf ' %q' "${LIST[@]}")
su -c "$ROOTCOMMAND"
fi
exit
fi
# Get current path
for var in "$@"; do
if [[ "$var" = "-current"* ]]; then
cd ${var#*=}
break
fi
done
COMP="-x"
COMP_ZSTD="-z"
while getopts "xzh" opt; do
case "$opt" in
x)
shift "$(($OPTIND -1))"
;;
z)
COMP="$COMP_ZSTD"
shift "$(($OPTIND -1))"
;;
h)
show_help
exit 0
;;
esac
done
# Work only on deb packages:
for x in $*; do
ext=`echo $x | rev | cut -d. -f1 | rev`
if [ "$ext" = deb ]; then
mod=`readlink -f $x`
MOD=`echo $MOD $mod`
fi
done
# Create module:
for y in $MOD; do
mod=`readlink -f $y | sed s/.deb$/.xzm/`
pkg=`echo $mod | awk -F/ '{print$NF}' | sed s/.xzm//g`
dataname=`ar t $y | grep data`
if [ "$DISPLAY" ]; then
case $dataname in
data.tar.bz2)
mkdir /tmp/deb2xzm$$ && cp $y /tmp/deb2xzm$$ && cd /tmp/deb2xzm$$ && /usr/bin/ar x * data.tar.gz && bzip2 -d data.tar.bz2 && gzip data.tar && mv data.tar.gz $pkg.tgz && txz2xzm $COMP /tmp/deb2xzm$$/$pkg.tgz && mv /tmp/deb2xzm$$/$pkg.xzm $mod
if [ $? -eq 0 ]; then
gtkdialog.py -p "Success! Module created as $mod" -t 2000
else
gtkdialog.py -p "Error , $mod creation failed." -d err
fi
;;
data.tar.gz)
mkdir /tmp/deb2xzm$$ && cp $y /tmp/deb2xzm$$ && cd /tmp/deb2xzm$$ && /usr/bin/ar x * data.tar.gz && mv data.tar.gz $pkg.tgz && txz2xzm $COMP /tmp/deb2xzm$$/$pkg.tgz && mv /tmp/deb2xzm$$/$pkg.xzm $mod
if [ $? -eq 0 ]; then
gtkdialog.py -p "Success! Module created as $mod" -t 2000
else
gtkdialog.py -p "Error , $mod creation failed." -d err
fi
;;
data.tar.lzma)
mkdir /tmp/deb2xzm$$ && cp $y /tmp/deb2xzm$$ && cd /tmp/deb2xzm$$ && /usr/bin/ar x * data.tar.lzma && unxz data.tar.lzma && gzip data.tar && mv data.tar.gz $pkg.tgz && txz2xzm $COMP /tmp/deb2xzm$$/$pkg.tgz && mv /tmp/deb2xzm$$/$pkg.xzm $mod
if [ $? -eq 0 ]; then
gtkdialog.py -p "Success! Module created as $mod" -t 2000
else
gtkdialog.py -p "Error , $mod creation failed." -d err
fi
;;
data.tar.xz)
mkdir /tmp/deb2xzm$$ && cp $y /tmp/deb2xzm$$ && cd /tmp/deb2xzm$$ && /usr/bin/ar x * data.tar.xz && unxz data.tar.xz && gzip data.tar && mv data.tar.gz $pkg.tgz && txz2xzm $COMP /tmp/deb2xzm$$/$pkg.tgz && mv /tmp/deb2xzm$$/$pkg.xzm $mod
if [ $? -eq 0 ]; then
gtkdialog.py -p "Success! Module created as $mod" -t 2000
else
gtkdialog.py -p "Error , $mod creation failed." -d err
fi
;;
data.tar.zst)
mkdir /tmp/deb2xzm$$ && cp $y /tmp/deb2xzm$$ && cd /tmp/deb2xzm$$ && /usr/bin/ar x * data.tar.zst && zstd -d data.tar.zst && gzip data.tar && mv data.tar.gz $pkg.tgz && txz2xzm $COMP /tmp/deb2xzm$$/$pkg.tgz && mv /tmp/deb2xzm$$/$pkg.xzm $mod
if [ $? -eq 0 ]; then
gtkdialog.py -p "Success! Module created as $mod" -t 2000
else
gtkdialog.py -p "Error , $mod creation failed." -d err
fi
;;
esac
else
case $dataname in
data.tar.bz2)
mkdir /tmp/deb2xzm$$ && cp $y /tmp/deb2xzm$$ && cd /tmp/deb2xzm$$ && /usr/bin/ar x * data.tar.gz && bzip2 -d data.tar.bz2 && gzip data.tar && mv data.tar.gz $pkg.tgz && txz2xzm $COMP /tmp/deb2xzm$$/$pkg.tgz && mv /tmp/deb2xzm$$/$pkg.xzm $mod && echo && echo -e "${c}Module created as $mod"$e || echo -e ''${r}$mod' creation failed!'$e
;;
data.tar.gz)
mkdir /tmp/deb2xzm$$ && cp $y /tmp/deb2xzm$$ && cd /tmp/deb2xzm$$ && /usr/bin/ar x * data.tar.gz && mv data.tar.gz $pkg.tgz && txz2xzm $COMP /tmp/deb2xzm$$/$pkg.tgz && mv /tmp/deb2xzm$$/$pkg.xzm $mod && echo && echo -e "${c}Module created as $mod"$e || echo -e ''${r}$mod' creation failed!'$e
;;
data.tar.lzma)
mkdir /tmp/deb2xzm$$ && cp $y /tmp/deb2xzm$$ && cd /tmp/deb2xzm$$ && /usr/bin/ar x * data.tar.lzma && unxz data.tar.lzma && gzip data.tar && mv data.tar.gz $pkg.tgz && txz2xzm $COMP /tmp/deb2xzm$$/$pkg.tgz && mv /tmp/deb2xzm$$/$pkg.xzm $mod && echo && echo -e "${c}Module created as $mod"$e || echo -e ''${r}$mod' creation failed!'$e
;;
data.tar.xz)
mkdir /tmp/deb2xzm$$ && cp $y /tmp/deb2xzm$$ && cd /tmp/deb2xzm$$ && /usr/bin/ar x * data.tar.xz && unxz data.tar.xz && gzip data.tar && mv data.tar.gz $pkg.tgz && txz2xzm $COMP /tmp/deb2xzm$$/$pkg.tgz && mv /tmp/deb2xzm$$/$pkg.xzm $mod && echo && echo -e "${c}Module created as $mod"$e || echo -e ''${r}$mod' creation failed!'$e
;;
data.tar.zst)
mkdir /tmp/deb2xzm$$ && cp $y /tmp/deb2xzm$$ && cd /tmp/deb2xzm$$ && /usr/bin/ar x * data.tar.zst && zstd -d data.tar.zst && gzip data.tar && mv data.tar.gz $pkg.tgz && txz2xzm $COMP /tmp/deb2xzm$$/$pkg.tgz && mv /tmp/deb2xzm$$/$pkg.xzm $mod && echo && echo -e "${c}Module created as $mod"$e || echo -e ''${r}$mod' creation failed!'$e
;;
esac
fi
rm -rf /tmp/deb2xzm$$
done
convert_deb
Code: Select all
#!/bin/bash
# Service menu script to convert deb packages to xzm modules
# Author: Brokenman <[email protected]>
. /usr/lib/librokenman
selection=$*
COMP="-x"
COMP_ZSTD="-z"
while getopts "xz" opt; do
case "$opt" in
x)
shift "$(($OPTIND -1))"
;;
z)
COMP="$COMP_ZSTD"
shift "$(($OPTIND -1))"
;;
esac
done
# Root check
if [ "`whoami`" != "root" ]; then
/opt/porteus-scripts/xorg/psu $0 $COMP $selection &
exit
fi
# Convert the packages
for package in $selection; do
path=${package%/*}
name=${package##*/}
dir=${name%.*}
#echo "$name" >> /tmp/.extracted
#echo "$name" > /tmp/.message
/usr/share/porteus/gtkprogress.py -w "DEB Conversion" -m "Converting ${name}..." -t "Processing..." &
#prog=$(ps ax|grep gtkprogress.py |awk '{print$1}'|head -n1)
prog=$!
#sleep 2
mkdir /tmp/deb2xzm$$
cp ${path}/${name} /tmp/deb2xzm$$
cd /tmp/deb2xzm$$
dataname=`ar t * | grep data`
case $dataname in
data.tar.gz)
ar x * data.tar.gz
;;
data.tar.lzma)
ar x * data.tar.lzma && unxz data.tar.lzma && gzip data.tar
;;
data.tar.xz)
ar x * data.tar.xz && unxz data.tar.xz && gzip data.tar
;;
data.tar.zst)
ar x * data.tar.zst && zstd -d data.tar.zst && gzip data.tar
esac
mv data.tar.gz ${dir}.tgz
txz2xzm ${COMP} ${dir}.tgz
mv ${dir}.xzm ${path}/
rm -r /tmp/deb2xzm$$
# kill progress
kill ${prog}
done
# Give notification
/usr/share/porteus/gtkdialog.py -p "Conversion complete!" -t 2000 &
#rm /tmp/.message /tmp/.extracted 2>/dev/null
exit