mirror of
https://github.com/wavetermdev/homebrew-cask.git
synced 2026-08-05 13:43:24 -07:00
Merge pull request #2782 from rolandwalker/pkg_bundles
devscript: support pkg bundles (pkg is a dir)
This commit is contained in:
@@ -17,7 +17,7 @@ shopt -s nocasematch # case-insensitive regular expressions
|
||||
|
||||
opt_lax=''
|
||||
opt_pkg=''
|
||||
tmpdir=''
|
||||
pkgdir=''
|
||||
|
||||
###
|
||||
### functions
|
||||
@@ -37,24 +37,24 @@ die () {
|
||||
}
|
||||
|
||||
app_source_1 () {
|
||||
/usr/bin/find "$tmpdir" -name PackageInfo -print0 | \
|
||||
/usr/bin/find "$pkgdir" -name PackageInfo -print0 | \
|
||||
/usr/bin/xargs -0 /usr/bin/perl -0777 -ne \
|
||||
'while (m{<pkg-info[^\n]*install-location="/Applications".*?path\s*=\s*"([^"]+)"}sg) { my $p = $1; $p =~ s{\A.*/}{}; print "$p\n" }';
|
||||
}
|
||||
|
||||
app_source_2 () {
|
||||
/usr/bin/find "$tmpdir" -name PackageInfo -print0 | \
|
||||
/usr/bin/find "$pkgdir" -name PackageInfo -print0 | \
|
||||
/usr/bin/xargs -0 /usr/bin/perl -0777 -ne \
|
||||
'while (m{<pkg-info[^\n]*install-location="/".*?path\s*=\s*"./Applications/([^"]+)"}sg) { my $p = $1; $p =~ s{\A.*/}{}; print "$p\n" }';
|
||||
}
|
||||
|
||||
app_source_3 () {
|
||||
/usr/bin/find "$tmpdir" -type d -name '*.app' | \
|
||||
/usr/bin/find "$pkgdir" -type d -name '*.app' | \
|
||||
perl -pe 's{\A.*/}{}';
|
||||
}
|
||||
|
||||
app_source_4 () {
|
||||
/usr/bin/find "$tmpdir" -name PackageInfo -print0 | \
|
||||
/usr/bin/find "$pkgdir" -name PackageInfo -print0 | \
|
||||
/usr/bin/xargs -0 /usr/bin/perl -0777 -ne \
|
||||
'while (m{path\s*=\s*"([^"]+\.app)"}sg) { my $p = $1; $p =~ s{\A.*/}{}; print "$p\n" }';
|
||||
}
|
||||
@@ -122,10 +122,14 @@ See CONTRIBUTING.md and 'man pkgutil' for more information.
|
||||
|
||||
_list_apps_in_pkg () {
|
||||
|
||||
tmpdir=`/usr/bin/mktemp -d -t list_apps_in_pkg`
|
||||
trap "/bin/rm -rf '$tmpdir'" EXIT
|
||||
|
||||
/usr/sbin/pkgutil --expand "$opt_pkg" "$tmpdir/unpack"
|
||||
if [[ -d "$opt_pkg" ]]; then
|
||||
pkgdir="$opt_pkg"
|
||||
else
|
||||
local tmpdir=`/usr/bin/mktemp -d -t list_ids_in_pkg`
|
||||
trap "/bin/rm -rf -- '$tmpdir'" EXIT
|
||||
pkgdir="$tmpdir/unpack"
|
||||
/usr/sbin/pkgutil --expand "$opt_pkg" "$tmpdir/unpack" "$pkgdir"
|
||||
fi
|
||||
|
||||
{
|
||||
# strings that look like App names (Something.app)
|
||||
|
||||
@@ -15,14 +15,14 @@ shopt -s nocasematch # case-insensitive regular expressions
|
||||
### global variables
|
||||
###
|
||||
|
||||
tmpdir=''
|
||||
pkgdir=''
|
||||
|
||||
###
|
||||
### functions
|
||||
###
|
||||
|
||||
bundle_id_source_1 () {
|
||||
/usr/bin/find "$tmpdir" -name PackageInfo -print0 | \
|
||||
/usr/bin/find "$pkgdir" -name PackageInfo -print0 | \
|
||||
/usr/bin/xargs -0 /usr/bin/perl -0777 -ne \
|
||||
'while (m{<pkg-info.*?\sid(?:entifier)?\s*=\s*"([^"]*?)"}sg) { print "$1\n" }'
|
||||
}
|
||||
@@ -48,10 +48,14 @@ mark_up_sources () {
|
||||
|
||||
_list_ids_in_pkg () {
|
||||
|
||||
tmpdir=`/usr/bin/mktemp -d -t list_ids_in_pkg`
|
||||
trap "/bin/rm -rf -- '$tmpdir'" EXIT
|
||||
|
||||
/usr/sbin/pkgutil --expand "$1" "$tmpdir/unpack"
|
||||
if [[ -d "$1" ]]; then
|
||||
pkgdir="$1"
|
||||
else
|
||||
local tmpdir=`/usr/bin/mktemp -d -t list_ids_in_pkg`
|
||||
trap "/bin/rm -rf -- '$tmpdir'" EXIT
|
||||
pkgdir="$tmpdir/unpack"
|
||||
/usr/sbin/pkgutil --expand "$1" "$tmpdir/unpack" "$pkgdir"
|
||||
fi
|
||||
|
||||
{
|
||||
# emit strings that look like bundle ids
|
||||
|
||||
Reference in New Issue
Block a user