osquery-1/tools/sync.sh
Jesse Kornblum c7355b19aa Update osquery licensing wording (#5452)
Summary:
Pull Request resolved: https://github.com/facebook/osquery/pull/5452

As suggested in another diff, this diff updates the language we use to describe the osquery licensing terms. We are changing all instances of

//This source code is licensed as defined on the LICENSE file found in the root directory of this source tree.//

to

//This source code is licensed in accordance with the terms specified in the LICENSE file found in the root directory of this source tree.//

We accomplish this with a codemod:

  $ codemod -md xplat/osquery/oss --extensions cpp,h,in,py,sh,mm,ps1 "(.\s+)This source code is licensed as defined on the LICENSE file found in the(.*)root directory of this source tree\." "\1This source code is licensed in accordance with the terms specified in\2the LICENSE file found in the root directory of this source tree."

Reviewed By: fmanco

Differential Revision: D14131290

fbshipit-source-id: 52c90da342263e2a80f5a678ecd760c19cf7513e
2019-02-19 10:59:48 -08:00

55 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# Copyright (c) 2014-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed in accordance with the terms specified in
# the LICENSE file found in the root directory of this source tree.
set -e
if [ "$#" -ne 2 ]; then
echo "Usage: $0 BUILD_DIR LIBRARY_PATH"
exit 1
fi
SOURCE=$(pwd)
BUILD_DIR=$1
SYNC_DIR="$BUILD_DIR/sync"
VERSION=`git describe --tags HEAD --always`
if [ -f "$BUILD_DIR/generated" ]; then
echo "Error: $BUILD_DIR/generated not found."
echo "Run 'make sdk' first"
exit 1
fi
mkdir -p "$SYNC_DIR"
rm -rf "$SYNC_DIR/osquery*"
mkdir -p "$SYNC_DIR/osquery/generated"
export LIBRARY_PATH=$2:$LIBRARY_PATH
# merge the headers with the implementation files
cp -R include/osquery "$SYNC_DIR"
find ./osquery | grep "\.h" | grep -v tests/ | grep -v tables/ | xargs -i cp --parents {} "$SYNC_DIR"
cp $BUILD_DIR/generated/utils_amalgamation.cpp "$SYNC_DIR/osquery/generated/"
# delete all of the old CMake files
find "$SYNC_DIR" -type f -name "CMakeLists.txt" -exec rm -f {} \;
# make the targets file
mkdir -p "$SYNC_DIR/code-analysis"
(cd "$SYNC_DIR/code-analysis" && SDK=True cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON $SOURCE)
python tools/codegen/gentargets.py \
-v $VERSION --sdk $VERSION \
-i "$SYNC_DIR/code-analysis/compile_commands.json" \
-o $SYNC_DIR/osquery \
-s osquery
cp osquery.thrift "$SYNC_DIR/osquery/extensions"
# wrap it up in a tarball
(cd "$SYNC_DIR" && tar -zcf osquery-sync-$VERSION.tar.gz osquery)
echo "Generated $SYNC_DIR/osquery-sync-$VERSION.tar.gz"