2023-07-02 22:59:50 -04:00
|
|
|
#!/bin/bash
|
|
|
|
ARCH=$1
|
|
|
|
CARGO_ARCH=$2
|
2024-07-14 18:22:50 -04:00
|
|
|
IS_NIGHTLY=$3
|
|
|
|
BUILD_DATE=$(date '+%Y%m%d')
|
2023-07-02 22:59:50 -04:00
|
|
|
CARGO_VERSION="$(/veilid/package/cargo_version.sh /veilid/veilid-server/Cargo.toml)"
|
|
|
|
|
|
|
|
# veilid-server spec file
|
|
|
|
cp -rf /veilid/package/rpm/veilid-server/veilid-server.spec /root/rpmbuild/SPECS/
|
2024-07-14 18:22:50 -04:00
|
|
|
# Select CARGO_VERSION for STABLE releases or BUILD_DATE for NIGHTLY releases
|
2024-07-14 20:15:09 -04:00
|
|
|
if [ "$3" = "true" ]
|
2024-07-14 18:22:50 -04:00
|
|
|
then
|
|
|
|
/veilid/package/replace_variable.sh /root/rpmbuild/SPECS/veilid-server.spec RELEASE_VERSION $BUILD_DATE
|
2024-07-14 20:15:09 -04:00
|
|
|
elif [ "$3" = "false" ]
|
2024-07-14 23:35:07 -04:00
|
|
|
then
|
2024-07-14 18:22:50 -04:00
|
|
|
/veilid/package/replace_variable.sh /root/rpmbuild/SPECS/veilid-server.spec RELEASE_VERSION $CARGO_VERSION
|
|
|
|
else
|
|
|
|
echo $3 "is not a valid state to determine if the build is STABLE or NIGHTLY"
|
|
|
|
fi
|
2023-07-02 22:59:50 -04:00
|
|
|
/veilid/package/replace_variable.sh /root/rpmbuild/SPECS/veilid-server.spec ARCH $ARCH
|
|
|
|
/veilid/package/replace_variable.sh /root/rpmbuild/SPECS/veilid-server.spec CARGO_ARCH $CARGO_ARCH
|
|
|
|
|
|
|
|
# build the rpm
|
2023-09-15 16:31:28 -04:00
|
|
|
rpmbuild --target "$ARCH" -bb /root/rpmbuild/SPECS/veilid-server.spec
|