PREIN
/bin/sh
# Add wildfly user and group
getent group wildfly >/dev/null || groupadd -f -g 185 -r wildfly
if ! getent passwd wildfly >/dev/null ; then
if ! getent passwd 185 >/dev/null ; then
useradd -r -u 185 -g wildfly -d /usr/share/wildfly -s /sbin/nologin -c "The WildFly Application Server user" wildfly
else
useradd -r -g wildfly -d /usr/share/wildfly -s /sbin/nologin -c "The WildFly Application Server user" wildfly
fi
fi
exit 0
PREUN
/bin/sh
/usr/share/rpm-helper/del-service wildfly $1 wildfly.service
# Let's clean up the arch-specific symlinks
for l in $(find /usr/share/wildfly/modules/system/layers/base/org/apache/activemq/artemis/main/lib -name "*.so"); do
[ -L ${l} ] && rm -f ${l}
done
POSTIN
/bin/sh
/usr/bin/systemd-tmpfiles --create wildfly.conf
/usr/share/rpm-helper/add-service wildfly $1 wildfly.service
# WildFly relies on some arch specific binary modules, let's link them.
# We don't want to do this at build time because it should be still noarch package.
arch=`uname -m`
if [ "${arch}" = "x86_64" ]; then
native_arch="64"
libdir="/usr/lib${native_arch}"
validarch="x86_64"
else
native_arch="32"
libdir="/usr/lib"
validarch="i686"
fi
if [[ $arch == arm* ]]; then
native_arch="32"
libdir="/usr/lib"
validarch="arm"
fi
# ?
if [[ $arch == aarch64 ]]; then
native_arch="64"
libdir="/usr/lib${native_arch}"
validarch="arm64"
fi
pushd /usr/share/wildfly/modules/system/layers/base/org/apache/activemq/artemis/main/lib/linux-${validarch} > /dev/null
ln -sf ${libdir}/artemis/libartemis-native.so libartemis-native-${native_arch}.so
popd > /dev/null
POSTUN
/bin/sh
/usr/share/rpm-helper/reread-services wildfly