Page 1 of 2

No txz2dir in 3.1 Porteus ?

Posted: 13 Feb 2016, 05:40
by Rava
Seems, in current Porteus (3.1 XFCe, x86-64) there is no longer a txz2dir:

Code: Select all

root@porteus:/mnt/live/memory/images# find . |grep txz2dir
root@porteus:/mnt/live/memory/images# 
Does anyone have the script at hand that works well in this version?


I duckduckgo'd forit, and the only distro that I found is: wifislax 4.10.1 or 4.11.1 VMware Edition , which is > 1.1 GB, and quite the overkill to download for a tiny script as such... :wall:

Re: No txz2dir in 3.1 Porteus ?

Posted: 13 Feb 2016, 07:14
by Ed_P
Rava wrote:Seems, in current Porteus (3.1 XFCe, x86-64) there is no longer a txz2dir:

Code: Select all

root@porteus:/mnt/live/memory/images# find . |grep txz2dir
root@porteus:/mnt/live/memory/images# 
Does anyone have the script at hand that works well in this version?
Not in 3.0 either.

Code: Select all

guest@porteus:~$ txz2dir
bash: txz2dir: command not found
guest@porteus:~$ su
Password: 
root@porteus:/home/guest# txz2dir
bash: txz2dir: command not found
root@porteus:/home/guest# 
You sure you spelled it right?

-edit-

There is a txz2xzm and a xzm2dir though/

txz2xzm

Code: Select all

#!/bin/bash
# Convert Slackware's package(s) into .xzm module
#
# Author: Tomas M. <http://www.linux-live.org>
# Modifications for Porteus by fanthom


# Exit if nothing is provided as an argument:
if [ "$1" = "" ]; then
    echo
    echo "Convert Slackware's TXZ package into .xzm compressed module"
    echo "usage:"
    echo
    echo "$0 package.txz"
    echo "$0 package1.txz package2.txz package3.txz"
    echo "$0 /folder/with_packages/*"
    exit 1
fi

# Work only on txz/tgz packages:
for x in $*; do
    ext=`echo $x | rev | cut -d. -f1 | rev`
    if [ "$ext" = txz -o "$ext" = tgz ]; then
	mod=`readlink -f $x`
	MOD=`echo $MOD $mod`
    fi
done

# Switch to root:
if [ "$DISPLAY" ]; then
    if [ `whoami` != "root" ]; then
	/opt/porteus-scripts/xorg/psu "/opt/porteus-scripts/txz2xzm $MOD"
	exit
    fi
else
    if [ `whoami` != "root" ]; then
	echo "Please enter root's password below"
        su - -c "/opt/porteus-scripts/txz2xzm $MOD"
        exit
    fi
fi

# Create module:
for y in $MOD; do
    TMPDIR=/tmp/txz2xzm$$
    XZM="`echo $y | rev | cut -d. -f2- | rev`.xzm"

    installpkg -root $TMPDIR $y
    if [ $? != 0 ]; then echo "error installing $y 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*/*

    echo -e "Creating $XZM\n"
    dir2xzm $TMPDIR $XZM >/dev/null
    if [ $? != 0 ]; then echo "error building compressed image"; exit; fi

    rm -Rf $TMPDIR
done
xzm2dir

Code: Select all

#!/bin/bash
# convert .xzm compressed file back into directory tree
#
# 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
      /opt/porteus-scripts/xorg/psu "/opt/porteus-scripts/xzm2dir $mod $mod2"
      exit
   fi
else
   if [ `whoami` != "root" ]; then
      echo "Please enter root's password below"
      su -c "/opt/porteus-scripts/xzm2dir $mod $mod2"
      exit
   fi
fi

if [ ! -d "$2" ]; then
   echo 
   echo "Convert .xzm compressed module back into directory tree"
   echo "usage: $0 source_file.xzm existing_output_directory"
   exit 1
fi

unsquashfs -f -dest "$2" "$1"

Re: No txz2dir in 3.1 Porteus ?

Posted: 13 Feb 2016, 09:07
by bour59
Hi
to do this I use explodepkg

Re: No txz2dir in 3.1 Porteus ?

Posted: 13 Feb 2016, 13:29
by aus9
I have in the past used as root
unsquashfs <packagename>

Re: No txz2dir in 3.1 Porteus ?

Posted: 16 Feb 2016, 20:11
by beny
hi rava you can do this with file roller or ark

Re: No txz2dir in 3.1 Porteus ?

Posted: 16 Feb 2016, 21:39
by tome
tar -xvf %F
or
installpkg -root %d/%N %F - only for root, not tested

Re: No txz2dir in 3.1 Porteus ?

Posted: 23 Mar 2016, 17:04
by port
a txz2dir is trivial:

Code: Select all

mkdir DIRNAME && tar xvJf FILE.txz -C DIRNAME
if you want a command with same parameters as old txt2dir ( txz2dir file.txz directory ) just add this function to your .bashrc or similar:

Code: Select all

txz2dir () {
mkdir $1 && tar xvJf $2 -C $1
}
you can improve the function with error checking in parameters passed, I let this to you as exercise ;-)

Re: No txz2dir in 3.1 Porteus ?

Posted: 23 Mar 2016, 20:15
by Bogomips
tome wrote:tar -xvf %F
Or bsdtar -xf <pkg>.txz -C <dir> or explodepkg.
tome wrote:installpkg -root %d/%N %F - only for root, not tested
Here however install script will be run on the fake root directory.

Depends on the needs of the moment.

Re: No txz2dir in 3.1 Porteus ?

Posted: 01 May 2016, 20:26
by wread
I do it the brutal way: txz2xzm, then extract xzm 8)

Re: No txz2dir in 3.1 Porteus ?

Posted: 19 Aug 2016, 18:16
by jmhoward56
you should be root to do the following;
First create a directory where you want to install the txz pkg

Code: Select all

mkdir /tmp/mytxz
Then in the same directory where the txz file is located do this;

Code: Select all

ROOT="/tmp/mytxz" installpkg "txz filename"
replace "tmp/mytxz" with your directory name, less quotes and the same with "txz filename"

When it completes you will find your file "installed" in the directory you created. You could then do a dir2xzm if you wanted to create a module from the contents of the directory.

Re: No txz2dir in 3.1 Porteus ?

Posted: 19 Aug 2016, 20:31
by francois
There are very elegant cli solutions in this post. Thanks for that great knowledge. :D

My way, the newbie way is:
right click on the txz package > submenu txz2xzm
right click on the xzm package (porteus module) > submenu extract module

8)

Re: No txz2dir in 3.1 Porteus ?

Posted: 24 Aug 2016, 04:35
by Rava
With all these possibilities, we really need a working wiki, or at least post in in our HOWTO part of the forum. Of course someone needs to not only check out all these possibilities, but also put it into [ code ] with examples (and probably with the command output / data and file result as well when these differ, and they might differ)
wread wrote:I do it the brutal way: txz2xzm, then extract xzm 8)
That was my lazy ass variant as well, but when I try to create a slim custom build all-in-one-with-only-the-really-needed-dependencies txz and hace to open and try out 15 or more modules, I tell you that sucks, since not only you have to convert each single one into a folder, but also have to work in monitoring which dependencies you really need, and so I want a more robust and less workload solution..

Re: No txz2dir in 3.1 Porteus ?

Posted: 24 Aug 2016, 16:18
by francois
fanthom solution:
http://forum.porteus.org/viewtopic.php?f=94&t=4398

Code: Select all

activate /path/*
Locically, I imagine that also should work:

Code: Select all

deactivate /path/*

Code: Select all

txz2xzm /path/*

Code: Select all

xzm2dir /path/*
etc.

Re: No txz2dir in 3.1 Porteus ?

Posted: 24 Aug 2016, 16:42
by Jack
Was there ever txz2dir in any version of Porteus? Cause for me to build a bundle package, here what I have to do. Take a *.txz and convert to *.xzm then xzm2dir and then from dir2xzm to build the bundle. That a lot of work.

Re: No txz2dir in 3.1 Porteus ?

Posted: 24 Aug 2016, 17:24
by francois
Yes there was I am almost sure in 2.x.