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 12 Dec 2019, 04:20
All times are UTC - 4
 Forum index » House Training » Beginners Help ( Start Here)
dir2pet without gui? [SOLVED]
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [15 Posts]  
Author Message
slavvo67

Joined: 12 Oct 2012
Posts: 1617
Location: The other Mr. 305

PostPosted: Sat 11 Mar 2017, 17:48    Post subject:  dir2pet without gui? [SOLVED]  

Let's say I have a directory containing 20 sub-directories that I wish to package individually as .pet files. I understand the GUI in dir2pet makes you add the version # of the application but is there a more streamlined script to do so?
Last edited by slavvo67 on Sun 16 Jul 2017, 14:36; edited 1 time in total
Back to top
View user's profile Send private message 
stemsee

Joined: 27 Jun 2013
Posts: 2544
Location: In The Way

PostPosted: Sat 11 Mar 2017, 18:51    Post subject:  

Code:
for dir in `ls appdirs/*`
do
makepet $dir
done


my apptree cold be adapted

Code:
#!/bin/sh
# apptree copyright (c) 2015 Marcos M Contant
#
if [ ! -z "$2" ]; then
   nm="$2"
else
   . /tmp/name
fi
while read line
do
lined=`echo $line | rev | cut -f2,3,4,5,6,7,8,9,10,11,12,13,14 -d '/' | rev`
mkdir -p $HOME/"$nm"/"$lined"
cp -f $line $HOME/"$nm"/"$lined"/
done < "$1"
rox $HOME/"$nm" &

choice=`yad --geometry=400 --text "Make an sfs or pet? or both? Enter: 'sfs', 'pet' or 'both'"  --entry`
name=`yad --geometry=250 --title "Rename $nm dir to:" --entry`
if [ ! -z "$name" ]; then
   rename "$nm" "$name" $HOME/"$nm"
   nm="$name"
fi
case $choice in
   sfs) mksquashfs $HOME/"$nm" $HOME/"$nm".sfs -comp xz | yad --title "Mksquashfs" --progress --pulsate
   rox $HOME;;
   pet) exec makepet $HOME/"$nm"
   rox $HOME;;
   both) mksquashfs $HOME/"$nm" $HOME/"$nm".sfs -comp xz | yad  --title "Mksquashfs" --progress --pulsate
         exec makepet $HOME/"$nm"
         rox $HOME;;
   *) exec "$0";;
esac
deldir=`yad --geometry=250 --title "Remove /root/'$nm' dir? y or n" --entry`
case $deldir in
   y) rm -rf $HOME/"$nm" | yad --title "Removing '$nm'" --progress --pulsate;;
   n) exit 0;;
   *) exit 1;;
esac
exit 0
#############finished##############

Last edited by stemsee on Mon 17 Jul 2017, 10:55; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger 
slavvo67

Joined: 12 Oct 2012
Posts: 1617
Location: The other Mr. 305

PostPosted: Sat 11 Mar 2017, 19:43    Post subject:  

Hi Stemsee:

I appreciate your response and, as usual, I wasn't clear enough. So, you get those 4 or so questions when packaging the pet. That's fine for 1 or 2 pets but when you have 20 or so subdirectories, it's annoying and redundant. Now, I understand the normal need to add the version number of Firefox, for example. I'm doing something a little different here.... (Hmm, I wonder if there's a way to grep that version and pass it to the package name)....

I'm basically taking everything located in /root/.packages/builtin_files and rebuilding them back into pets (basically reverse engineering a puppy, no?). I already completed the first step of creating sub directories in my chosen directory /root/NEWPET and now I'm basically repacking each directory as a version 1.0 to put into Woof and recreate.

Why? Because certain distros no longer have their packages available. For example, Quirky Unicorn which, aside from the name, is probably my favorite 32bit Quirky.

Here's my 2nd part hack:

cd /
cd /root/NEWPET
for file in *; do
echo "Creating package..."
tar -zcvf $file-1.0.tar.gz $file
sync
TARBALL="$file-1.0.tar.gz"
echo
echo "File $file.tar.gz created. Now converting to .pet..."
FULLSIZE="`stat --format=%s ${TARBALL}`"
MD5SUM="`md5sum $TARBALL | cut -f 1 -d ' '`"
echo -n "$MD5SUM" >> $TARBALL
sync
mv -f $TARBALL $file-1.0.pet
sync
echo
echo "$file.pet has been created. Finished."
echo
echo "If you look in /root/NEWPET you will see the new file."
echo
echo "dir2pet exited."
done

Last edited by slavvo67 on Sat 11 Mar 2017, 19:48; edited 1 time in total
Back to top
View user's profile Send private message 
slavvo67

Joined: 12 Oct 2012
Posts: 1617
Location: The other Mr. 305

PostPosted: Sat 11 Mar 2017, 19:47    Post subject:  

Here's my first to take the original build files:

#!/bin/bash

cd /
mkdir "/root/NEWPET"
cd /root/.packages/builtin_files

find . | while read file; do
file1="/root/.packages/builtin_files/$file"
## filename extracts only the file name and extension from the full directory
filename=$(basename "$file1")
filename2="${filename%.*}"
mkdir "/root/NEWPET/$filename2"
built1=`echo "$file1" | awk -F "/" '{print $4}'`
if [[ "$built1" = "builtin_files" ]]; then
while IFS='' read -r line || [[ -n "$line" ]]; do
last1=`echo "${line: -1}"`
first1=`echo "${line:0:1}"`
echo "$first1" >>/root/FIRST1
echo "$last1" >>/root/FIRST1
if [[ "$first1" = "/" ]]; then
directory1="$line"
mkdir "/root/NEWPET/$filename2/$directory1"
fi
if [[ "first1" != "/" ]]; then
line2="$(echo -e "${line}" | sed -e 's/^[[:space:]]*//')"
echo "$directory1">/root/DIRECTORY1.txt
echo "$line2">/root/LINE2.txt
cp "$directory1/$line2" "/root/NEWPET/$filename2$directory1/$line2"
fi
done < "$file1"
else
while IFS='' read -r line || [[ -n "$line" ]]; do
last1=`echo "${line: -1}"`
first1=`echo "${line:0:1}"`
if [[ "$last1" = "/" ]]; then
mkdir "/root/NEWPET/$filename2/$line"
else
cp "$line" "/root/NEWPET/$filename2/$line"
fi
done < "$file1"
fi
done
yad --text="Should be done. Look in /root/NEWPET/for your package"
Back to top
View user's profile Send private message 
Geoffrey


Joined: 30 May 2010
Posts: 2377
Location: Queensland

PostPosted: Sat 11 Mar 2017, 21:36    Post subject:  

Gnewpet - makes pets from installed packages
http://murga-linux.com/puppy/viewtopic.php?p=598673#598673

_________________
Carolina: Recent Repository Additions

Back to top
View user's profile Send private message 
wow

Joined: 29 Jun 2006
Posts: 1040
Location: Peru

PostPosted: Sat 11 Mar 2017, 22:17    Post subject:  

Quote:
Let's say I have a directory containing 20 sub-directories that I wish to package individually as .pet files.

If you have a .desktop file or a simple pet.spec or don't care about package description for ppm, you can try something like this:
Code:
for i in * ; do [ -d $i ] && tar -zcf $i.tar.gz $i && tgz2pet $i.tar.gz ; done

_________________

Back to top
View user's profile Send private message 
slavvo67

Joined: 12 Oct 2012
Posts: 1617
Location: The other Mr. 305

PostPosted: Sat 11 Mar 2017, 23:32    Post subject:  

Hi Geoffrey: Gnewpet is good but it has the gui and only packages one pet at a time. Otherwise, it would be a great option.

Hi Wow: I will need to try your script. I actually solved with the longer script(s) above but yours is much shorter and may work better.
Back to top
View user's profile Send private message 
slavvo67

Joined: 12 Oct 2012
Posts: 1617
Location: The other Mr. 305

PostPosted: Sat 18 Mar 2017, 23:56    Post subject:  

Hi all:

I noticed that my scripts didn't take into account the petspec file that Woof requires. I amended one of the scripts to create that file so now I'm solved for sure. Not going to post a bunch of script here but if someone is interested, you can PM for it.

Best,

Slavvo67
Back to top
View user's profile Send private message 
belham2

Joined: 15 Aug 2016
Posts: 1707

PostPosted: Sun 19 Mar 2017, 06:14    Post subject:  

slavvo67 wrote:
Hi all:

I noticed that my scripts didn't take into account the petspec file that Woof requires. I amended one of the scripts to create that file so now I'm solved for sure. Not going to post a bunch of script here but if someone is interested, you can PM for it.

Best,

Slavvo67



Hi Slavvo67,

Posted this just now, it kind of relates to your thread here:

http://www.murga-linux.com/puppy/viewtopic.php?t=109975

Why do we (or any user) need to carry the absurdly large .packages folder in /root when we have all these script developments (by the way, sure wish you'd post what you finished-found out here, be nice for us/others to see and maybe use---forum PM-ing scripts is NOT the recommended method for disseminating anything on murga). Anyhow, what you did, getting rid of those redundant 4 questions, sounds great. Wink
Back to top
View user's profile Send private message 
01micko


Joined: 11 Oct 2008
Posts: 8739
Location: qld

PostPosted: Sun 19 Mar 2017, 06:53    Post subject:  

Code:
# dir2pet -h

Usage: dir2pet [option]... [<name-of-dir>]

Create a compressed file containing the content of a directory

Options:
  -h, --help            show this help
  -C, --change-compression-default Change the default compression
               (gz or xz, currently xz)

--------------------------------------------------------------------

Basic:
  <name-of-dir>   the directory, not path, to be packaged.
      THIS IS THE PACKAGE.
      (Omit if specified with -p option)

  EXAMPLE:
    # dir2pet my_fun_game-0.1-i486

--------------------------------------------------------------------

Advanced:
  -s         skip all questions - for package build scripts
  -p=<name-of-dir> directory to be packaged. THIS IS THE PACKAGE.

The following options are only useful with the "-s" option.
For best results, use as many as possible:

Compression: (use only one, default if none chosen is "xz")
  -x   use xz (high) compression
  -g   use gz (low) compression

Non-compulsory:
  -w="<description>" quoted description of the application
  -d=<+deps>        comma-delimited dependencies, with prepended
           "+" sign
  -c=<Category>        category of application, for package manager -
           allowed categories:
         BuildingBlock (default)
         Desktop
         System
         Setup
         Utility
         Filesystem
         Graphic
         Document
         Business
         Personal
         Network
         Internet
         Multimedia
         Fun

  EXAMPLE
    # dir2pet -x -s -w="fun game" -d=+gtk+,+ffmpeg,+cairo -p=my_fun_game-0.1-i486


This has been in woof-ce for over 3 years.

_________________
Puppy Linux Blog - contact me for access
Back to top
View user's profile Send private message Visit poster's website 
slavvo67

Joined: 12 Oct 2012
Posts: 1617
Location: The other Mr. 305

PostPosted: Sun 19 Mar 2017, 09:10    Post subject:  

Thanks, 01micko. I note, dir2pet in Quirky does not have the -h option so I was dealing with a slightly different doggie. Might want to let BK know though I'm not sure if he branched the dir2pet differently in Quirky.

Sadly, I put quite a bit of time in hacking dir2pet and petspec in order to reverse out the /root/.packages directory. Anyway, it's a very specific request and probably not useful to most.

I'll grab the woof-CE dir2pet and maybe try to incorporate your version into a Quirk-en-Stein. Maybe, that's what BarryK's Easy is supposed to be...

Anyway, thanks for your help!!

Slavvo67
Back to top
View user's profile Send private message 
slavvo67

Joined: 12 Oct 2012
Posts: 1617
Location: The other Mr. 305

PostPosted: Mon 20 Mar 2017, 18:28    Post subject:  

Just an update, my scripts work but do not import properly into Woof. Figuring it out.....

Slavo67
Back to top
View user's profile Send private message 
slavvo67

Joined: 12 Oct 2012
Posts: 1617
Location: The other Mr. 305

PostPosted: Sun 16 Jul 2017, 10:59    Post subject:  

01micko:

Has the dir2pet sciript without GUI been working for 3 years?

The script below creates a pet but the pet will not extract when clicked on....

dir2pet -x -s -p=$petname

So currently I have to extract the package manually and repackage as pet for it to work. Mind you, this is in Quirky but should be just about the same.
Back to top
View user's profile Send private message 
slavvo67

Joined: 12 Oct 2012
Posts: 1617
Location: The other Mr. 305

PostPosted: Sun 16 Jul 2017, 14:35    Post subject:  

Sorry, Mick -- I answered my own question:

It needs the w= or it won't package correctly...

dir2pet -g -s -w="$name111" -p=$name111
Back to top
View user's profile Send private message 
slavvo67

Joined: 12 Oct 2012
Posts: 1617
Location: The other Mr. 305

PostPosted: Thu 20 Jul 2017, 23:31    Post subject:  

To correct my previous post, the -g instead of the -x made the difference.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [15 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Beginners Help ( Start Here)
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.1701s ][ Queries: 11 (0.0121s) ][ GZIP on ]