Skip to content

Commit b7f9b6a

Browse files
authored
Packaging: extract venv (from pex) and packs (from archives) during rpm/deb post-install (#6320)
2 parents b44c5c3 + 9a2b69d commit b7f9b6a

File tree

3 files changed

+55
-1
lines changed

3 files changed

+55
-1
lines changed

CHANGELOG.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Added
7979
to pants' use of PEX lockfiles. This is not a user-facing addition.
8080
#6118 #6141 #6133 #6120 #6181 #6183 #6200 #6237 #6229 #6240 #6241 #6244 #6251 #6253
8181
#6254 #6258 #6259 #6260 #6269 #6275 #6279 #6278 #6282 #6283 #6273 #6287 #6306 #6307
82-
#6311 #6314 #6315 #6317 #6319 #6312
82+
#6311 #6314 #6315 #6317 #6319 #6312 #6320
8383
Contributed by @cognifloyd
8484
* Build of ST2 EL9 packages #6153
8585
Contributed by @amanda11

packaging/deb/scripts/post-install.sh

+27
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ set -e
2929
# https://www.mankier.com/5/deb-triggers
3030
# https://stackoverflow.com/questions/15276535/dpkg-how-to-use-trigger
3131

32+
# The default set of packs installed with st2.
33+
_ST2_PACKS="
34+
chatops
35+
core
36+
default
37+
linux
38+
packs
39+
"
40+
3241
# This must include ".service" to satisfy deb-systemd-{helper,invoke}
3342
_ST2_SERVICES="
3443
st2actionrunner.service
@@ -83,8 +92,26 @@ systemd_enable_and_restart() {
8392
fi
8493
}
8594

95+
rebuild_st2_venv() {
96+
/opt/stackstorm/install/st2.pex
97+
}
98+
99+
extract_st2_pack() {
100+
pack=${1}
101+
shift
102+
# shellcheck disable=SC2209
103+
PAGER=cat /opt/stackstorm/install/packs/"${pack}".tgz.run --quiet --accept "${@}"
104+
}
105+
86106
case "$1" in
87107
configure)
108+
# Fail install if venv build or pack extraction fails
109+
rebuild_st2_venv || exit $?
110+
for pack in ${_ST2_PACKS}; do
111+
extract_st2_pack "${pack}" || exit $?
112+
done
113+
extract_st2_pack examples --target /usr/share/doc/st2/examples || :
114+
88115
# shellcheck disable=SC2086
89116
systemd_enable_and_restart ${_ST2_SERVICES}
90117
;;

packaging/rpm/scripts/post-install.sh

+27
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ set -e
77
# * on upgrade: $1 > 1
88
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_syntax
99

10+
# The default set of packs installed with st2.
11+
_ST2_PACKS="
12+
chatops
13+
core
14+
default
15+
linux
16+
packs
17+
"
18+
1019
_ST2_SERVICES="
1120
st2actionrunner
1221
st2api
@@ -21,6 +30,24 @@ st2timersengine
2130
st2workflowengine
2231
"
2332

33+
rebuild_st2_venv() {
34+
/opt/stackstorm/install/st2.pex
35+
}
36+
37+
extract_st2_pack() {
38+
pack=${1}
39+
shift
40+
# shellcheck disable=SC2209
41+
PAGER=cat /opt/stackstorm/install/packs/"${pack}".tgz.run --quiet --accept "${@}"
42+
}
43+
44+
# Fail install if venv build or pack extraction fails
45+
rebuild_st2_venv || exit $?
46+
for pack in ${_ST2_PACKS}; do
47+
extract_st2_pack "${pack}" || exit $?
48+
done
49+
extract_st2_pack examples --target /usr/share/doc/st2/examples || :
50+
2451
# Native .rpm specs use macros that get expanded into shell snippets.
2552
# We are using nfpm, so we inline the macro expansion here.
2653
# %systemd_post

0 commit comments

Comments
 (0)