Commit 01940fb4 authored by Arie Peterson's avatar Arie Peterson 🐚
Browse files

Add build script

parent 29ef11be
Loading
Loading
Loading
Loading

build.sh

0 → 100755
+30 −0
Original line number Diff line number Diff line
#!/bin/bash

set -e

# Directory where this script is located.
scriptDir=$(dirname -- "$(readlink -f -- "$BASH_SOURCE")") 
buildDir="${scriptDir}/build"

# Copy api server binary to initrd build dir.
cp "${scriptDir}/cryptops/bin/cryptops-api" "${buildDir}/bin/cryptops-api"

# Store api server version information.
versionInfoFile="${buildDir}/etc/cryptops-api/version.txt"
cd "${scriptDir}/cryptops"
git rev-parse --abbrev-ref HEAD > "${versionInfoFile}"
git log -1 >> "${versionInfoFile}"

# Copy api client script and associated binaries to initrd build dir.
cp "${scriptDir}/cryptops/cryptops-client/cryptops-client" "${buildDir}/usr/bin/cryptops-client"
cp "${scriptDir}/cryptops/cryptops-client/local/jq" "${buildDir}/usr/bin/jq"

# Store client version information.
versionInfoFile="${buildDir}/etc/cryptops-client/version.txt"
cd "${scriptDir}/cryptops/cryptops-client"
git rev-parse --abbrev-ref HEAD > "${versionInfoFile}"
git log -1 >> "${versionInfoFile}"

cd "${buildDir}"
find . | cpio -H newc -o | gzip -  > "${scriptDir}/ramdisk"
cd "${scriptDir}"