Improving The Wrappers From Xarchive

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
abushcrafter
Posts: 1418
Joined: Fri 30 Oct 2009, 16:57
Location: England
Contact:

#16 Post by abushcrafter »

Update!

The new change is the "pupzip" script is now included and has support for the formats I added to the improved xarchive wrappers and support for "shar". I also removed some wrappers that did not have any improvements in the first place.

@Karl Godt.
I tried to understand what changes where need but I only understood one, I think :?. Though I am not at all sure that I did understood that one. So if you could apply your changes to the new version I posted and PM them to me and I will post a new version.
[url=http://www.adobe.com/flashplatform/]adobe flash is rubbish![/url]
My Quote:"Humans are stupid, though some are clever but stupid." http://www.dependent.de/media/audio/mp3/System_Syn_Heres_to_You.zip http://www.systemsyn.com/

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#17 Post by Karl Godt »

Done

Maybe
cat $i | sed 's#> /dev/stderr#>>/tmp/xarchive_errs.log#g' > $i
gives an empty file

This should do it better :

Code: Select all

for i in *; do cat $i | sed 's#>/dev/stderr#>>/tmp/xarchive_errs.log#g' > /tmp/$i; mv -f /tmp/$i ./$i ; done 

for i in *; do cat $i | sed 's#> /dev/stderr#>>/tmp/xarchive_errs.log#g' > /tmp/$i; mv -f /tmp/$i ./$i ; done

User avatar
gcav
Posts: 104
Joined: Fri 25 May 2012, 04:12
Location: Ontario

wrapper for lzh

#18 Post by gcav »

I could not find one.. So I hacked this up..

Code: Select all

#! /bin/bash
# Wrapper for LZH - GCL
# Based on rar-wrap.sh - bash rar wrapper for xarchive

# set up exit status variables
E_UNSUPPORTED=65

# Supported file extentions for lha
EXTS="lzh lharc lha"

# Program to wrap
if [ "$(which lha)" ]; then
    LHA_PROG="lha"
else
    LHA_PROG="lha"
fi

# Setup awk program to use
AWK_PROGS="mawk gawk awk"
AWK_PROG=""
for awkprog in $AWK_PROGS; do
    if [ "$(which $awkprog)" ]; then
        AWK_PROG="$awkprog"
        break
    fi
done

# Setup xterm program to use
XTERM_PROGS="xterm rxvt xvt wterm aterm Eterm"
XTERM_PROG=""
for xtermprog in $XTERM_PROGS; do
    if [ "$(which $xtermprog)" ]; then
        XTERM_PROG="$xtermprog"
        break
    fi
done

# setup variables opt and archive.
# the shifting will leave the files passed as
# all the remaining args "$@"
opt="$1"
shift 1
archive="$1"
shift 1

# Command line options for prog functions
# disable comments when opening
OPEN_OPTS="l"
ADD_OPTS="a"
NEW_OPTS="a"
REMOVE_OPTS="d"
EXTRACT_OPTS="x"
PASS_EXTRACT_OPTS="x"

# the option switches
case "$opt" in
    -i) # info: output supported extentions for progs that exist
        if [ ! "$AWK_PROG" ]; then
            echo none of the awk programs $AWK_PROGS found >> /dev/stderr
            echo extentions $EXTS ignored >> /dev/stderr
        elif [ "$(which $LHA_PROG)" ]; then
            for ext in $EXTS; do
                printf "%s;" $ext
            done
        else
            echo command $LHA_PROG not found >> /dev/stderr 
            echo extentions $EXTS ignored >> /dev/stderr 
        fi
        printf "\n"
        exit
        ;;

    -o) # open: mangle output of lha cmd for xarchive 
        # format of lha output:
# PERMSSN    UID  GID      SIZE  RATIO     STAMP           NAME
# ---------- ----------- ------- ------ ------------ --------------------
# drwxr-xr-x     0/0           0 ****** Jul 11 23:46 AppBuilder-0.4/
# -rwxr-xr-x     0/500      2948 100.0% Feb 12  2002 AppBuilder-0.4/.DirIcon
# -rw-r-----     0/500       317  59.0% Mar 21  2006 AppBuilder-0.4/AppInfo.xml
# -rwxr-x---     0/500      2907  47.0% Dec  4  2006 AppBuilder-0.4/AppRun
# drwxr-xr-x     0/0           0 ****** Jul 11 23:46 AppBuilder-0.4/Help/
# -rw-r--r--   100/500      1356  59.7% Mar 10  2006 AppBuilder-0.4/Help/AppBuilder.htm
#     1           2          3       4   5   6    7    8 
        
        $LHA_PROG $OPEN_OPTS "$archive" | $AWK_PROG -v uuid=${UID-0} '
        # The body of info we wish to process starts with a dashed line 
        # so set a flag to signal when to start and stop processing.
        # The name is on one line with the info on the next so toggle
        # a line flag letting us know what kinda info to get. 
	/^-------/ { flag++; if (flag > 1) exit 0; next }
	{
	if (flag == 0) next
	#year=$7
	#month=$5
	#day=$6
	gid=$2
	time=$5"-"$6"-"$7
	attr=$1
	size=$3
	#$0=substr($0, 54)
	name=$8
	gsub(/\\/, "/", name)
															
	printf "%s;%d;%s;%d;%d;%s;-\n", name, size, attr, uid,gid,   time
	}'
																																																										
        exit
        ;;

    -a) # add:  to archive passed files
        # we only want to add the file's basename, not
        # the full path so...
        while [ "$1" ]; do
            cd "$(dirname "$1")"
            $LHA_PROG $ADD_OPTS "$archive" "$(basename "$1")"
            wrapper_status=$?
            shift 1
        done
        exit $wrapper_status
        ;;

    -n) # new: create new archive with passed files 
        # create will only be passed the first file, the
        # rest will be "added" to the new archive
        cd "$(dirname "$1")"
        $LHA_PROG $NEW_OPTS "$archive" "$(basename "$1")"
        exit
        ;;

    -r) # remove: from archive passed files 
        $LHA_PROG $REMOVE_OPTS "$archive" "$@"
        exit
        ;;

    -e) # extract: from archive passed files 
        # xarchive will put is the right extract dir
        # so we just have to extract.
        $LHA_PROG $EXTRACT_OPTS "$archive" "$@"
        if [ "$?" -ne "0" ] && [ "$XTERM_PROG" ]; then
            echo Probably password protected,
            echo Opening an x-terminal...
            $XTERM_PROG -e $LHA_PROG $PASS_EXTRACT_OPTS "$archive" "$@"
        fi
        exit
        ;;

     *) echo "error, option $opt not supported"
        echo "use one of these:" 
        echo "-i                #info" 
        echo "-o archive        #open" 
        echo "-a archive files  #add" 
        echo "-n archive file   #new" 
        echo "-r archive files  #remove" 
        echo "-e archive files  #extract" 
        exit
esac

User avatar
gcav
Posts: 104
Joined: Fri 25 May 2012, 04:12
Location: Ontario

lha... and 7z

#19 Post by gcav »

Just realized that 7z and its wrapper supports lha... oh well...

gc

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#20 Post by amigo »

Just realized that my program: AppBuilder-0.4
was being used as an example. People should write me and tell me they are using my stuff -I might be able to help them!

User avatar
peebee
Posts: 4370
Joined: Sun 21 Sep 2008, 12:31
Location: Worcestershire, UK
Contact:

How to extend Xarchive for tar.zst archives??

#21 Post by peebee »

New post to a very old thread.........

http://distro.ibiblio.org/puppylinux/pe ... mmon32.pet

http://distro.ibiblio.org/puppylinux/pe ... mmon64.pet

Packages are starting to appear from Arch Linux using zstd compression - tar.zst archives.

Xarchive needs to be extended with a new wrapper to cope with these new files....see below

Thanks
peebee
Last edited by peebee on Sun 19 Jan 2020, 16:36, edited 1 time in total.
ImageLxPup = Puppy + LXDE
Main version used daily: LxPupSc; Assembler of UPups, ScPup & ScPup64, LxPup, LxPupSc & LxPupSc64

Dry Falls
Posts: 616
Joined: Tue 16 Dec 2014, 23:37
Location: Upper Columbia

#22 Post by Dry Falls »

Hi Peebee.

What I did was...

Code: Select all

mkdir /root/.config/rox.sourceforge.net/OpenWith/.application_x-zstd-compressed-tar
and symlink Xarchiver.desktop there and also /usr/local/bin/ExtractWithXarchiver.

ExtractWithXarchiver:

Code: Select all

#!/bin/sh
/usr/bin/xarchiver -e "$@"
You can make pet or pkg (from pkgtools) from there.

df

edit: Ah, you're looking for an entry in /usr/local/lib/xarchive/
Sorry, good question.

User avatar
peebee
Posts: 4370
Joined: Sun 21 Sep 2008, 12:31
Location: Worcestershire, UK
Contact:

Zstandard integration

#23 Post by peebee »

Only works if your system has the zstd binary.... check with

Code: Select all

which zstd
before installing. (LxPupSc and ScPup have zstd but don't think any other pup does....)

Changes or adds the following files (which are spread all over the Woof-CE build system):
/etc/
/etc/xdg/
/etc/xdg/rox.sourceforge.net/
/etc/xdg/rox.sourceforge.net/MIME-types/
/etc/xdg/rox.sourceforge.net/MIME-types/application_x-archlinux-package-zst
/etc/xdg/rox.sourceforge.net/MIME-types/application_x-zstd-compressed-tar
/root/
/root/.config/
/root/.config/rox.sourceforge.net/
/root/.config/rox.sourceforge.net/OpenWith/
/root/.config/rox.sourceforge.net/OpenWith/.application_x-zstd/
/root/.config/rox.sourceforge.net/OpenWith/.application_x-zstd/Add Bookmark
/root/.config/rox.sourceforge.net/OpenWith/.application_x-zstd-compressed-tar/
/root/.config/rox.sourceforge.net/OpenWith/.application_x-zstd-compressed-tar/Add Bookmark
/root/.config/rox.sourceforge.net/OpenWith/.application_x-zstd-compressed-tar/pupMd5sum
/root/.config/rox.sourceforge.net/OpenWith/.application_x-zstd/pupMd5sum
/usr/
/usr/bin/
/usr/bin/pcompress
/usr/bin/pextract
/usr/lib/
/usr/lib/xarchive/
/usr/lib/xarchive/wrappers/
/usr/lib/xarchive/wrappers/tar-wrap.sh
/usr/share/
/usr/share/applications/
/usr/share/applications/mimeapps.list
/usr/share/applications/pextract.desktop
/usr/share/icons/
/usr/share/icons/hicolor/
/usr/share/icons/hicolor/scalable/
/usr/share/icons/hicolor/scalable/mimetypes/
/usr/share/icons/hicolor/scalable/mimetypes/application-x-archlinux-package-gz.svg
/usr/share/icons/hicolor/scalable/mimetypes/application-x-archlinux-package-xz.svg
/usr/share/icons/hicolor/scalable/mimetypes/application-x-archlinux-package-zst.svg
/usr/share/icons/hicolor/scalable/mimetypes/application-x-gz-compressed-tar.svg
/usr/share/icons/hicolor/scalable/mimetypes/application-x-gz.svg
/usr/share/icons/hicolor/scalable/mimetypes/application-x-xz-compressed-tar.svg
/usr/share/icons/hicolor/scalable/mimetypes/application-x-xz.svg
/usr/share/icons/hicolor/scalable/mimetypes/application-x-zstd-compressed-tar.svg
/usr/share/icons/hicolor/scalable/mimetypes/application-x-zstd.svg
/usr/share/mime/
/usr/share/mime/application/
/usr/share/mime/application/x-archlinux-package-gz.xml
/usr/share/mime/application/x-archlinux-package-xz.xml
/usr/share/mime/application/x-archlinux-package-zst.xml
/usr/share/mime/application/x-zstd-compressed-tar.xml
/usr/share/mime/application/x-zstd.xml
/usr/share/mime/packages/
/usr/share/mime/packages/puppy.xml
Attachments
zstd4puppy-1.0.pet
(10.53 KiB) Downloaded 155 times
ImageLxPup = Puppy + LXDE
Main version used daily: LxPupSc; Assembler of UPups, ScPup & ScPup64, LxPup, LxPupSc & LxPupSc64

Post Reply