[csw-devel] SF.net SVN: gar:[13101] csw/mgar/gar/v2/lib/sh/libcheckpkg.sh

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Fri Jan 28 01:28:53 CET 2011


Revision: 13101
          http://gar.svn.sourceforge.net/gar/?rev=13101&view=rev
Author:   wahwah
Date:     2011-01-28 00:28:53 +0000 (Fri, 28 Jan 2011)

Log Message:
-----------
checkpkg: Reverting to the old custom-pkgtrans

The new version fails for CSWgdbm on Solaris 10.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/sh/libcheckpkg.sh

Modified: csw/mgar/gar/v2/lib/sh/libcheckpkg.sh
===================================================================
--- csw/mgar/gar/v2/lib/sh/libcheckpkg.sh	2011-01-28 00:20:42 UTC (rev 13100)
+++ csw/mgar/gar/v2/lib/sh/libcheckpkg.sh	2011-01-28 00:28:53 UTC (rev 13101)
@@ -14,7 +14,9 @@
 # set -e
 # set -u
 
-function custom_pkgtrans {
+function short_custom_pkgtrans {
+  # This function sometimes fails.  It works on Solaris 9, but likes to fail
+  # on Solaris 10.
   local outd
   local skipblks
   if ! [[ -d "$2" ]]; then
@@ -36,3 +38,43 @@
     exit 1
   fi
 }
+
+
+get_header_blocks() {
+  dd if="$1" skip=1 \
+    | cpio -i -t 2>&1  >/dev/null \
+    | nawk '{print $1; exit;}'
+}
+
+custom_pkgtrans() {
+  local hdrblks
+  if [[ ! -d "$2" ]] ; then
+    echo ERROR: "$2" is not a directory >/dev/fd/2
+    return 1
+  fi
+  hdrblks=$(get_header_blocks "$1")
+
+  echo "initial hdrblks=$hdrblks"
+
+  hdrblks=$(( $hdrblks + 1 ))
+  mkdir $2/$3
+
+  local counter=0
+  while :; do
+    echo "Attempting ${hdrblks} offset"
+    # cpio sometimes returns 1, and we don't want to bail out when it happens.
+    dd if="$1" skip="$hdrblks" | (cd $2/$3 ; cpio -ivdm) || true
+    if [[ -d "$2/$3/install" ]]; then
+      echo "Unpack successful."
+      break
+    fi
+    hdrblks=$(( $hdrblks + 1 ))
+    counter=$(( $counter + 1 ))
+    # To prevent us from going on forever.
+    if [[ "${counter}" -gt 100 ]]; then
+      echo "Unpack keeps on being unsuccessful. Bailing out."
+      return 1
+    fi
+    echo "Unpack unsuccessful, trying offset ${hdrblks}"
+  done
+}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list