Skip to content

Commit fdd7090

Browse files
authoredAug 15, 2024··
Update release workflows (#15)
Update release workflows on Githubactions
1 parent 8629c07 commit fdd7090

File tree

7 files changed

+522
-168
lines changed

7 files changed

+522
-168
lines changed
 

‎.github/workflows/release_linux.yml

+187-87
Original file line numberDiff line numberDiff line change
@@ -4,134 +4,234 @@ on: [push]
44

55
jobs:
66

7-
Ubuntu1804-Build:
8-
name: Ubuntu1804
9-
runs-on: ubuntu-18.04
10-
env:
11-
YUBIHSMSDK_VERSION: 2021-08
7+
debian_based:
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
environment: [
12+
"ubuntu:24.04",
13+
"ubuntu:22.04",
14+
"ubuntu:20.04",
15+
"debian:12",
16+
"debian:11",
17+
]
18+
libyubihsm_tag : [ "2.5.0" ]
19+
20+
name: build on ${{ matrix.environment }}
21+
runs-on: ubuntu-latest
22+
container: ${{ matrix.environment }}
1223

1324
steps:
14-
- name: Checkout repository
15-
uses: actions/checkout@v2
1625

17-
# download yubihsm-sdk installer from dev.y.c and install it
18-
- name: install yubihsm-shell
26+
- name: clone the Yubico/yubihsm-setup repository
27+
uses: actions/checkout@v3
28+
with:
29+
path: yubihsm-setup
30+
31+
- name: extract platform name
32+
env:
33+
DOCKER_IMAGE: ${{ matrix.environment }}
34+
run: |
35+
# Remove everything from DOCKER_IMAGE that is not a letter or a number
36+
PLATFORM=$(echo -n "$DOCKER_IMAGE" | sed -E 's/[^a-zA-Z0-9]//g')
37+
echo "PLATFORM=$PLATFORM" >> $GITHUB_ENV
38+
39+
- name: install dependencies
40+
env:
41+
CC: ${{ matrix.cc }}
42+
DEBIAN_FRONTEND: noninteractive
1943
run: |
20-
set -e -o pipefail
2144
set -x
45+
export DEBIAN_FRONTEND=noninteractive
46+
47+
apt-get update && apt-get dist-upgrade -y
48+
apt-get install -y build-essential \
49+
chrpath \
50+
cmake \
51+
pkg-config \
52+
gengetopt \
53+
help2man \
54+
libedit-dev \
55+
libcurl4-openssl-dev \
56+
liblzma-dev \
57+
libssl-dev \
58+
libseccomp-dev \
59+
libusb-1.0.0-dev \
60+
dh-exec \
61+
git-buildpackage \
62+
curl \
63+
libpcsclite-dev \
64+
file \
65+
curl \
66+
jq
67+
68+
curl -o rustup.sh https://sh.rustup.rs
69+
bash ./rustup.sh -y
70+
export PATH=$PATH:$HOME/.cargo/bin
71+
cargo install cargo-deb
72+
2273
74+
- name: install libyubihsm
75+
working-directory: yubihsm-setup
76+
env:
77+
LIBYUBIHSM_TAG: ${{ matrix.libyubihsm_tag }}
78+
PLATFORM: ${{ env.PLATFORM }}
79+
run: |
80+
set -x
81+
82+
echo "platform = $PLATFORM"
83+
2384
cd ..
24-
curl -L --max-redirs 2 -o - https://developers.yubico.com/YubiHSM2/Releases/yubihsm2-sdk-$YUBIHSMSDK_VERSION-ubuntu1804-amd64.tar.gz |\
25-
tar -xzvf -
26-
cd yubihsm2-sdk
27-
sudo dpkg -i ./libyubihsm*_amd64.deb
85+
86+
#git clone --branch $LIBYUBIHSM_TAG https://github.com/Yubico/yubihsm-shell.git
87+
git clone https://github.com/Yubico/yubihsm-shell.git
88+
cd yubihsm-shell
89+
90+
if [ "$PLATFORM" = "ubuntu2404" ]; then
91+
# ubuntu 24.04 comes with _FORTIFY_SOURCE already set
92+
sed -i 's/add_definitions (-D_FORTIFY_SOURCE=2)/add_definitions (-D_FORTIFY_SOURCE=3)/' cmake/SecurityFlags.cmake
93+
fi
94+
95+
if [ "$PLATFORM" = "debian11" ]; then
96+
dpkg-buildpackage -b --no-sign
97+
else
98+
dpkg-buildpackage
99+
fi
100+
dpkg -i ../libyubihsm*_amd64.deb
28101
29102
- name: clone yubihsmrs
103+
working-directory: yubihsm-setup
30104
run: |
31-
set -e -o pipefail
32105
set -x
33-
34106
cd ..
35107
git clone https://github.com/Yubico/yubihsmrs.git
36108
37-
- name: Build yubihsm-setup
109+
- name: Build binary
110+
working-directory: yubihsm-setup
111+
env:
112+
PLATFORM: ${{ env.PLATFORM }}
38113
run: |
39-
set -e -o pipefail
40114
set -x
41-
mkdir -p artifact/yubihsm-setup
42-
43-
cd ..
44-
export PATH=$PATH:~/.cargo/bin
45-
if [[ ! -x $(command -v rustc) ]]; then
46-
curl -o rustup.sh https://sh.rustup.rs
47-
bash ./rustup.sh -y
48-
fi
49-
cargo install cargo-deb
115+
OUTPUT=$GITHUB_WORKSPACE/$PLATFORM/yubihsm-setup
116+
mkdir -p $OUTPUT
50117
51-
cd yubihsm-setup
52-
YUBIHSM_LIB_DIR=$(dpkg -L libyubihsm1 | grep -e "libyubihsm.so.2$" | xargs dirname) cargo build --release
118+
export PATH=$PATH:$HOME/.cargo/bin
119+
120+
#YUBIHSM_LIB_DIR=$(dpkg -L libyubihsm1 | grep -e "libyubihsm.so.2$" | xargs dirname) cargo build --release
121+
YUBIHSM_LIB_DIR=/usr/lib/x86_64-linux-gnu cargo build --release
53122
strip --strip-all target/release/yubihsm-setup
54123
cargo deb --no-build
55-
cp target/debian/*.deb artifact/yubihsm-setup/
124+
cp target/debian/*.deb $OUTPUT/
56125
57126
./target/release/yubihsm-setup --version
58127
./target/release/yubihsm-setup --help
59128
60-
LICENSE_DIR="artifact/yubihsm-setup/share/yubihsm-setup"
61-
mkdir -p $LICENSE_DIR
62-
cp -r resources/release/licenses $LICENSE_DIR/
63-
for lf in $LICENSE_DIR/licenses/*; do
129+
LICESE_DIR="$OUTPUT/share/yubihsm-setup"
130+
mkdir -p $LICESE_DIR
131+
cp -r $GITHUB_WORKSPACE/yubihsm-setup/resources/release/licenses $LICESE_DIR/
132+
for lf in $LICESE_DIR/licenses/*; do
64133
chmod 644 $lf
65134
done
66135
67-
- name: Upload artifact
68-
uses: actions/upload-artifact@v1
69-
with:
70-
name: yubihsm-setup-ubuntu1804-amd64
71-
path: artifact
136+
cd $OUTPUT
137+
rm -f yubihsm-setup-$PLATFORM-amd64.tar.gz
138+
tar -C .. -zcvf ../yubihsm-setup-$PLATFORM-amd64.tar.gz yubihsm-setup
139+
rm -f *.deb
140+
rm -rf licenses
141+
rm -rf ../yubihsm-setup
142+
72143
73-
Ubuntu2004-Build:
74-
name: Ubuntu2004
75-
runs-on: ubuntu-20.04
76-
env:
77-
YUBIHSMSDK_VERSION: 2021-08
144+
- name: upload artifacts
145+
uses: actions/upload-artifact@v3
146+
with:
147+
name: "yubihsm-setup-${{ env.PLATFORM }}-amd64"
148+
path: ${{ env.PLATFORM }}
149+
150+
redhat_based:
151+
strategy:
152+
fail-fast: false
153+
matrix:
154+
environment: [
155+
"fedora:39",
156+
"fedora:40",
157+
]
158+
159+
name: build on ${{ matrix.environment }}
160+
runs-on: ubuntu-latest
161+
container: ${{ matrix.environment }}
78162

79163
steps:
80-
- name: Checkout repository
81-
uses: actions/checkout@v2
82164

83-
# download yubihsm-sdk installer from dev.y.c and install it
84-
- name: install yubihsm-shell
85-
run: |
86-
set -e -o pipefail
87-
set -x
165+
- name: clone the Yubico/yubihsm-setup repository
166+
uses: actions/checkout@v3
167+
with:
168+
path: yubihsm-setup
88169

89-
cd ..
90-
curl -L --max-redirs 2 -o - https://developers.yubico.com/YubiHSM2/Releases/yubihsm2-sdk-$YUBIHSMSDK_VERSION-ubuntu2004-amd64.tar.gz |\
91-
tar -xzvf -
92-
cd yubihsm2-sdk
93-
sudo dpkg -i ./libyubihsm*_amd64.deb
170+
- name: extract platform name
171+
env:
172+
DOCKER_IMAGE: ${{ matrix.environment }}
173+
run: |
174+
# Remove everything from DOCKER_IMAGE that is not a letter or a number
175+
PLATFORM=$(echo -n "$DOCKER_IMAGE" | sed -E 's/[^a-zA-Z0-9]//g')
176+
echo "PLATFORM=$PLATFORM" >> $GITHUB_ENV
94177
95-
- name: clone yubihsmrs
178+
- name: install dependencies
179+
env:
180+
PLATFORM: ${{ env.PLATFORM }}
96181
run: |
97-
set -e -o pipefail
98-
set -x
182+
dnf -y update
183+
dnf -y install binutils \
184+
gcc \
185+
gcc-c++ \
186+
git \
187+
chrpath \
188+
cmake \
189+
openssl-devel \
190+
libedit-devel \
191+
libcurl-devel \
192+
rpmdevtools \
193+
pcsc-lite-devel \
194+
libusb1-devel \
195+
196+
curl -o rustup.sh https://sh.rustup.rs
197+
bash ./rustup.sh -y
99198
100-
cd ..
101-
git clone https://github.com/Yubico/yubihsmrs.git
199+
- name: install libyubihsm
200+
run: |
201+
git clone https://github.com/Yubico/yubihsm-shell.git
202+
cd yubihsm-shell
203+
mkdir build
204+
cd build
205+
cmake .. -DBUILD_ONLY_LIB=ON
206+
make
102207
103-
- name: Build yubihsm-setup
208+
- name: clone yubihsmrs
104209
run: |
105-
set -e -o pipefail
106-
set -x
107-
mkdir -p artifact/yubihsm-setup
210+
git clone https://github.com/Yubico/yubihsmrs.git
108211
109-
cd ..
212+
- name: build release binary
213+
working-directory: yubihsm-setup
214+
env:
215+
PLATFORM: ${{ env.PLATFORM }}
216+
run: |
217+
110218
export PATH=$PATH:~/.cargo/bin
111219
if [[ ! -x $(command -v rustc) ]]; then
112220
curl -o rustup.sh https://sh.rustup.rs
113221
bash ./rustup.sh -y
114222
fi
115-
cargo install cargo-deb
116-
117-
cd yubihsm-setup
118-
YUBIHSM_LIB_DIR=$(dpkg -L libyubihsm1 | grep -e "libyubihsm.so.2$" | xargs dirname) cargo build --release
119-
strip --strip-all target/release/yubihsm-setup
120-
cargo deb --no-build
121-
cp target/debian/*.deb artifact/yubihsm-setup/
122-
123-
./target/release/yubihsm-setup --version
124-
./target/release/yubihsm-setup --help
125223
126-
LICENSE_DIR="artifact/yubihsm-setup/share/yubihsm-setup"
127-
mkdir -p $LICENSE_DIR
128-
cp -r resources/release/licenses $LICENSE_DIR/
129-
for lf in $LICENSE_DIR/licenses/*; do
130-
chmod 644 $lf
131-
done
132-
133-
- name: Upload artifact
134-
uses: actions/upload-artifact@v1
224+
OUTPUT=$GITHUB_WORKSPACE/$PLATFORM/yubihsm-setup
225+
mkdir -p $OUTPUT
226+
227+
cargo install cargo-rpm
228+
cargo rpm init
229+
YUBIHSM_LIB_DIR=$GITHUB_WORKSPACE/yubihsm-shell/build/lib cargo build --release
230+
YUBIHSM_LIB_DIR=$GITHUB_WORKSPACE/yubihsm-shell-$LIBYUBIHSM_VERSION/build/lib cargo rpm build
231+
cp target/release/rpmbuild/RPMS/x86_64/*.rpm $OUTPUT/
232+
233+
- name: upload artifacts
234+
uses: actions/upload-artifact@v3
135235
with:
136-
name: yubihsm-setup-ubuntu2004-amd64
137-
path: artifact
236+
name: "yubihsm-setup-${{ env.PLATFORM }}-amd64"
237+
path: ${{ env.PLATFORM }}

‎.github/workflows/release_macos.yml

+32-24
Original file line numberDiff line numberDiff line change
@@ -5,58 +5,66 @@ on: [push]
55
jobs:
66
MacOS-Build:
77

8-
runs-on: macos-10.15
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
include:
13+
- os: macos-latest
14+
arch: amd
15+
- os: macos-latest-xlarge
16+
arch: arm
917
env:
18+
VERSION: 2.6.0
19+
SO_VERSION: 2
1020
YUBIHSMSDK_VERSION: 2021-08
1121

1222
steps:
13-
- name: Checkout repository
14-
uses: actions/checkout@v2
23+
- name: Checkout the Yubico/yubihsm-setup repository
24+
uses: actions/checkout@v3
1525

16-
# download yubihsm-sdk installer from dev.y.c and install it
17-
- name: install yubihsm-shell
26+
- name: Install dependecies
1827
run: |
1928
set -e -o pipefail
2029
set -x
2130
31+
brew update
32+
brew install cmake pkg-config gengetopt help2man libusb
33+
brew reinstall openssl@3
34+
35+
- name: install libyubihsm
36+
run: |
2237
cd ..
23-
curl -L --max-redirs 2 -o yubihsm-sdk-installer.pkg https://developers.yubico.com/YubiHSM2/Releases/yubihsm2-sdk-$YUBIHSMSDK_VERSION-darwin-amd64.pkg
24-
sudo installer -verbose -store -pkg yubihsm-sdk-installer.pkg -target /
38+
git clone https://github.com/Yubico/yubihsm-shell.git
39+
cd yubihsm-shell
40+
mkdir build
41+
cd build
42+
cmake .. -DBUILD_ONLY_LIB=ON
43+
make
2544
2645
- name: clone yubihsmrs
2746
run: |
28-
set -e -o pipefail
29-
set -x
30-
3147
cd ..
3248
git clone https://github.com/Yubico/yubihsmrs.git
3349
3450
- name: Build yubihsm-setup
3551
run: |
3652
set -e -o pipefail
3753
set -x
38-
mkdir artifact
39-
40-
cd ..
41-
brew install libusb
54+
mkdir $GITHUB_WORKSPACE/artifact
55+
4256
export PATH=$PATH:~/.cargo/bin
4357
if [[ ! -x $(command -v rustc) ]]; then
4458
curl -o rustup.sh https://sh.rustup.rs
4559
bash ./rustup.sh -y
4660
fi
4761
48-
cd yubihsm-setup
49-
RUSTFLAGS="-C link-args=-Wl,-rpath,\$ORIGIN/../lib" YUBIHSM_LIB_DIR=/usr/local/lib cargo build --release
62+
RUSTFLAGS="-C link-args=-Wl,-rpath,\$ORIGIN/../lib" YUBIHSM_LIB_DIR=$GITHUB_WORKSPACE/../yubihsm-shell/build/lib cargo build --release
5063
strip -u -r target/release/yubihsm-setup
51-
install target/release/yubihsm-setup artifact
52-
53-
otool -L target/release/yubihsm-setup
54-
55-
./target/release/yubihsm-setup --version
56-
./target/release/yubihsm-setup --help
64+
install target/release/yubihsm-setup ../artifact
5765
5866
- name: Upload artifact
59-
uses: actions/upload-artifact@v2
67+
uses: actions/upload-artifact@v4
6068
with:
61-
name: yubihsm-setup
69+
name: yubihsm-setup-darwin-${{ matrix.arch }}64
6270
path: artifact

‎Cargo.lock

+157-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎resources/release/Vagrantfile

+61-19
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,32 @@ Vagrant.configure("2") do |config|
88
v.cpus = 2
99
end
1010

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

18-
config.vm.define "fedora34" do |fedora34|
19-
fedora34.vm.box = "messyzone/fedora34"
20-
fedora34.vm.synced_folder "../..", "/shared", type: "rsync",
18+
config.vm.define "fedora36" do |fedora36|
19+
fedora36.vm.box = "generic/fedora36"
20+
fedora36.vm.synced_folder "../..", "/shared", type: "rsync",
2121
rsync__args: ["--verbose", "--archive", "-z", "--delete"]
22-
fedora34.vm.provision "shell", :path => "build-rpm.sh", :args => "fedora34", :privileged => false
22+
fedora36.vm.provision "shell", :path => "build-rpm.sh", :args => "fedora36", :privileged => false
23+
end
24+
25+
config.vm.define "fedora37" do |fedora37|
26+
fedora37.vm.box = "generic/fedora37"
27+
fedora37.vm.synced_folder "../..", "/shared", type: "rsync",
28+
rsync__args: ["--verbose", "--archive", "-z", "--delete"]
29+
fedora37.vm.provision "shell", :path => "build-rpm.sh", :args => "fedora37", :privileged => false
30+
end
31+
32+
config.vm.define "fedora38" do |fedora38|
33+
fedora38.vm.box = "fedora/38-cloud-base"
34+
fedora38.vm.synced_folder "../..", "/shared", type: "rsync",
35+
rsync__args: ["--verbose", "--archive", "-z", "--delete"]
36+
fedora38.vm.provision "shell", :path => "build-rpm.sh", :args => "fedora38", :privileged => false
2337
end
2438

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

32-
config.vm.define "centos8" do |centos8|
33-
centos8.vm.box = "zyz/centos8"
34-
centos8.vm.synced_folder "../..", "/shared", type: "rsync",
35-
rsync__args: ["--verbose", "--archive", "-z", "--copy-links"]
36-
centos8.vm.provision "shell", :path => "build-rpm.sh", :args => "centos8", :privileged => false
37-
end
46+
# config.vm.define "centos8" do |centos8|
47+
# centos8.vm.box = "zyz/centos8"
48+
# centos8.vm.synced_folder "../..", "/shared", type: "rsync",
49+
# rsync__args: ["--verbose", "--archive", "-z", "--copy-links"]
50+
# centos8.vm.provision "shell", :path => "build-rpm.sh", :args => "centos8", :privileged => false
51+
# end
3852

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

5266
config.vm.define "debian11" do |debian11|
53-
debian11.vm.box = "axcxl/debian11_xfce"
67+
debian11.vm.box = "debian/bullseye64"
5468
debian11.vm.synced_folder "../..", "/shared", type: "rsync",
5569
rsync__args: ["--verbose", "--archive", "-z", "--delete"]
5670
debian11.vm.provision "shell", :path => "build-pkg.sh", :args => "debian11", :privileged => false
@@ -82,11 +96,39 @@ Vagrant.configure("2") do |config|
8296
focal.vm.provision "shell", :path => "build-pkg.sh", :args => "ubuntu2004", :privileged => false
8397
end
8498

85-
config.vm.define "hirsute" do |hirsute|
86-
hirsute.vm.box = "ubuntu/hirsute64"
87-
hirsute.vm.synced_folder "../..", "/shared", type: "rsync",
99+
config.vm.define "impish" do |impish|
100+
impish.vm.box = "ubuntu/impish64"
101+
impish.vm.synced_folder "../..", "/shared", type: "rsync",
102+
rsync__args: ["--verbose", "--archive", "-z", "--copy-links"]
103+
impish.vm.provision "shell", :path => "build-pkg.sh", :args => "ubuntu2110", :privileged => false
104+
end
105+
106+
config.vm.define "jammy" do |jammy|
107+
jammy.vm.box = "alvistack/ubuntu-22.04"
108+
jammy.vm.synced_folder "../..", "/shared", type: "rsync",
109+
rsync__args: ["--verbose", "--archive", "-z", "--copy-links"]
110+
jammy.vm.provision "shell", :path => "build-pkg.sh", :args => "ubuntu2204", :privileged => false
111+
end
112+
113+
config.vm.define "kinetic" do |kinetic|
114+
kinetic.vm.box = "ubuntu/kinetic64"
115+
kinetic.vm.synced_folder "../..", "/shared", type: "rsync",
116+
rsync__args: ["--verbose", "--archive", "-z", "--copy-links"]
117+
kinetic.vm.provision "shell", :path => "build-pkg.sh", :args => "ubuntu2210", :privileged => false
118+
end
119+
120+
config.vm.define "lunar" do |lunar|
121+
lunar.vm.box = "ubuntu/lunar64"
122+
lunar.vm.synced_folder "../..", "/shared", type: "rsync",
123+
rsync__args: ["--verbose", "--archive", "-z", "--copy-links"]
124+
lunar.vm.provision "shell", :path => "build-pkg.sh", :args => "ubuntu2304", :privileged => false
125+
end
126+
127+
config.vm.define "mantic" do |mantic|
128+
mantic.vm.box = "ubuntu/mantic64"
129+
mantic.vm.synced_folder "../..", "/shared", type: "rsync",
88130
rsync__args: ["--verbose", "--archive", "-z", "--copy-links"]
89-
hirsute.vm.provision "shell", :path => "build-pkg.sh", :args => "ubuntu2104", :privileged => false
131+
mantic.vm.provision "shell", :path => "build-pkg.sh", :args => "ubuntu2310", :privileged => false
90132
end
91133

92134
end

‎resources/release/build-all.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -e -o pipefail -x
44

5-
for machine in focal hirsute debian10 fedora33 fedora34 centos7 centos8; do
5+
for machine in focal impish jammy debian10 debian11 fedora35 fedora36 centos7; do
66
vagrant box update $machine
77
time vagrant up $machine
88
vagrant rsync-back $machine

‎resources/release/build-pkg.sh

+51-12
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,28 @@ set -x
44

55
PLATFORM=$1
66

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

1010
sudo apt-get update && sudo apt-get dist-upgrade -y
11-
sudo apt-get install -y build-essential git
11+
#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
12+
sudo apt-get install -y build-essential \
13+
chrpath \
14+
git \
15+
cmake \
16+
pkg-config \
17+
gengetopt \
18+
help2man \
19+
libedit-dev \
20+
libcurl4-openssl-dev \
21+
liblzma-dev \
22+
libssl-dev \
23+
libseccomp-dev \
24+
libusb-1.0.0-dev \
25+
dh-exec \
26+
git-buildpackage \
27+
curl \
28+
libpcsclite-dev
1229

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

2946
pushd "/tmp" &>/dev/null
3047
# install yubihsm-shell
31-
mkdir yubihsm2-sdk
32-
pushd "yubihsm2-sdk" &>/dev/null
33-
curl -L --max-redirs 2 -o - https://developers.yubico.com/YubiHSM2/Releases/yubihsm2-sdk-$YUBIHSMSDK_VERSION-$PLATFORM-amd64.tar.gz |\
34-
tar -xzvf -
35-
pushd "yubihsm2-sdk" &>/dev/null
36-
sudo dpkg -i ./libyubihsm*_amd64.deb
37-
popd &>/dev/null
38-
popd &>/dev/null
48+
# mkdir yubihsm2-sdk
49+
# pushd "yubihsm2-sdk" &>/dev/null
50+
# curl -L --max-redirs 2 -o - https://developers.yubico.com/YubiHSM2/Releases/yubihsm2-sdk-$YUBIHSMSDK_VERSION-$PLATFORM-amd64.tar.gz |\
51+
# tar -xzvf -
52+
# pushd "yubihsm2-sdk" &>/dev/null
53+
# sudo dpkg -i ./libyubihsm*_amd64.deb
54+
# popd &>/dev/null
55+
# popd &>/dev/null
56+
57+
#git clone https://github.com/Yubico/yubihsm-shell.git
58+
#cp -r /shared/resources/yubihsm-shell .
59+
#pushd "yubihsm-shell" &>/dev/null
60+
# mkdir build
61+
# pushd "build" &>/dev/null
62+
# cmake .. -DBUILD_ONLY_LIB=ON
63+
# make
64+
# popd
65+
# if [ "${PLATFORM:0:6}" == "debian" ] || [ "$PLATFORM" == "ubuntu1804" ]; then
66+
# dpkg-buildpackage -b --no-sign
67+
# else
68+
# dpkg-buildpackage
69+
# fi
70+
#popd
71+
#cp libyubihsm1*.deb "${OUTPUT}"
72+
#cp libyubihsm-usb1*.deb "${OUTPUT}"
73+
#cp libyubihsm-http1*.deb "${OUTPUT}"
74+
75+
sudo dpkg -i $INPUT/resources/release/libyubihsm*_amd64.deb
3976

4077
# install yubihsmrs
4178
rm -rf yubihsmrs
@@ -45,8 +82,10 @@ pushd "/tmp" &>/dev/null
4582
rm -rf yubihsm-setup
4683
git clone "$INPUT" yubihsm-setup
4784
pushd "yubihsm-setup" &>/dev/null
48-
YUBIHSM_LIB_DIR=$(dpkg -L libyubihsm1 | grep -e "libyubihsm.so.2$" | xargs dirname) \
49-
cargo build --release
85+
#YUBIHSM_LIB_DIR=$(dpkg -L libyubihsm1 | grep -e "libyubihsm.so.2$" | xargs dirname) \
86+
# cargo build --release
87+
#YUBIHSM_LIB_DIR=/tmp/yubihsm-shell/build/lib cargo build --release
88+
YUBIHSM_LIB_DIR=/usr/lib/x86_64-linux-gnu cargo build --release
5089
strip --strip-all target/release/yubihsm-setup
5190
cargo deb --no-build
5291
cp target/debian/*.deb "${OUTPUT}"

‎resources/release/build-rpm.sh

+33-20
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -e -o pipefail
33
set -x
44

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

88
if [ "$PLATFORM" == "centos7" ]; then
99
sudo yum -y install centos-release-scl
@@ -37,12 +37,13 @@ elif [ "$PLATFORM" == "centos8" ]; then
3737
elif [ "${PLATFORM:0:6}" == "fedora" ]; then
3838
sudo dnf -y update
3939
sudo dnf -y install binutils \
40-
git \
41-
cmake \
42-
openssl-devel \
43-
libusb-devel \
44-
libcurl-devel \
45-
rpmdevtools
40+
git \
41+
cmake \
42+
openssl-devel \
43+
libusb1-devel \
44+
libcurl-devel \
45+
rpmdevtools \
46+
pcsc-lite-devel
4647

4748
export CMAKE="cmake"
4849
fi
@@ -61,16 +62,24 @@ mkdir -p $OUTPUT
6162

6263
pushd "/tmp" &>/dev/null
6364
# build yubihsm-shell from source
64-
rm -rf yubihsm-shell-$LIBYUBIHSM_VERSION
65-
curl -L --max-redirs 2 -o - https://developers.yubico.com/yubihsm-shell/Releases/yubihsm-shell-$LIBYUBIHSM_VERSION.tar.gz |\
66-
tar -xzvf -
67-
pushd "yubihsm-shell-$LIBYUBIHSM_VERSION" &>/dev/null
68-
mkdir build
69-
pushd "build" &>/dev/null
70-
$CMAKE .. -DBUILD_ONLY_LIB=ON
71-
make
72-
popd &>/dev/null
73-
popd &>/dev/null
65+
#rm -rf yubihsm-shell-$LIBYUBIHSM_VERSION
66+
#curl -L --max-redirs 2 -o - https://developers.yubico.com/yubihsm-shell/Releases/yubihsm-shell-$LIBYUBIHSM_VERSION.tar.gz |\
67+
# tar -xzvf -
68+
69+
#git clone https://github.com/Yubico/yubihsm-shell.git
70+
#cp -r /shared/resources/yubihsm-shell .
71+
#pushd "yubihsm-shell-$LIBYUBIHSM_VERSION" &>/dev/null
72+
#pushd "yubihsm-shell" &>/dev/null
73+
# mkdir build
74+
# pushd "build" &>/dev/null
75+
# $CMAKE .. -DBUILD_ONLY_LIB=ON
76+
# make
77+
# popd &>/dev/null
78+
#popd &>/dev/null
79+
80+
sudo dnf -y install yubihsm-shell-2.4.1-1.fc38.x86_64.rpm
81+
sudo dnf -y install yubihsm-devel-2.4.1-1.fc38.x86_64.rpm
82+
7483

7584
# install yubihsmrs
7685
rm -rf yubihsmrs
@@ -82,8 +91,12 @@ pushd "/tmp" &>/dev/null
8291
pushd "yubihsm-setup" &>/dev/null
8392
cargo install cargo-rpm
8493
cargo rpm init
85-
YUBIHSM_LIB_DIR=/tmp/yubihsm-shell-$LIBYUBIHSM_VERSION/build/lib cargo build --release
86-
YUBIHSM_LIB_DIR=/tmp/yubihsm-shell-$LIBYUBIHSM_VERSION/build/lib cargo rpm build
94+
#YUBIHSM_LIB_DIR=/tmp/yubihsm-shell-$LIBYUBIHSM_VERSION/build/lib cargo build --release
95+
#YUBIHSM_LIB_DIR=/tmp/yubihsm-shell-$LIBYUBIHSM_VERSION/build/lib cargo rpm build
96+
#YUBIHSM_LIB_DIR=/tmp/yubihsm-shell/build/lib cargo build --release
97+
#YUBIHSM_LIB_DIR=/tmp/yubihsm-shell/build/lib cargo rpm build
98+
cargo build --release
99+
cargo rpm build
87100
cp target/release/rpmbuild/RPMS/x86_64/*.rpm $OUTPUT
88101
popd &>/dev/null
89102
popd &>/dev/null
@@ -103,4 +116,4 @@ pushd "/shared" &>/dev/null
103116
rm -rf licenses
104117
rm -rf ../yubihsm-setup
105118
popd &>/dev/null
106-
popd &>/dev/null
119+
popd &>/dev/null

0 commit comments

Comments
 (0)
Please sign in to comment.