Jeff Mahoney
abc6b0bb16
* SUSE: Add SSHLogin artifacts * Add a Kafka export plugin * SUSE: Do build tests on every pull request * Add systemd-dev as build dependency for github workflow - Update to version 0.6.3~git13.af7fdb00: * SUSE: Add SSHLogin artifacts * Add a Kafka export plugin * SUSE: Do build tests on every pull request * Add systemd-dev as build dependency for github workflow OBS-URL: https://build.opensuse.org/package/show/security:sensor/velociraptor?expand=0&rev=10
53 lines
1.1 KiB
Bash
53 lines
1.1 KiB
Bash
#!/bin/bash
|
|
|
|
cleanup() {
|
|
test -n "$dir" && rm -rf "$dir"
|
|
}
|
|
|
|
error() {
|
|
echo "An error occurred. Exiting." >&2
|
|
}
|
|
|
|
trap error ERR SIGINT
|
|
trap cleanup EXIT
|
|
set -e
|
|
|
|
version=$(rpmspec -q --queryformat="%{VERSION}" velociraptor.spec)
|
|
|
|
dir="$(realpath "$(mktemp -d vendoring.XXXXXX)")"
|
|
|
|
rpmspec -P velociraptor.spec --define "_sourcedir $PWD" | \
|
|
awk '
|
|
BEGIN { go=0; };
|
|
/^%build/ { go=0; };
|
|
{ if (go) print };
|
|
/^%setup/ { go=1 }' > $dir/setup.sh
|
|
|
|
echo "Expanding archive..."
|
|
cpio -D "$dir" -id < velociraptor-${version}.obscpio
|
|
|
|
echo "Running %prep"
|
|
cd "$dir/velociraptor-${version}"
|
|
sh ../setup.sh
|
|
|
|
echo "Re-vendoring Go code..."
|
|
rm -rf vendor
|
|
go mod vendor
|
|
tar Jcf ../vendor-golang-${version}.tar.xz vendor
|
|
|
|
echo "Re-vendoring nodejs code..."
|
|
cd gui/velociraptor
|
|
rm -rf node_modules
|
|
npm install
|
|
cd ../..
|
|
tar Jcf ../vendor-nodejs-${version}.tar.xz gui/velociraptor/node_modules
|
|
|
|
cd ..
|
|
mv vendor-golang-${version}.tar.xz vendor-nodejs-${version}.tar.xz ..
|
|
|
|
for spec in ../*.spec; do
|
|
sed -i "s/^%define vendor_version.*/%define vendor_version %{version}/" ${spec}
|
|
done
|
|
|
|
echo "Done"
|