Skip to content

Commit

Permalink
Update release scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
aveenismail committed Aug 10, 2023
1 parent 8629c07 commit eed5212
Show file tree
Hide file tree
Showing 5 changed files with 195 additions and 56 deletions.
60 changes: 56 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 54 additions & 19 deletions resources/release/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,32 @@ Vagrant.configure("2") do |config|
v.cpus = 2
end

config.vm.define "fedora33" do |fedora33|
fedora33.vm.box = "generic/fedora33"
fedora33.vm.synced_folder "../..", "/shared", type: "rsync",
config.vm.define "fedora35" do |fedora35|
fedora35.vm.box = "generic/fedora35"
fedora35.vm.synced_folder "../..", "/shared", type: "rsync",
rsync__args: ["--verbose", "--archive", "-z", "--delete"]
fedora33.vm.provision "shell", :path => "build-rpm.sh", :args => "fedora33", :privileged => false
fedora35.vm.provision "shell", :path => "build-rpm.sh", :args => "fedora35", :privileged => false
end

config.vm.define "fedora34" do |fedora34|
fedora34.vm.box = "messyzone/fedora34"
fedora34.vm.synced_folder "../..", "/shared", type: "rsync",
config.vm.define "fedora36" do |fedora36|
fedora36.vm.box = "generic/fedora36"
fedora36.vm.synced_folder "../..", "/shared", type: "rsync",
rsync__args: ["--verbose", "--archive", "-z", "--delete"]
fedora34.vm.provision "shell", :path => "build-rpm.sh", :args => "fedora34", :privileged => false
fedora36.vm.provision "shell", :path => "build-rpm.sh", :args => "fedora36", :privileged => false
end

config.vm.define "fedora37" do |fedora37|
fedora37.vm.box = "generic/fedora37"
fedora37.vm.synced_folder "../..", "/shared", type: "rsync",
rsync__args: ["--verbose", "--archive", "-z", "--delete"]
fedora37.vm.provision "shell", :path => "build-rpm.sh", :args => "fedora37", :privileged => false
end

config.vm.define "fedora38" do |fedora38|
fedora38.vm.box = "fedora/38-cloud-base"
fedora38.vm.synced_folder "../..", "/shared", type: "rsync",
rsync__args: ["--verbose", "--archive", "-z", "--delete"]
fedora38.vm.provision "shell", :path => "build-rpm.sh", :args => "fedora38", :privileged => false
end

config.vm.define "centos7" do |centos7|
Expand All @@ -29,12 +43,12 @@ Vagrant.configure("2") do |config|
centos7.vm.provision "shell", :path => "build-rpm.sh", :args => "centos7", :privileged => false
end

config.vm.define "centos8" do |centos8|
centos8.vm.box = "zyz/centos8"
centos8.vm.synced_folder "../..", "/shared", type: "rsync",
rsync__args: ["--verbose", "--archive", "-z", "--copy-links"]
centos8.vm.provision "shell", :path => "build-rpm.sh", :args => "centos8", :privileged => false
end
# config.vm.define "centos8" do |centos8|
# centos8.vm.box = "zyz/centos8"
# centos8.vm.synced_folder "../..", "/shared", type: "rsync",
# rsync__args: ["--verbose", "--archive", "-z", "--copy-links"]
# centos8.vm.provision "shell", :path => "build-rpm.sh", :args => "centos8", :privileged => false
# end

config.vm.define "debian9" do |debian9|
debian9.vm.box = "roboxes/debian9"
Expand All @@ -50,7 +64,7 @@ Vagrant.configure("2") do |config|
end

config.vm.define "debian11" do |debian11|
debian11.vm.box = "axcxl/debian11_xfce"
debian11.vm.box = "debian/bullseye64"
debian11.vm.synced_folder "../..", "/shared", type: "rsync",
rsync__args: ["--verbose", "--archive", "-z", "--delete"]
debian11.vm.provision "shell", :path => "build-pkg.sh", :args => "debian11", :privileged => false
Expand Down Expand Up @@ -82,11 +96,32 @@ Vagrant.configure("2") do |config|
focal.vm.provision "shell", :path => "build-pkg.sh", :args => "ubuntu2004", :privileged => false
end

config.vm.define "hirsute" do |hirsute|
hirsute.vm.box = "ubuntu/hirsute64"
hirsute.vm.synced_folder "../..", "/shared", type: "rsync",
config.vm.define "impish" do |impish|
impish.vm.box = "ubuntu/impish64"
impish.vm.synced_folder "../..", "/shared", type: "rsync",
rsync__args: ["--verbose", "--archive", "-z", "--copy-links"]
impish.vm.provision "shell", :path => "build-pkg.sh", :args => "ubuntu2110", :privileged => false
end

config.vm.define "jammy" do |jammy|
jammy.vm.box = "alvistack/ubuntu-22.04"
jammy.vm.synced_folder "../..", "/shared", type: "rsync",
rsync__args: ["--verbose", "--archive", "-z", "--copy-links"]
jammy.vm.provision "shell", :path => "build-pkg.sh", :args => "ubuntu2204", :privileged => false
end

config.vm.define "kinetic" do |kinetic|
kinetic.vm.box = "ubuntu/kinetic64"
kinetic.vm.synced_folder "../..", "/shared", type: "rsync",
rsync__args: ["--verbose", "--archive", "-z", "--copy-links"]
kinetic.vm.provision "shell", :path => "build-pkg.sh", :args => "ubuntu2210", :privileged => false
end

config.vm.define "lunar" do |lunar|
lunar.vm.box = "ubuntu/lunar64"
lunar.vm.synced_folder "../..", "/shared", type: "rsync",
rsync__args: ["--verbose", "--archive", "-z", "--copy-links"]
hirsute.vm.provision "shell", :path => "build-pkg.sh", :args => "ubuntu2104", :privileged => false
lunar.vm.provision "shell", :path => "build-pkg.sh", :args => "ubuntu2304", :privileged => false
end

end
2 changes: 1 addition & 1 deletion resources/release/build-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e -o pipefail -x

for machine in focal hirsute debian10 fedora33 fedora34 centos7 centos8; do
for machine in focal impish jammy debian10 debian11 fedora35 fedora36 centos7; do
vagrant box update $machine
time vagrant up $machine
vagrant rsync-back $machine
Expand Down
63 changes: 51 additions & 12 deletions resources/release/build-pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,28 @@ set -x

PLATFORM=$1

YUBIHSMSDK_VERSION="2021-08" # To download the latest released version of yubihsm-shell
YUBIHSMSDK_VERSION="2022-06" # To download the latest released version of yubihsm-shell
export DEBIAN_FRONTEND=noninteractive

sudo apt-get update && sudo apt-get dist-upgrade -y
sudo apt-get install -y build-essential git
#sudo apt-get install -y build-essential git cmake pkg-config libedit-dev libssl-dev libcurl4-openssl-dev libpcsclite-dev libusb-1.0-0-dev
sudo apt-get install -y build-essential \
chrpath \
git \
cmake \
pkg-config \
gengetopt \
help2man \
libedit-dev \
libcurl4-openssl-dev \
liblzma-dev \
libssl-dev \
libseccomp-dev \
libusb-1.0.0-dev \
dh-exec \
git-buildpackage \
curl \
libpcsclite-dev

export PATH=$PATH:~/.cargo/bin
if [[ ! -x $(command -v rustc) ]]; then
Expand All @@ -28,14 +45,34 @@ mkdir -p "${OUTPUT}"

pushd "/tmp" &>/dev/null
# install yubihsm-shell
mkdir yubihsm2-sdk
pushd "yubihsm2-sdk" &>/dev/null
curl -L --max-redirs 2 -o - https://developers.yubico.com/YubiHSM2/Releases/yubihsm2-sdk-$YUBIHSMSDK_VERSION-$PLATFORM-amd64.tar.gz |\
tar -xzvf -
pushd "yubihsm2-sdk" &>/dev/null
sudo dpkg -i ./libyubihsm*_amd64.deb
popd &>/dev/null
popd &>/dev/null
# mkdir yubihsm2-sdk
# pushd "yubihsm2-sdk" &>/dev/null
# curl -L --max-redirs 2 -o - https://developers.yubico.com/YubiHSM2/Releases/yubihsm2-sdk-$YUBIHSMSDK_VERSION-$PLATFORM-amd64.tar.gz |\
# tar -xzvf -
# pushd "yubihsm2-sdk" &>/dev/null
# sudo dpkg -i ./libyubihsm*_amd64.deb
# popd &>/dev/null
# popd &>/dev/null

#git clone https://github.com/Yubico/yubihsm-shell.git
#cp -r /shared/resources/yubihsm-shell .
#pushd "yubihsm-shell" &>/dev/null
# mkdir build
# pushd "build" &>/dev/null
# cmake .. -DBUILD_ONLY_LIB=ON
# make
# popd
# if [ "${PLATFORM:0:6}" == "debian" ] || [ "$PLATFORM" == "ubuntu1804" ]; then
# dpkg-buildpackage -b --no-sign
# else
# dpkg-buildpackage
# fi
#popd
#cp libyubihsm1*.deb "${OUTPUT}"
#cp libyubihsm-usb1*.deb "${OUTPUT}"
#cp libyubihsm-http1*.deb "${OUTPUT}"

sudo dpkg -i $INPUT/resources/release/libyubihsm*_amd64.deb

# install yubihsmrs
rm -rf yubihsmrs
Expand All @@ -45,8 +82,10 @@ pushd "/tmp" &>/dev/null
rm -rf yubihsm-setup
git clone "$INPUT" yubihsm-setup
pushd "yubihsm-setup" &>/dev/null
YUBIHSM_LIB_DIR=$(dpkg -L libyubihsm1 | grep -e "libyubihsm.so.2$" | xargs dirname) \
cargo build --release
#YUBIHSM_LIB_DIR=$(dpkg -L libyubihsm1 | grep -e "libyubihsm.so.2$" | xargs dirname) \
# cargo build --release
#YUBIHSM_LIB_DIR=/tmp/yubihsm-shell/build/lib cargo build --release
YUBIHSM_LIB_DIR=/usr/lib/x86_64-linux-gnu cargo build --release
strip --strip-all target/release/yubihsm-setup
cargo deb --no-build
cp target/debian/*.deb "${OUTPUT}"
Expand Down
53 changes: 33 additions & 20 deletions resources/release/build-rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e -o pipefail
set -x

PLATFORM=$1
LIBYUBIHSM_VERSION="2.2.0" # To download the latest released version of yubihsm-shell
LIBYUBIHSM_VERSION="2.4.0" # To download the latest released version of yubihsm-shell

if [ "$PLATFORM" == "centos7" ]; then
sudo yum -y install centos-release-scl
Expand Down Expand Up @@ -37,12 +37,13 @@ elif [ "$PLATFORM" == "centos8" ]; then
elif [ "${PLATFORM:0:6}" == "fedora" ]; then
sudo dnf -y update
sudo dnf -y install binutils \
git \
cmake \
openssl-devel \
libusb-devel \
libcurl-devel \
rpmdevtools
git \
cmake \
openssl-devel \
libusb1-devel \
libcurl-devel \
rpmdevtools \
pcsc-lite-devel

export CMAKE="cmake"
fi
Expand All @@ -61,16 +62,24 @@ mkdir -p $OUTPUT

pushd "/tmp" &>/dev/null
# build yubihsm-shell from source
rm -rf yubihsm-shell-$LIBYUBIHSM_VERSION
curl -L --max-redirs 2 -o - https://developers.yubico.com/yubihsm-shell/Releases/yubihsm-shell-$LIBYUBIHSM_VERSION.tar.gz |\
tar -xzvf -
pushd "yubihsm-shell-$LIBYUBIHSM_VERSION" &>/dev/null
mkdir build
pushd "build" &>/dev/null
$CMAKE .. -DBUILD_ONLY_LIB=ON
make
popd &>/dev/null
popd &>/dev/null
#rm -rf yubihsm-shell-$LIBYUBIHSM_VERSION
#curl -L --max-redirs 2 -o - https://developers.yubico.com/yubihsm-shell/Releases/yubihsm-shell-$LIBYUBIHSM_VERSION.tar.gz |\
# tar -xzvf -

#git clone https://github.com/Yubico/yubihsm-shell.git
#cp -r /shared/resources/yubihsm-shell .
#pushd "yubihsm-shell-$LIBYUBIHSM_VERSION" &>/dev/null
#pushd "yubihsm-shell" &>/dev/null
# mkdir build
# pushd "build" &>/dev/null
# $CMAKE .. -DBUILD_ONLY_LIB=ON
# make
# popd &>/dev/null
#popd &>/dev/null

sudo dnf -y install yubihsm-shell-2.4.1-1.fc38.x86_64.rpm
sudo dnf -y install yubihsm-devel-2.4.1-1.fc38.x86_64.rpm


# install yubihsmrs
rm -rf yubihsmrs
Expand All @@ -82,8 +91,12 @@ pushd "/tmp" &>/dev/null
pushd "yubihsm-setup" &>/dev/null
cargo install cargo-rpm
cargo rpm init
YUBIHSM_LIB_DIR=/tmp/yubihsm-shell-$LIBYUBIHSM_VERSION/build/lib cargo build --release
YUBIHSM_LIB_DIR=/tmp/yubihsm-shell-$LIBYUBIHSM_VERSION/build/lib cargo rpm build
#YUBIHSM_LIB_DIR=/tmp/yubihsm-shell-$LIBYUBIHSM_VERSION/build/lib cargo build --release
#YUBIHSM_LIB_DIR=/tmp/yubihsm-shell-$LIBYUBIHSM_VERSION/build/lib cargo rpm build
#YUBIHSM_LIB_DIR=/tmp/yubihsm-shell/build/lib cargo build --release
#YUBIHSM_LIB_DIR=/tmp/yubihsm-shell/build/lib cargo rpm build
cargo build --release
cargo rpm build
cp target/release/rpmbuild/RPMS/x86_64/*.rpm $OUTPUT
popd &>/dev/null
popd &>/dev/null
Expand All @@ -103,4 +116,4 @@ pushd "/shared" &>/dev/null
rm -rf licenses
rm -rf ../yubihsm-setup
popd &>/dev/null
popd &>/dev/null
popd &>/dev/null

0 comments on commit eed5212

Please sign in to comment.