• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Question: Extracting PKG Image Assets?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question: Extracting PKG Image Assets?


  • Subject: Re: Question: Extracting PKG Image Assets?
  • From: Mike Escola via Installer-dev <email@hidden>
  • Date: Tue, 18 Feb 2025 23:02:08 -0500

The bashscript I use to expand an installer pkg is below.
Sample arguments to run the script would be,

Where
the directory you'll expand to is the first argument
a subdirectory for each component goes into the path at the 2nd arg, where it
is intended to be a subfolder of the first
a directory that holds the original pkg, the one you'd like to expand, is in
the 3rd argument
the name of the installer, including the .pkg extension, is in the final 4th
argument

./expandpkg.sh installer-layout installer-layout/PackagesInstallerTest1
~/Downloads InstallerTest1.pkg

Image assets will be expected to arrive in a dist/Resources directory under the
installer-layout/InstallerBuildInstallerTest1 directory.

acquirepackage()
{
  shortpackagename=`echo $packagename | perl -e '$line = <>;if
($line=~/^(.+)\.pkg$/){print $1;}'`
  /bin/rm -Rf "$packagedir""/$shortpackagename"
  /bin/mkdir "$packagedir""/$shortpackagename"
  /usr/sbin/chown root:admin "$packagedir""/$shortpackagename"
  /bin/chmod 775 "$packagedir""/$shortpackagename"
  /bin/mkdir "$packagedir""/$shortpackagename""/info"
  /usr/sbin/chown root:admin "$packagedir""/$shortpackagename""/info"
  /bin/chmod 775 "$packagedir""/$shortpackagename""/info"
  /usr/bin/rsync -avzE "$installexpanddir""/""$packagename""/PackageInfo"
"$packagedir""/$shortpackagename""/info/Info.plist"
  if [ -a "$packagedir""/$shortpackagename""/tempdir" ]; then
    /bin/rm -Rf "$packagedir""/$shortpackagename""/tempdir"
  fi
  /bin/mkdir "$packagedir""/$shortpackagename""/tempdir"
  /usr/sbin/chown root:admin "$packagedir""/$shortpackagename""/tempdir"
  /bin/chmod 775 "$packagedir""/$shortpackagename""/tempdir"
  /usr/bin/rsync -avzE "$installexpanddir""/""$packagename""/Payload"
"$packagedir""/$shortpackagename""/tempdir""/Archive.pax.gz"
  /usr/bin/gunzip "$packagedir""/$shortpackagename""/tempdir""/Archive.pax.gz"
  if [ -a "$packagedir""/$shortpackagename""/component" ]; then
    /bin/rm -Rf "$packagedir""/$shortpackagename""/component"
  fi
  /bin/mkdir "$packagedir""/$shortpackagename""/component"
  /usr/sbin/chown root:admin "$packagedir""/$shortpackagename""/component"
  /bin/chmod 775 "$packagedir""/$shortpackagename""/component"
  /usr/bin/rsync -avzE "$packagedir""/$shortpackagename""/tempdir/Archive.pax"
"$packagedir""/$shortpackagename""/component/Archive.pax"
  cd "$packagedir""/$shortpackagename""/component"
  /bin/pax -r -f "$packagedir""/$shortpackagename""/component/Archive.pax"
  /bin/rm -f "$packagedir""/$shortpackagename""/component/Archive.pax"
  if [ -a "$packagedir""/$shortpackagename""/extras" ]; then
    /bin/rm -Rf "$packagedir""/$shortpackagename""/extras"
  fi
  /bin/mkdir "$packagedir""/$shortpackagename""/extras"
  /usr/sbin/chown root:admin "$packagedir""/$shortpackagename""/extras"
  /bin/chmod 775 "$packagedir""/$shortpackagename""/extras"

  if [ -f "$installexpanddir""/""$packagename""/Scripts/""preinstall" ]; then
    rsync -avz "$installexpanddir""/""$packagename""/Scripts/""preinstall"
"$packagedir""/$shortpackagename""/extras/preinstall"
  fi
  if [ -f "$installexpanddir""/""$packagename""/Scripts/""postinstall" ]; then
    rsync -avz "$installexpanddir""/""$packagename""/Scripts/""postinstall"
"$packagedir""/$shortpackagename""/extras/postinstall"
  fi

  #cleanup
  if [ -a "$packagedir""/$shortpackagename""/tempdir" ]; then
    /bin/rm -Rf "$packagedir""/$shortpackagename""/tempdir"
  fi
}

phase="Set original installer, package output dir, and new installer's build
dir"

installerprojectdir="$1"

packagedir="$2"
if ! [ -a "$packagedir" ]; then
  /bin/mkdir "$2"
  chmod 775 "$2"
  chown root:admin "$2"
fi

originaldir="$3"

originstallername="$4"

phase="checkdirs"
if ! [ -a "$originaldir""/""$originstallername" ]; then
  echo "$originaldir""/""$originstallername"
  echo "$phase";exit 1
fi
if ! [ -d "$packagedir" ]; then
  echo "$packagedir"
  echo "$phase";exit 1
fi
installername="$originstallername";
shortorigname=`echo $originstallername | perl -e '$line = <>;if
($line=~/^(.+)\.pkg$/){print $1;}'`

installbuilddir="$installerprojectdir""/InstallerBuild_""$shortorigname"
if [ -a "$installbuilddir" ]; then
  /bin/rm -Rf "$installbuilddir"
fi
if [ -a "$installbuilddir" ]; then
  echo "$installbuilddir"
  echo "$phase";exit 1
fi
/bin/mkdir "$installbuilddir"
/usr/sbin/chown root:admin "$installbuilddir"
/bin/chmod 775 "$installbuilddir"
if ! [ -d "$installbuilddir" ]; then
  echo "$installbuilddir"
  echo "$phase";exit 1
fi


phase="expand"
installexpanddir="$installbuilddir""/expanded"
if [ -a "$installexpanddir" ]; then
  /bin/rm -Rf "$installexpanddir"
fi
if [ -a "$installexpanddir" ]; then
  echo "$installexpanddir"
  echo "$phase";exit 1
fi
if ! [ -a "$originaldir""/""$originstallername" ]; then
  echo "$originaldir""/""$originstallername"
  echo "$phase";exit 1
fi
/usr/sbin/pkgutil --expand "$originaldir""/""$originstallername"
"$installexpanddir"
if ! [ -d "$installexpanddir" ]; then
  echo "$installexpanddir"
  echo "$phase";exit 1
fi
/usr/sbin/chown -R root:admin "$installexpanddir"
/bin/chmod -R 775 "$installexpanddir"
if ! [ -f "$installexpanddir""/Distribution" ]; then
  echo "$installexpanddir""/Distribution"
  echo "$phase";exit 1
fi
/bin/mkdir "$installbuilddir""/dist"
/usr/sbin/chown root:admin "$installbuilddir""/dist"
/bin/chmod 775 "$installbuilddir""/dist"

phase="acquire dist material"
if ! [ -d "$installexpanddir" ]; then
  echo "$installexpanddir"
  echo "$phase";exit 1
fi
if ! [ -f "$installexpanddir""/Distribution" ]; then
  echo "$installexpanddir""/Distribution"
  echo "$phase";exit 1
fi
/bin/mkdir "$installbuilddir""/dist"
/usr/sbin/chown root:admin "$installbuilddir""/dist"
/bin/chmod 775 "$installbuilddir""/dist"

if ! [ -d "$installbuilddir""/dist" ]; then
  echo "$phase";exit 1
fi
/usr/bin/rsync -avzE "$installexpanddir""/Distribution"
"$installbuilddir""/dist/distribution.dist"
if ! [ -f "$installbuilddir""/dist/distribution.dist" ]; then
  echo "$phase";exit 1
fi

if ! [ -d "$installexpanddir""/""Resources" ]; then
  echo ""
  #echo "$phase";exit 1
fi
/bin/mkdir "$installbuilddir""/resources"
/usr/sbin/chown root:admin "$installbuilddir""/resources"
/bin/chmod 775 "$installbuilddir""/resources"

if ! [ -d "$installbuilddir""/resources" ]; then
  echo "$phase";exit 1
fi
/usr/bin/rsync -avzE "$installexpanddir""/""Resources"
"$installbuilddir""/resources"
if [ -d "$installexpanddir""/Plugins" ]; then
  if [ -a "$installbuilddir""/Plugins.zip" ]; then
    /bin/rm -Rf "$installbuilddir""/Plugins.zip"
  fi
  if [ -a "$installbuilddir""/Plugins.zip" ]; then
    echo "$phase";exit 1
  fi
  /usr/bin/ditto -c -k --rsrc --keepParent "$installexpanddir""/Plugins"
"$installbuilddir""/Plugins.zip"
  /usr/sbin/chown root:admin "$installbuilddir""/Plugins.zip"
  /bin/chmod 775 "$installbuilddir""/Plugins.zip"

  if ! [ -f "$installbuilddir""/Plugins.zip" ]; then
    echo "$phase";exit 1
  fi
  hasplugin=yes
else
  hasplugin=no
fi

phase="list packages"
/bin/ls -1 "$installexpanddir" | egrep -i '.*\.pkg$' >
"$installbuilddir""/packagelist.txt"
chmod 666 "$installbuilddir""/packagelist.txt"
for packagename in `/bin/cat "$installbuilddir""/packagelist.txt"`
do
    if [ -n "$packagename" ]; then
        acquirepackage
    fi
done
exit 0

> On Feb 18, 2025, at 3:00 PM, email@hidden wrote:
>
> Send Installer-dev mailing list submissions to
>       email@hidden
>
> To subscribe or unsubscribe via the World Wide Web, visit
>       https://lists.apple.com/mailman/listinfo/installer-dev
> or, via email, send a message with subject or body 'help' to
>       email@hidden
>
> You can reach the person managing the list at
>       email@hidden
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Installer-dev digest..."
> Today's Topics:
>
>   1. Question: Extracting PKG Image Assets? (Sinan Karaca)
>   2. Re: Question: Extracting PKG Image Assets? (Johan Landin)
>   3. Re: Question: Extracting PKG Image Assets? (Sinan Karaca)
>
> From: Sinan Karaca <email@hidden>
> Subject: Question: Extracting PKG Image Assets?
> Date: February 18, 2025 at 4:50:53 AM EST
> To: email@hidden
>
>
> Dear Developers,
>
> How would I extract the assets contained in the PKG user interface itself
> (the wizard screens - blue dots, green checkmarks, etc.)?
>
> Thanks,
> VB
>
>
>
> From: Johan Landin <email@hidden>
> Subject: Re: Question: Extracting PKG Image Assets?
> Date: February 18, 2025 at 6:31:22 AM EST
> To: Sinan Karaca <email@hidden>
> Cc: email@hidden
>
>
> I sugget that you use "Suspicious Package” which can be downloaded from
>
>  https://www.mothersruin.com/software/SuspiciousPackage/
>
> Best Regards
>      /Johan Landin
>
>
>> On 18 Feb 2025, at 10:50, Sinan Karaca via Installer-dev
>> <email@hidden> wrote:
>>
>> Dear Developers,
>>
>> How would I extract the assets contained in the PKG user interface itself
>> (the wizard screens - blue dots, green checkmarks, etc.)?
>>
>> Thanks,
>> VB
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Installer-dev mailing list      (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
>
>
>
>
> From: Sinan Karaca <email@hidden>
> Subject: Re: Question: Extracting PKG Image Assets?
> Date: February 18, 2025 at 7:13:01 AM EST
> To: Johan Landin <email@hidden>
> Cc: email@hidden
>
>
> The goal is not to look inside what’s contained within packages, but to
> extract the bitmaps/icons/dialogs used in the package installer itself (not
> the payload, but the package UI).
>
>> On Feb 18, 2025, at 14:31, Johan Landin <email@hidden> wrote:
>>
>> I sugget that you use "Suspicious Package” which can be downloaded from
>>
>> https://www.mothersruin.com/software/SuspiciousPackage/
>>
>> Best Regards
>>     /Johan Landin
>>
>>
>>> On 18 Feb 2025, at 10:50, Sinan Karaca via Installer-dev
>>> <email@hidden> wrote:
>>>
>>> Dear Developers,
>>>
>>> How would I extract the assets contained in the PKG user interface itself
>>> (the wizard screens - blue dots, green checkmarks, etc.)?
>>>
>>> Thanks,
>>> VB
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Installer-dev mailing list      (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>>
>
>
>
>
> _______________________________________________
> Installer-dev mailing list
> email@hidden
> https://lists.apple.com/mailman/listinfo/installer-dev

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Installer-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Question: Extracting PKG Image Assets?
  • Previous by thread: Re: Question: Extracting PKG Image Assets?
  • Index(es):
    • Date
    • Thread