mirror of
https://github.com/valitydev/osquery-1.git
synced 2024-11-07 01:55:20 +00:00
OS X package maker via relocating homebrew packages
This commit is contained in:
parent
cf6941fea4
commit
d214901d57
@ -44,3 +44,9 @@ function set_cc() {
|
||||
export CC=$1
|
||||
export CMAKE_C_COMPILER=$1
|
||||
}
|
||||
|
||||
function contains_element() {
|
||||
local e
|
||||
for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done
|
||||
return 1
|
||||
}
|
||||
|
46
tools/make_osx_package.sh
Executable file
46
tools/make_osx_package.sh
Executable file
@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
export PATH="$PATH:/usr/local/bin"
|
||||
|
||||
. $SCRIPT_DIR/lib.sh
|
||||
|
||||
BREW_PACKAGES=(rocksdb boost gflags glog thrift)
|
||||
BREW_PREFIX=`brew --prefix`
|
||||
BREW_CELLAR=`brew --cellar`
|
||||
|
||||
function main() {
|
||||
platform OS
|
||||
if [[ ! "$OS" = "darwin" ]]; then
|
||||
fatal "This script must be ran on OS X"
|
||||
fi
|
||||
|
||||
log "Calculating dependencies"
|
||||
dependency_list=("${BREW_PACKAGES[@]}")
|
||||
for package in ${BREW_PACKAGES[*]}; do
|
||||
for dep in `brew deps $package`; do
|
||||
if ! contains_element $dep "${dependency_list[@]}"; then
|
||||
dependency_list+=($dep)
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
log "Done calculating dependencies:"
|
||||
for dep in ${dependency_list[*]}; do
|
||||
dep_dir=`brew info $dep | grep Cellar | awk '{print $1}'`
|
||||
brew unlink $dep 2>&1 1>/dev/null
|
||||
links=`brew link --dry-run $dep`
|
||||
brew link --overwrite $dep 2>&1 1>/dev/null
|
||||
echo " - $dep ($dep_dir)"
|
||||
for link in $links; do
|
||||
if [[ $link = $BREW_PREFIX* ]]; then
|
||||
target="`dirname $link`/`ls -l $link | awk '{print $11}'`"
|
||||
echo " - $link => $target"
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
main
|
Loading…
Reference in New Issue
Block a user