Initrd.gz Editor - simple GUI tool

Miscellaneous tools
Message
Author
User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

Initrd.gz Editor - simple GUI tool

#1 Post by sc0ttman »

Initrd.gz Editor
a single shell script that can be used to edit contents of initrd.gz

Now supports all initrd.gz files, from all puppies

It will auto-install itself to /usr/bin if not found to be installed already.
Comment out line 150 (self_install) to disable this.

Requires X desktop, Gtkdialog, Xdialog
Save to a shell script. Make it executable. Run it.

If you pass the initrd.gz path, through the command line, no GUI is loaded, just your file manager.

You can also pass the desired save directory as the second argument.

Screenshots below, but here's the code:

Code: Select all

#!/bin/sh

# sc0ttman
# Initrd-Editor: unpack, edit and rebuild your "initrd.gz" file
# a simple GUI.. requires X desktop, GtkDialog3 and Xdialog
# possible to easily modify, to translate (but I don't have gettext installed)
# do as you like with this, or not at all :)

# usage: initrd-editor.sh [ /full/path/to/initrd.gz ] [ /full/path/to/save/dir ]
# note: both paths must start with / and are optional

# export all functions
set -a

# setup vars to be used
SCRIPT_PATH="$0"
SCRIPT_NAME=`basename $0`
# apps to use, first listed is most preferable
[ ! "$FILEMAN" ] && FILEMAN="`which rox`"
[ ! "$FILEMAN" ] && FILEMAN="`which thunar`"
[ ! "$FILEMAN" ] && FILEMAN="`which nautilus`"
[ ! "$FILEMAN" ] && FILEMAN="`which pcmanfm`"
[ ! "$FILEMAN" ] && FILEMAN="`which mc`"
[ ! "$FILEMAN" ] && FILEMAN="`which asm`"
# setup desired options for the file manager in use
[ "$FILEMAN" = "`which asm`" ] && FILEMAN="rxvt -e ${FILEMAN}"
[ "$FILEMAN" = "`which mc`" ] && FILEMAN="rxvt -e ${FILEMAN}"
[ "$FILEMAN" = "`which rox`" ] && FILEMAN="${FILEMAN} -n"
# use latest gtkdialog
GTKDIALOG=`which gtkdialog`
GTKDIALOG=`which gtkdialog2`
GTKDIALOG=`which gtkdialog3`
# setup dirs
WORKDIR="/tmp/initrd-editor"
# use given save dir, or default if none given
[ -d "$2" ] && SAVEDIR="$2" || SAVEDIR="$HOME/Downloads"
echo "save dir is $SAVEDIR"
# no errors so far ;)
XPID=''
INSTALL_CHECK=''
ERROR=''

# GUI text
LOC_GUI_TITLE="Initrd.gz Editor - rebuild your init script"
LOC_GUI_FILE="Choose your initrd.gz file:"
LOC_GUI_EDIT_DIALOG="Edit the contents of initrd.gz\nClick OK only when you are finished."
LOC_GUI_SAVE_DIALOG="Success - your new initrd.gz is ready, in ${SAVEDIR}"
LOC_ERROR_FILE="Error: File not found."
LOC_ERROR_FILETYPE="Error: File must have a .gz extension"
LOC_ERROR_WORKDIR="Error: Work directory not available"
LOC_ERROR_SAVEDIR="Error: Save directory not available"

## functions
self_install () {
   # check if installed
   INSTALL_CHECK=`which $SCRIPT_NAME`
   # if it was not found, copy to /usr/bin
   [ "$INSTALL_CHECK" = "" ] && cp -f "$SCRIPT_PATH" "/usr/bin/"
}
# error checking
check_errors () {
   # file maybe changed since above, re-check
   FILENAME=`basename "$FILE"`
   FILEEXT=${FILENAME##*.} # file extension only
   if [ ! -f "$FILE" ];then
      ERROR="$LOC_ERROR_FILE"
   elif [ "$FILEEXT" != "gz" ];then
      ERROR="$LOC_ERROR_FILETYPE"
   elif [ ! -d "$WORKDIR" ];then
      mkdir "$WORKDIR" || ERROR="$LOC_ERROR_WORKDIR"
   elif [ ! -d "$SAVEDIR" ];then
      mkdir "$SAVEDIR" || ERROR="$LOC_ERROR_SAVEDIR"
   fi
   # set final message
   LOC_GUI_ERROR_DIALOG="$ERROR"
}
# check archive type
check_filetype () {
   CPIOTEST=''
   CPIOTEST=`file -z "$FILE" | grep cpio`
   GZIPTEST=''
   GZIPTEST=`file -z "$FILE" | grep "filesystem data"`
}
# extract function
extract_file () {
   cd "$WORKDIR"
   if [ "$CPIOTEST" != "" ];then
      zcat "$FILE" | cpio -i -d
      # make sure nothing mounted
      rm -r "${WORKDIR}/mntd/"*
      rmdir "${WORKDIR}/mntd"
   else
      # need to copy file to workdir
      cp "$FILE" "${WORKDIR}"
      # unpack
      rm -f "${WORKDIR}/initrd"
      gunzip "${WORKDIR}/initrd.gz"
      # mount
      mkdir "${WORKDIR}/mntd"
      mount -o loop initrd "${WORKDIR}/mntd"
   fi
}
# edit initrd function
edit_init () {
   if [ -d "${WORKDIR}/mntd" ];then # if initrd is mounted
      $FILEMAN "${WORKDIR}/mntd" &
   else
      $FILEMAN "$WORKDIR" &
   fi
   XPID=$!
   sleep 1
   Xdialog --title "Initrd Editor" --msgbox "$LOC_GUI_EDIT_DIALOG" 0 0
   kill $XPID > /dev/null 2>&1
   rox -D "$WORKDIR" > /dev/null 2>&1
}
# compress function
compress_file () {
   cd "${WORKDIR}"
   # remove any old ones
   rm "${SAVEDIR}/initrd.gz"
   # build the new file
   if [ "$CPIOTEST" != "" ];then
      find . | cpio -o -H newc | gzip -9 > "${SAVEDIR}/initrd.gz"
   else
      sync
      umount -f "${WORKDIR}/mntd"
      sync
      gzip "${WORKDIR}/initrd"
      mv -f "${WORKDIR}/initrd.gz" "${SAVEDIR}/initrd.gz"
   fi
   # show file in file manager, only if save dir not chosen by user
   if [ "$SAVEDIR" = "$HOME/Downloads" ];then
   	$FILEMAN "${SAVEDIR}" &
   fi
   sleep 1
   Xdialog --title "Initrd Editor" --msgbox "$LOC_GUI_SAVE_DIALOG" 0 0
}
cleanup_files () {
   # clean up and exit program
   rm -r "${WORKDIR}/"*  > /dev/null 2>&1
   rmdir "${WORKDIR}/temp" > /dev/null 2>&1
   rmdir "${WORKDIR}/" > /dev/null 2>&1
   sync
   umount "${WORKDIR}/temp"
   sync
}
# run program function
run_program () {
   # install to /usr/bin, if not there already
   self_install
   # check arrors and exit with a message, if needed
   check_errors
   if [ "$ERROR" != "" ];then
      Xdialog --title "Initrd Editor" --msgbox "$LOC_GUI_ERROR_DIALOG" 0 0
      # exit with error
      exit 1
   else
      # do the thing
      cd "$WORKDIR"
      check_filetype
      extract_file
      edit_init
      compress_file
      cleanup_files
      # exit without error
      killall gtkdialog3 --p INITRD_EDITOR_GUI -c > /dev/null 2>&1
      exit 0
   fi
}

# check for file given through command line
if [ -f "$1" ];then
   # assign given file to $FILE
   FILE="$1"
   # run with no gui
   run_program
fi

# if no file given, user must use GUI to choose a file
[ "$FILE" = "" ] && FILE="/choose/your/path/to/initrd.gz"
# GUI
export INITRD_EDITOR_GUI='<window title="Initrd Editor">
<vbox>
<frame>
   <vbox homogeneous="true">
      <text><label>'${LOC_GUI_TITLE}'</label></text>
   </vbox>
</frame>
<frame>
   <vbox>
      <text><label>'${LOC_GUI_FILE}'</label></text>
      <hbox>
         <entry tooltip-text="The initrd.gz file.">
            <default>'$FILE'</default>
            <variable>FILE</variable>
         </entry>
         <button>
            <input file icon="gtk-open"></input>
            <action type="fileselect">FILE</action>
         </button>
      </hbox>
   </vbox>
</frame>
<frame>
   <vbox>
      <hbox>
         <button ok>
            <action>run_program</action>
         </button>
         <button cancel></button>
      </hbox>
   </vbox>
</frame>
</vbox>
</window>'

# run the GUI
$GTKDIALOG -p INITRD_EDITOR_GUI -c
unset INITRD_EDITOR_GUI

# exit without error
exit 0
I think it's all working as I want it now.
Attachments
initrd-editor1.png
(131.24 KiB) Downloaded 3212 times
initrd-editor.png
(188.56 KiB) Downloaded 3479 times
Last edited by sc0ttman on Sun 29 May 2011, 08:28, edited 7 times in total.
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

ICPUG
Posts: 1308
Joined: Mon 25 Jul 2005, 00:09
Location: UK

#2 Post by ICPUG »

Confused by the screenshot.

Does this allow editing the init script or editing of any file that exists within initrd.gz?

nooby
Posts: 10369
Joined: Sun 29 Jun 2008, 19:05
Location: SwedenEurope

#3 Post by nooby »

ICPUG I know too little but maybe this part indicate what it can and not can do?

# setup vars to be used
SCRIPT_PATH="$0"
SCRIPT_NAME=`basename $0`
# apps to use, first listed is least preferable
FILEMAN="`which asm`"
FILEMAN="`which mc`"
FILEMAN="`which nautilus`"
FILEMAN="`which pcmanfm`"
FILEMAN="`which thunar`"
FILEMAN="`which rox`"
# use latest gtkdialog
GTKDIALOG=`which gtkdialog`
GTKDIALOG=`which gtkdialog2`
GTKDIALOG=`which gtkdialog3`
# setup dirs
WORKDIR="/tmp/initrd-editor"
SAVEDIR="$HOME/Downloads"

It can use these then so if one look what they can do would that answer your question?

But my gut feeling is supporting your take on it that this "rebuilder" takes apart an initrd so you can rebuild it but maybe don't do anything inside the files that the initrd is made out of???

But maybe allow that one exchange one such file for another that one edit outside of this program? Sorry I only guess but I find these things interesting if they would help me get to boot a linux that insist to look for a file at the CD or USB when I have these files on the HDD instead.

So if this prog allow me to change such that would be cool
I use Google Search on Puppy Forum
not an ideal solution though

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#4 Post by sc0ttman »

ICPUG wrote:Confused by the screenshot.

Does this allow editing the init script or editing of any file that exists within initrd.gz?
it opens up all of the contents (not only init script) of the initrd.gz file in rox, or thunar if rox is not found, or pcmanfm, etc...
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

nooby
Posts: 10369
Joined: Sun 29 Jun 2008, 19:05
Location: SwedenEurope

#5 Post by nooby »

So would this allow me to edit ArchBang and Kanotix and a lot of other distros that stubbornly only look for files on the CD/DVD and by changing what they look for make them look for these files on internal HDD instead?
I use Google Search on Puppy Forum
not an ideal solution though

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#6 Post by sc0ttman »

I should say as a note, I built this with a plan to integrate into Woofy ...and I would still really appreciate someone talking a look at lines 77-80, and find out why the 'kill $XPID' command does not work....
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

nooby
Posts: 10369
Joined: Sun 29 Jun 2008, 19:05
Location: SwedenEurope

#7 Post by nooby »

Does this help? The only similar codes I managed to find on the internet using google.

# Start new X
X :1 -layout SCLayout -ac &
XPID=$!
sleep 2

# Do Volume Key Control mapping if set up
if [ -f $HOME/.scbind ]; then
xbindkeys --display :1 -f $HOME/.scbind
fi

# Start Pulse Audio & Starcraft in new X
DISPLAY=:1 ck-launch-session wine $HOME/.wine/drive_c/Starcraft/StarCraft.exe -- /usr/bin/X :1 -layout SCLayout

# Cleanup
sleep 1
kill $XPID

As you see above he has first declared??? that

# Start new X
X :1 -layout SCLayout -ac &
XPID=$!
sleep 2

then in the end he does the kill thing

# Cleanup
sleep 1
kill $XPID

So my humble suggestion is that you need to look through if XPID ever was declared somewhere first or else it maybe don't know what you want it to do?

Sorry I know nothing but wanted to "help" your brain going on it.
If you are several layers higher or deeper already then I apology.

Never mind me using the term declare that could be misleading. Assign or set or establish or give or whatever word that is proper there.
I use Google Search on Puppy Forum
not an ideal solution though

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#8 Post by seaside »

sc0ttman wrote:I should say as a note, I built this with a plan to integrate into Woofy ...and I would still really appreciate someone talking a look at lines 77-80, and find out why the 'kill $XPID' command does not work....
sc0ttman,

It doesn't work because no additional process has been set.
"XPID" was never set to any value.

You could close the directory by using "rox -D [directoryname]

EDIT: I see you already discovered that - "rox -D "$WORKDIR" > /dev/null 2>&1". Unfortunately, you'll probably have to do something similar for other filemanagers :)


Cheers,
s

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#9 Post by sc0ttman »

But I have this above it:

Code: Select all

# edit initrd function
edit_init () {
   $FILEMAN "$WORKDIR" > /dev/null 2>&1
   XPID=$! 
that should work right? I've used it many times before in other scripts...
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#10 Post by Dougal »

Your edit_init() is a complete mess:
- $! gives you the PID of the last backgrounded (by the shell) process -- the line above it does not end with "&"...
- With Rox it will be a problem anyway, as Rox defaults to running all instances as the same process... you could try using "rox -n", but killing is ugly and a shame to use when you have "rox -D" for closing windows
- You also include "rox -D", which breaks the whole FILEMAN abstraction...

What you could do is replace the Barry-style kludge of FILEMAN="`which bla`" repetition with a if-elif list thus:

Code: Select all

if type rox >/dev/null 2>&1 ; then
# use rox
elif type thunar >/dev/null 2>&1 ; then
#use thunar
..
and use functions to abstract the opening and closing of directories, so the rox functions will look like:

Code: Select all

open_dir(){
rox -d "$1"
}

close_dir(){
rox -D "$1"
}

(if the file manager doesn't support closing like rox, you can add the XPID parts into the functions)

Then edit_init will just be

Code: Select all

edit_init () {
   open_dir "$WORKDIR" > /dev/null 2>&1
   Xdialog --title "Initrd Editor" --msgbox "$LOC_GUI_EDIT_DIALOG" 0 0
   close_dir "$WORKDIR" > /dev/null 2>&1
}
I'd also recommend not using all the redirection to stderr... you don't realize how many bugs in Puppy hide under Barry's liberal use of that.
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#11 Post by sc0ttman »

cheers for the info, much appreciated, its kind of adapted for my pc at the moment, i'll apply your suggestions, and I think my eyes are going - I thought I had that ampersand there already! But cheers for the info! :)
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

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

#12 Post by Karl Godt »

"!$" is used to use part of the last command, like
# echo "A"
A
# echo !$
echo "A"
A
#

The process-id could be determined with "$$" for the script itself or `pidof $PROGRAM`

but

# if [ -z "$ABC" ] ; then
geany -i &
XPID=$!
echo $XPID
ps axc | grep geany
pidof geany
fi

should work , too ... so there might be something like kill -9 $XPID , kill -14 ... kill -15 ... necessary ... There are over 30 kill -s SIGNAL , of which I only have "kill -s HUP `pidof pppd`" experience with .

On the other hand there might be the chance killing rox would kill the whole "rox -p $HOME/Choices/ROX-Filer/PuppyPin" ... and killing should be after "X"-ing the rox-window-frame-button , am I right ?

In that case perhaps
if [ "$FILEMAN" != "rox" ] ; then
$FILEMAN "$WORKDIR" 2>/tmp/fileman.errs
XPID=$!
Xdialog --title "Initrd Editor" --msgbox "$LOC_GUI_EDIT_DIALOG" 0 0
kill $XPID
else
rox -n "$WORKDIR" 2>/tmp/rox.errs
Xdialog --title "Initrd Editor" --msgbox "$LOC_GUI_EDIT_DIALOG" 0 0
rox -D "$WORKDIR"
fi

note : "rox -n" for new instance .... like dougal suggests [ rox -h ]

or

$FILEMAN $WORKDIR
XPID=$!
XPIDrox=`ps | grep -i 'rox' | grep -w "$WORKDIR"`
###[ -n "$XPIDrox" ] && XPID=$XPIDrox###
Xdialog --title "Initrd Editor" --msgbox "$LOC_GUI_EDIT_DIALOG" 0 0
[ -z "$XPIDrox" ] && kill -9 $XPID
[ -n "$XPIDrox" ] && rox -D "$WORKDIR"

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#13 Post by seaside »

I'm a fan of placing tools for single files on right-click menus and usually looking to only edit the "init" file.

Code: Select all

#!/bin/sh
# right-click to edit 'init' file in initrd.gz
# link file to /root/.config/rox.sourceforge.net/OpenWith

[ "$1" != "" ] && FILE="$1" || exit

mkdir -p /tmp/INITDIR
cd /tmp/INITDIR
zcat "$FILE" | cpio -i -d  
defaulttexteditor /tmp/INITDIR/init

Xdialog --title "Edit-init" --ok-label "Restore" --msgbox "You may now edit the 'init' file in $DEFAULTTEXTEDITOR. 
When finished editing save the file 
then Click 'Restore' when ready to construct
a new initrd file at '/tmp/initrd.gz'." 0 0

find . | cpio -o -H newc | gzip -9 > /tmp/initrd.gz

rm -r /tmp/INITDIR

exit
Since the tree is at "/tmp/INITDIR", you can always edit other things as well before doing a rebuild.

s

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#14 Post by sc0ttman »

looks nice seaside... I do actually plan to release initrd-editor with the latest Woofy, which I will upgrade at some point. I will use the right click option though, it's a good idea... Although presumably, the right click option would appear for all .gz (or cpio) files, not only initrd.gz, right?

Also, thanks for the suggestions everyone, I will add them in and update the main post when I get time... I know parts of the script are weak, I posted it here after the first write and test, before I darted to work...

I may or may not include some of goingnuts work, to detect if X is running, and if not, to run only CLI tools for $FILEMAN and such... Although as this is merely a part of Woofy, that is out of the scope of the requirements.

Of course, another way around my lil problem, which is obviously quite easy to fix, would be to negate it entirely - by opening up the init script directly in geany..

I did think about this, although I do not know if there is anything else worth editing in there... If not I would be happy to load up only the init script... So....

Is there anything else in the initrd.gz file, apart from the init script, that is worth editing?
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#15 Post by seaside »

sc0ttman wrote:.. Although presumably, the right click option would appear for all .gz (or cpio) files, not only initrd.gz, right?

My script has no checking, but you could add extension checking and a mime type

. If not I would be happy to load up only the init script... So....
Is there anything else in the initrd.gz file, apart from the init script, that is worth editing?

It's mostly empty directories and setup for the initial ramdisk which perhaps a developer might modify but not usually the average user- not that the average user would normally be modifying the "init" file either :)
Regards,
s

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#16 Post by sc0ttman »

updated code in main post - now works as I want it... considered mroe or less finished.
Thanks for the help everyone :) (I know it could be improved and I appreciate the suggestions..)

EDIT: just a quick question: I've tried many of the examples on this forum to open the initrd.gz of puppy2/214X, but get cpio errors, many lines such as :

Code: Select all

cpio: Malformed number
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#17 Post by sc0ttman »

To answer myself, I think the answer is here: http://www.murga-linux.com/puppy/viewto ... 254#293254

Different archive formats after puppy 2... How can we detect the archive type, before trying to extract it?
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#18 Post by Dougal »

sc0ttman wrote:How can we detect the archive type, before trying to extract it?

Code: Select all

file -z $File
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#19 Post by sc0ttman »

Dougal wrote:
sc0ttman wrote:How can we detect the archive type, before trying to extract it?

Code: Select all

file -z $File
you da man! so glad you hover around on these forums!
a constant time saver! 8)
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#20 Post by sc0ttman »

I will update this tool today, so that it checks the archive type and runs the correct unpacking/packing commands...
Then done!
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

Post Reply