@@ -21,19 +21,21 @@ configure_base()
2121{
2222 case " $TGT " in
2323 rocky* )
24- # RedHat specific tools.
2524 yum install -y yum-utils
26- dnf config-manager --enable powertools
27- yum install -y epel-release
25+ dnf install -y dnf-plugin-config-manager
26+ dnf config-manager --enable crb
27+ dnf install -y epel-release
2828 PKGS=(
2929 ImageMagick
3030 ImageMagick-devel
3131 libyaml-devel
3232 glibc-langpack-en
33+ mercurial
3334 )
34- yum -y install ${PKGS[@]}
35- dnf config-manager --disable powertools
36- yum remove -y epel-release yum-utils
35+ dnf -y install ${PKGS[@]}
36+ dnf remove -y epel-release yum-utils
37+
38+ dnf -y autoremove; dnf clean all
3739 ;;
3840 ubuntu* )
3941 # Make noninteractive setting permanent
@@ -62,10 +64,13 @@ configure_sshkeys()
6264 case " $TGT " in
6365 rocky* )
6466 ssh-keygen -t rsa -N ' ' -f /etc/ssh/ssh_host_rsa_key
67+ # EL9 enable RSA
68+ update-crypto-policies --set DEFAULT:SHA1
6569 ;;
6670 ubuntu* )
67- # noop - nothing to do.
68- true
71+ # Enable (deprecated) RSA
72+ echo ' HostKeyAlgorithms +ssh-rsa' >> /etc/ssh/sshd_config
73+ echo ' PubkeyAcceptedKeyTypes +ssh-rsa' >> /etc/ssh/sshd_config
6974 ;;
7075 * )
7176 distro_unsupported
@@ -78,21 +83,38 @@ configure_sshkeys()
7883 sed -ri ' s/^#?PubkeyAuthentication\s+.*/PubkeyAuthentication yes/' /etc/ssh/sshd_config
7984 sed -ri ' s/requiretty/!requiretty/' /etc/sudoers
8085 echo ' root:docker.io' | chpasswd
81- # Enable (deprecated) RSA
82- echo ' HostKeyAlgorithms +ssh-rsa' >> /etc/ssh/sshd_config
83- echo ' PubkeyAcceptedKeyTypes +ssh-rsa' >> /etc/ssh/sshd_config
8486
8587 mkdir /var/run/sshd
8688}
8789
8890install_locale ()
8991{
90- # install locales package and set default locale to
91- # 'UTF-8' for the test execution environment.
92- apt-get -y install locales
93- locale-gen en_US.UTF-8
94- dpkg-reconfigure locales
95- update-locale LANG=en_US.UTF-8
92+ case " $TGT " in
93+ rocky* )
94+ PKGS=(
95+ nc
96+ net-tools
97+ glibc-locale-source
98+ )
99+ dnf -y install ${PKGS[@]}
100+ dnf -y autoremove; dnf clean all
101+
102+ # -i: specify the locale definition file
103+ # -f: specify the character set
104+ localedef -i en_US -f UTF-8 en_US.UTF-8
105+ ;;
106+ ubuntu* )
107+ # install locales package and set default locale to
108+ # 'UTF-8' for the test execution environment.
109+ apt-get -y install locales
110+ locale-gen en_US.UTF-8
111+ dpkg-reconfigure locales
112+ update-locale LANG=en_US.UTF-8
113+ ;;
114+ * )
115+ distro_unsupported
116+ ;;
117+ esac
96118}
97119
98120install_download_tools ()
@@ -101,13 +123,18 @@ install_download_tools()
101123 rocky* )
102124 PKGS=(
103125 ca-certificates
104- curl
105- wget
126+ iproute
106127 nc
107- iproute2
108128 net-tools
129+ procps
130+ setup
131+ subversion
132+ wget
109133 )
110134 dnf -y install ${PKGS[@]}
135+ # work around package manager confusion when installing curl.
136+ dnf -y --allowerasing install curl
137+ dnf -y autoremove; dnf clean all
111138 ;;
112139 ubuntu* )
113140 PKGS=(
@@ -134,24 +161,48 @@ install_download_tools()
134161
135162configure_testing_system ()
136163{
137- # Not sure why this is required.
138- find /etc/systemd/system \
139- /lib/systemd/system \
140- -path ' *.wants/*' \
141- -not -name ' *journald*' \
142- -not -name ' *systemd-tmpfiles*' \
143- -not -name ' *systemd-user-sessions*' \
144- -exec rm \{ } \;
164+ case " $TGT " in
165+ rocky* )
166+ cd /lib/systemd/system/sysinit.target.wants/
167+ ls -1 | grep -v systemd-tmpfiles-setup.service | xargs rm
168+ rm -f /etc/systemd/system/* .wants/*
169+ rm -f /lib/systemd/system/local-fs.target.wants/*
170+ rm -f /lib/systemd/system/sockets.target.wants/* udev*
171+ rm -f /lib/systemd/system/sockets.target.wants/* initctl*
172+ rm -f /lib/systemd/system/basic.target.wants/*
173+ rm -f /lib/systemd/system/anaconda.target.wants/*
174+ systemctl preset sshd
175+
176+ # install doc files (/usr/share/docs) when installing yum packages
177+ # otherwise /usr/share/docs/st2/conf/nginx/st2.conf won't be present
178+ # https://github.com/docker-library/docs/tree/master/centos#package-documentation
179+ sed -i ' /nodocs/d' /etc/yum.conf
180+ ;;
181+ ubuntu* )
182+ # TO DO: This may be a pre-systemd relica.
183+ find /etc/systemd/system \
184+ /lib/systemd/system \
185+ -path ' *.wants/*' \
186+ -not -name ' *journald*' \
187+ -not -name ' *systemd-tmpfiles*' \
188+ -not -name ' *systemd-user-sessions*' \
189+ -exec rm \{ } \;
145190
146- systemctl set-default multi-user.target
191+ systemctl set-default multi-user.target
147192
148- # The base Ubuntu 18.04 image contains a file that excludes all documentation
149- # from being installed by packages. Specifically /usr/share/doc/*
150- # This exclusion prevents our nginx config from being installed in the 'st2' package:
151- # /usr/share/doc/st2/conf/nginx/st2.conf
152- # This step removes the exclusion configuration so documentation of all future packages
153- # will be installed.
154- rm -rf /etc/dpkg/dpkg.cfg.d/excludes
193+ # The base Ubuntu 18.04 image contains a file that excludes
194+ # all documentation from being installed by packages.
195+ # Specifically /usr/share/doc/* This exclusion prevents our
196+ # nginx config from being installed in the 'st2' package:
197+ # /usr/share/doc/st2/conf/nginx/st2.conf
198+ # This step removes the exclusion configuration so
199+ # documentation of all future packages will be installed.
200+ rm -rf /etc/dpkg/dpkg.cfg.d/excludes
201+ ;;
202+ * )
203+ distro_unsupported
204+ ;;
205+ esac
155206}
156207
157208install_system_tools ()
@@ -161,9 +212,11 @@ install_system_tools()
161212 PKGS=(
162213 git
163214 openssh-server
215+ openssh-clients
164216 sudo
165217 )
166218 dnf -y install ${PKGS[@]}
219+ dnf -y autoremove; dnf clean all
167220 ;;
168221 ubuntu* )
169222 PKGS=(
@@ -208,15 +261,33 @@ install_build_dependencies()
208261 mysql-devel
209262 ncurses-devel
210263 openssl-devel
264+ pam
211265 patch
212266 postgresql-devel
213267 readline-devel
214268 sqlite-devel
269+ unzip
215270 xz
216271 xz-devel
272+ zip
217273 zlib-devel
218274 )
219275 dnf -y install ${PKGS[@]}
276+ dnf -y autoremove; dnf clean all
277+ case " $TGT " in
278+ rocky-9* )
279+ PKGS=(
280+ python39
281+ python3-devel
282+ )
283+ dnf -y install ${PKGS[@]}
284+ dnf -y autoremove; dnf clean all
285+ ;;
286+ * )
287+ echo " Unsupported Redhat compatible version."
288+ exit 1
289+ ;;
290+ esac
220291 ;;
221292 ubuntu* )
222293 PKGS=(
@@ -259,6 +330,7 @@ install_st2_build_dependencies()
259330 openldap-devel
260331 )
261332 dnf -y install ${PKGS[@]}
333+ dnf -y autoremove; dnf clean all
262334 ;;
263335 ubuntu* )
264336 PKGS=(
@@ -283,22 +355,20 @@ install_python()
283355 case " $TGT " in
284356 rocky* )
285357 PKGS=(
286- python38
287- python38 -devel
358+ python3
359+ python3 -devel
288360 rpmdevtools
289- python3-virtualenv
290361 )
291362 dnf -y install ${PKGS[@]}
292- # Install development tools and python3.8 for EL8
363+ dnf -y autoremove; dnf clean all
364+
293365 PYPKGS=(
294366 " virtualenv==20.30.0"
295367 " pip==25.0.1"
296368 wheel
297369 setuptools
298- " requests[security]"
299- venvctrl
300370 )
301- pip3.8 install --upgrade ${PYPKGS[@]}
371+ pip3 install --upgrade ${PYPKGS[@]}
302372 rm -rf /root/.cache
303373 ;;
304374 ubuntu* )
0 commit comments