Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 31 Jul 2014, 13:49
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
Improving The Wrappers From Xarchive
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 2 [20 Posts]   Goto page: Previous 1, 2
Author Message
abushcrafter


Joined: 30 Oct 2009
Posts: 1447
Location: England

PostPosted: Wed 25 May 2011, 18:51    Post subject:  

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 Confused. 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.

_________________
adobe flash is rubbish!
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/
Back to top
View user's profile Send private message Visit poster's website 
Karl Godt


Joined: 20 Jun 2010
Posts: 3956
Location: Kiel,Germany

PostPosted: Thu 26 May 2011, 09:44    Post subject:  

Done

Maybe
Quote:
cat $i | sed 's#> /dev/stderr#>>/tmp/xarchive_errs.log#g' > $i

gives an empty file

This should do it better :
Code:
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
Back to top
View user's profile Send private message Visit poster's website 
gcav

Joined: 25 May 2012
Posts: 19
Location: Ontario

PostPosted: Thu 27 Dec 2012, 01:28    Post subject: wrapper for lzh  

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

Code:

#! /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
Back to top
View user's profile Send private message 
gcav

Joined: 25 May 2012
Posts: 19
Location: Ontario

PostPosted: Thu 27 Dec 2012, 10:28    Post subject: lha... and 7z  

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

gc
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2226

PostPosted: Tue 05 Feb 2013, 15:18    Post subject:  

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!
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 2 [20 Posts]   Goto page: Previous 1, 2
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0739s ][ Queries: 13 (0.0069s) ][ GZIP on ]