|
19 | 19 |
|
20 | 20 | set -ex |
21 | 21 |
|
22 | | -readonly ctr=$1 |
23 | | -readonly scratchmnt=$2 |
| 22 | +readonly ctr_mq=$1 |
| 23 | +readonly mnt_mq=$2 |
24 | 24 | readonly archive=$3 |
25 | 25 | readonly mq_packages=$4 |
26 | 26 | readonly dir_extract=/tmp/extract |
27 | 27 |
|
28 | | -groupadd --root $scratchmnt --system --gid 888 mqm |
29 | | -useradd --root $scratchmnt --system --uid 888 --gid mqm mqm |
30 | | -usermod --root $scratchmnt -aG root mqm |
31 | | -usermod --root $scratchmnt -aG mqm root |
32 | | - |
33 | 28 | if [ ! -d ${dir_extract}/MQServer ]; then |
34 | 29 | mkdir -p ${dir_extract} |
35 | 30 | echo Extracting $archive |
|
41 | 36 |
|
42 | 37 |
|
43 | 38 | # Accept the MQ license |
44 | | -buildah run --volume ${dir_extract}:/mnt/mq-download $ctr -- /mnt/mq-download/MQServer/mqlicense.sh -text_only -accept |
| 39 | +buildah run --volume ${dir_extract}:/mnt/mq-download $ctr_mq -- /mnt/mq-download/MQServer/mqlicense.sh -text_only -accept |
45 | 40 |
|
46 | | -buildah run --volume ${dir_extract}:/mnt/mq-download $ctr -- bash -c "cd /mnt/mq-download/MQServer && rpm -ivh $mq_packages" |
| 41 | +buildah run --volume ${dir_extract}:/mnt/mq-download $ctr_mq -- bash -c "cd /mnt/mq-download/MQServer && rpm -ivh $mq_packages" |
47 | 42 |
|
48 | 43 | rm -rf ${dir_extract}/MQServer |
49 | 44 |
|
50 | 45 | # Remove 32-bit libraries from 64-bit container |
51 | | -find $scratchmnt/opt/mqm $scratchmnt/var/mqm -type f -exec file {} \; | awk -F: '/ELF 32-bit/{print $1}' | xargs --no-run-if-empty rm -f |
| 46 | +find $mnt_mq/opt/mqm $mnt_mq/var/mqm -type f -exec file {} \; | awk -F: '/ELF 32-bit/{print $1}' | xargs --no-run-if-empty rm -f |
52 | 47 |
|
53 | 48 | # Remove tar.gz files unpacked by RPM postinst scripts |
54 | | -find $scratchmnt/opt/mqm -name '*.tar.gz' -delete |
| 49 | +find $mnt_mq/opt/mqm -name '*.tar.gz' -delete |
55 | 50 |
|
56 | 51 | # Recommended: Set the default MQ installation (makes the MQ commands available on the PATH) |
57 | | -buildah run $ctr -- /opt/mqm/bin/setmqinst -p /opt/mqm -i |
| 52 | +buildah run $ctr_mq -- /opt/mqm/bin/setmqinst -p /opt/mqm -i |
58 | 53 |
|
59 | | -mkdir -p $scratchmnt/run/runmqserver |
60 | | -chown 888:888 $scratchmnt/run/runmqserver |
| 54 | +mkdir -p $mnt_mq/run/runmqserver |
| 55 | +chown 888:888 $mnt_mq/run/runmqserver |
61 | 56 |
|
62 | 57 | # Remove the directory structure under /var/mqm which was created by the installer |
63 | | -rm -rf $scratchmnt/var/mqm |
| 58 | +rm -rf $mnt_mq/var/mqm |
64 | 59 |
|
65 | 60 | # Create the mount point for volumes |
66 | | -mkdir -p $scratchmnt/mnt/mqm |
| 61 | +mkdir -p $mnt_mq/mnt/mqm |
67 | 62 |
|
68 | 63 | # Create a symlink for /var/mqm -> /mnt/mqm/data |
69 | | -buildah run $ctr -- ln -s /mnt/mqm/data /var/mqm |
| 64 | +buildah run $ctr_mq -- ln -s /mnt/mqm/data /var/mqm |
70 | 65 |
|
71 | 66 | # Optional: Set these values for the IBM Cloud Vulnerability Report |
72 | | -sed -i 's/PASS_MAX_DAYS\t99999/PASS_MAX_DAYS\t90/' $scratchmnt/etc/login.defs |
73 | | -sed -i 's/PASS_MIN_DAYS\t0/PASS_MIN_DAYS\t1/' $scratchmnt/etc/login.defs |
74 | | -sed -i 's/password\t\[success=1 default=ignore\]\tpam_unix\.so obscure sha512/password\t[success=1 default=ignore]\tpam_unix.so obscure sha512 minlen=8/' $scratchmnt/etc/pam.d/password-auth |
| 67 | +sed -i 's/PASS_MAX_DAYS\t99999/PASS_MAX_DAYS\t90/' $mnt_mq/etc/login.defs |
| 68 | +sed -i 's/PASS_MIN_DAYS\t0/PASS_MIN_DAYS\t1/' $mnt_mq/etc/login.defs |
| 69 | +sed -i 's/password\t\[success=1 default=ignore\]\tpam_unix\.so obscure sha512/password\t[success=1 default=ignore]\tpam_unix.so obscure sha512 minlen=8/' $mnt_mq/etc/pam.d/password-auth |
| 70 | + |
| 71 | +buildah run $ctr_mq -- cp -rs /opt/mqm/licenses/ / |
0 commit comments