--- ./Resources/bin/src2pkg.00	2009-02-22 11:08:55.000000000 +0100
+++ ./Resources/bin/src2pkg	2009-02-19 09:41:31.000000000 +0100
@@ -102,6 +102,7 @@
 echo "  	   Advanced options for special non-standard packages:"
 echo " -E	Use extended database files (slack-required and slack-supplies)"
 echo " -L	Delete extra language files (man-pages, locale and i18n) files."
+echo " -PET	Create the final package as a '.pet' archive."
 echo " -TGZ	Use gzip to compress the final package (this is the default)."
 echo " -TBZ	Use bzip2 instead of gzip to compress the final package."
 echo " -TLZ	Use lzma instead of gzip to compress the final package."
@@ -174,6 +175,7 @@
 		-N) NEW_BUILD=1 ; shift ;;
 		-O) USE_OBJ_DIR="YES" ; shift ;;
 		-P) CORRECT_PERMS="NO" ; shift ;;
+		-PET) PKG_FORMAT="pet" ; shift ;;
 		-Q) INTERACTIVE_MODE="ALL" ; shift ;;
 		-R) REPLAY_ERRORS="YES" ; shift ;;
 		-REAL) INSTALL_TYPE="REAL" WRITE_INSTALL_TYPE=1 ; shift ;;
--- ./Resources/bin/trackinstall.00	2009-02-22 11:09:45.000000000 +0100
+++ ./Resources/bin/trackinstall	2009-02-19 09:42:43.000000000 +0100
@@ -65,6 +65,7 @@
 echo " -E	Use extended database files (slack-required and slack-supplies)"
 echo " -L	Delete extra language files (man-pages, locale and i18n) files."
 echo "		Be sure to configure /etc/src2pkg/DONT_PURGE.locales file first."
+echo " -PET	Create the final package as a '.pet' archive."
 echo " -TGZ	Use gzip to compress the final package (this is the default)."
 echo " -TBZ	Use bzip2 instead of gzip to compress the final package."
 echo " -TLZ	Use lzma instead of gzip to compress the final package."
@@ -111,6 +112,7 @@
 		-L)  PURGE_LOCALES="YES" ; shift ;;
 		-N) NEW_BUILD=1 ; shift ;;
 		-P) CORRECT_PERMS="NO" ; shift ;;
+		-PET) PKG_FORMAT="pet" ; shift ;;
 		-Q) INTERACTIVE_MODE="ALL" ; shift ;;
 		-REAL) INSTALL_TYPE="REAL" ; shift ;;
 		-S) SHELL_INSTALL=1 ; shift ;;
--- ./Resources/doc/ChangeLog.00	2009-02-22 11:21:24.000000000 +0100
+++ ./Resources/doc/ChangeLog	2009-02-22 11:19:43.000000000 +0100
@@ -152,0 +153,5 @@
+	- (15-make_package) Added support for creating '.pet' packages as used for
+	  Puppy Linux. Only a few lines were needed to add support for this simple
+	  package format. Lines to remove stale package were also added to (03-make_dirs)
+	  Added options to src2pkg and trackinstall
+	  
@@ -155,3 +160,4 @@
-	- (14A-last_minute_details) Added a check for $HOME directory in the package.
-	  Some Makefiles wrongly try to create files and/or directories in your HOME 
-	  dir. This check warns the user and suggests fixing it.
+	- (14A-last_minute_details) Added a check for $HOME directory in the package,
+	  but skip this check when creating '.pet' packages. Some Makefiles wrongly
+	  try to create files and/or directories in your HOME dir. This check warns
+	  the user and suggests fixing it.
--- ./Resources/man/src2pkg.1.00	2009-02-22 11:15:29.000000000 +0100
+++ ./Resources/man/src2pkg.1	2009-02-19 10:19:42.000000000 +0100
@@ -165,6 +165,9 @@
 .br
 Be sure to configure /etc/src2pkg/DONT_PURGE.locales file first.
 .TP
+\fB\-PET\fR
+Create the final package as a '.pet' archive (Not compatible with Slackware installpkg).
+.TP
 \fB\-TBZ\fR
 Use bzip2 to compress the final package (Not compatible with Slackware installpkg).
 .TP
--- ./Resources/man/trackinstall.1.00	2009-02-22 11:18:31.000000000 +0100
+++ ./Resources/man/trackinstall.1	2009-02-19 10:19:19.000000000 +0100
@@ -102,6 +102,9 @@
 .br
 Be sure to configure /etc/src2pkg/DONT_PURGE.locales file first.
 .TP
+\fB\-PET\fR
+Create the final package as a '.pet' archive (Not compatible with Slackware installpkg).
+.TP
 \fB\-TBZ\fR
 Use bzip2 to compress the final package (Not compatible with Slackware installpkg).
 .TP
--- ./Resources/libexec/15-make_package.00	2009-02-22 11:13:41.000000000 +0100
+++ ./Resources/libexec/15-make_package	2009-02-18 17:17:19.000000000 +0100
@@ -10,7 +10,51 @@
 fi
 
 if [[ "$FAILED" = "" ]] ; then
-        # Build the package:
+   # Build the package:
+   if [[ "$PKG_FORMAT" = "pet" ]] ; then
+	cd $PKG_BUILDS_DIR
+	# change the name of the PKG_DIR temporarily
+	mv $PKG_DIR $PKG_BUILDS_DIR/$NAME-$VERSION
+	# take care of doinst.sh and pet.specs files
+	if [[ -f $PKG_BUILDS_DIR/$NAME-$VERSION/install/doinst.sh ]] ; then
+		mv $PKG_BUILDS_DIR/$NAME-$VERSION/pinstall.sh
+	fi
+	if [[ -f $CWD/*.pet.specs ]] ; then
+		cp $CWD/*.pet.specs $PKG_BUILDS_DIR/$NAME-$VERSION
+	else
+		echo PETMENUDESCR="'$(grep -m 1 $NAME: $PKG_BUILDS_DIR/$NAME-$VERSION/install/$PKG_DESC |cut -f 3- -d ' ')'" > $PKG_BUILDS_DIR/$NAME-$VERSION/$NAME.pet.specs
+		echo PETOFFICIALDEPS="''" >> $PKG_BUILDS_DIR/$NAME-$VERSION/$NAME.pet.specs
+		echo PETREGISTER="'yes'" >> $PKG_BUILDS_DIR/$NAME-$VERSION/$NAME.pet.specs
+		if [[ $AUTO_SCRIPT ]] ; then
+		   cp $PKG_BUILDS_DIR/$NAME-$VERSION/$NAME.pet.specs $CWD/$NAME.pet.specs
+		fi
+	fi
+	rm -rf $PKG_BUILDS_DIR/$NAME-$VERSION/install
+	
+	TAR_NAME=$NAME-$VERSION
+	echo -n $BLUE"Creating installable '.pet' package - "$NORMAL
+	# use standard tar for these packages unless we see why not
+	if [[ $QUIET = "YES" ]] ; then
+		# ${TAR} --owner=root --group=root -cvf "$TAR_NAME".tar "$TAR_NAME" &> /dev/null
+		tar --owner=root --group=root -cvf "$TAR_NAME".tar.pet "$TAR_NAME" &> /dev/null
+	else
+		# ${TAR} --owner=root --group=root -cvf "$TAR_NAME".tar "$TAR_NAME"
+		tar --owner=root --group=root -cvf "$TAR_NAME".tar.pet "$TAR_NAME"
+	fi
+	# now change the name of the package tree back to PKG_DIR
+	mv $PKG_BUILDS_DIR/$NAME-$VERSION $PKG_DIR
+	gzip "$TAR_NAME".tar.pet
+	md5sum $(basename "$TAR_NAME".tar.pet.gz) >> "$TAR_NAME".tar.pet.gz
+	mv "$TAR_NAME".tar.pet.gz "$TAR_NAME".pet
+	if [[ -f "$TAR_NAME".pet ]] ; then
+	   echo $GREEN"Successful!"$BLUE"- Package Location:"$NORMAL
+	   echo $PKG_BUILDS_DIR/$NAME-$VERSION.pet
+	else
+	   echo ""
+	   echo $RED"FAILED! "$NORMAL"Creation of package has failed."
+	   FAILED="PACKAGE CREATION in: $FUNCNAME"
+	fi
+   else
 	echo -n $BLUE"Making installable package - "$NORMAL
 	if [[ $QUIET = "YES" ]] ; then
 	  cd "$PKG_DIR" ;
@@ -35,6 +79,7 @@
 	  echo "$PACKAGE"
 	fi
 	[[ $REALLY_INSTALL = "YES" ]] && really_install
+   fi
 fi
 
 if [[ $ALLOW_USER_EXTENSIONS = "YES" ]] ; then
--- ./Resources/libexec/14A-last_minute_details.00	2009-02-21 20:28:07.000000000 +0100
+++ ./Resources/libexec/14A-last_minute_details	2009-02-22 11:14:36.000000000 +0100
@@ -367,7 +367,7 @@
 	echo "   You may need to patch the Makefile(s) to correct the installation prefix."
 	BAD_DIRS=1
    fi
-   if [[ -d $PKG_DIR$HOME ]] && [[ "$PKG_FORMAT" != "pet" ]] ; then
+   if [[ -d $PKG_DIR$HOME ]] ; then
 	echo
 	echo $CYAN"   Notice - "$NORMAL"Package contains $HOME directory -your HOME directory."
 	echo "   You may need to patch the Makefile(s) to correct this."
--- ./Resources/libexec/03-make_dirs.00	2009-02-22 11:22:24.000000000 +0100
+++ ./Resources/libexec/03-make_dirs	2009-02-17 21:06:27.000000000 +0100
@@ -20,7 +20,10 @@
 	# clean up any leftover directories, packages and logs. Use rm -rf as safely as possible
 	if [[ -f "$PACKAGE" ]] || [[ -d "$PKG_DIR" ]] ; then
 	  [[ "$QUIET" = "YES" ]] && echo -n $BLUE"Deleting old build files - "$NORMAL
-	  if [[ -f "$PKG_DEST_DIR/$PKG_NAME" ]] && [[ "$PACKAGE" != "$SOURCE" ]] ; then
+	  if [[ "$PKG_FORMAT" = "pet" ]] ; then
+	    [[ "$QUIET" = "NO" ]] && echo $BLUE"Removing existing pet package from previous build - "$NORMAL
+	    ( cd "$PKG_DEST_DIR" && rm -f "$NAME-$VERSION.pet" 2> /dev/null 1> /dev/null )
+	  elif [[ -f "$PKG_DEST_DIR/$PKG_NAME" ]] && [[ "$PACKAGE" != "$SOURCE" ]] ; then
 	    [[ "$QUIET" = "NO" ]] && echo $BLUE"Removing existing package from previous build - "$NORMAL
 	    ( cd "$PKG_DEST_DIR" && rm -f "$PKG_NAME" 2> /dev/null 1> /dev/null )
 	  fi
--- ./Resources/libexec/14A-last_minute_details.00	2009-03-04 11:54:56.000000000 +0100
+++ ./Resources/libexec/14A-last_minute_details	2009-03-11 09:45:14.000000000 +0100
@@ -371,7 +371,7 @@
 	echo "   You may need to patch the Makefile(s) to correct the installation prefix."
 	BAD_DIRS=1
    fi
-   if [[ -d $PKG_DIR$HOME ]] && [[ "$PKG_FORMAT" != "pet" ]] ; then
+   if [[ -d $PKG_DIR$HOME ]] ; then
 	echo
 	echo $CYAN"   Notice - "$NORMAL"Package contains $HOME directory -your HOME directory."
 	echo "   You may need to patch the Makefile(s) to correct this."
