mirror of
https://github.com/xcat2/confluent.git
synced 2026-09-08 12:40:48 +00:00
811e5fe03d
Linux-PAM reads vendor defaults from /usr/lib/pam.d and distributions are migrating there package by package: systemd and polkit already ship into it on both EL and Debian, and on SUSE 16 openssh has followed. There the old code left a dangling /etc/pam.d/confluent and every pam authentication against it failed. The deb postinst carries the same logic, so fix it in step. ln -sf rather than ln -s because -e is false for a dangling link, so the old code retried the symlink and failed with 'File exists' instead of repairing it.
103 lines
3.9 KiB
Bash
Executable File
103 lines
3.9 KiB
Bash
Executable File
#!/bin/bash
|
|
cd `dirname $0`
|
|
export DEBFULLNAME="Lenovo HPC"
|
|
export DEBEMAIL="hpchelp@lenovo.com"
|
|
PKGNAME=$(basename $(pwd))
|
|
DPKGNAME=$(basename $(pwd) | sed -e s/_/-/)
|
|
OPKGNAME=$(basename $(pwd) | sed -e s/_/-/)
|
|
PYEXEC=python3
|
|
DSCARGS="--with-python3=True --with-python2=False"
|
|
if grep wheezy /etc/os-release; then
|
|
DPKGNAME=python-$DPKGNAME
|
|
PYEXEC=python
|
|
DSCARGS=""
|
|
fi
|
|
cd ..
|
|
mkdir -p /tmp/confluent # $DPKGNAME
|
|
cp -a * .git /tmp/confluent # $DPKGNAME
|
|
cd /tmp/confluent/$PKGNAME
|
|
if [ -x ./makeman ]; then
|
|
./makeman
|
|
fi
|
|
VERSION=`./makesetup` || exit 1
|
|
cat > setup.cfg << EOF
|
|
[install]
|
|
install_purelib=/opt/confluent/lib/python
|
|
install_scripts=/opt/confluent/bin
|
|
|
|
[sdist_dsc]
|
|
package=$DPKGNAME
|
|
EOF
|
|
|
|
$PYEXEC setup.py sdist > /dev/null 2>&1
|
|
py2dsc $DSCARGS dist/*.tar.gz
|
|
shopt -s extglob
|
|
cd deb_dist/!(*.orig)/
|
|
if [ "$OPKGNAME" = "confluent-server" ]; then
|
|
if grep noble /etc/os-release; then
|
|
sed -i 's/^\(Depends:.*\)/\1, confluent-client, python3-lxml, python3-eficompressor, python3-cryptography, python3-websocket, python3-msgpack, python3-aiohttp, python3-pyparsing, python3-asyncssh, python3-pysnmp-lextudio, python3-libarchive-c, confluent-vtbufferd, python3-netifaces, python3-yaml, python3-dateutil, python3-numpy, python3-pillow/' debian/control
|
|
else
|
|
sed -i 's/^\(Depends:.*\)/\1, confluent-client, python3-lxml, python3-eficompressor, python3-cryptography, python3-websocket, python3-msgpack, python3-aiohttp, python3-pyparsing, python3-asyncssh, python3-pysnmp4, python3-libarchive-c, confluent-vtbufferd, python3-netifaces, python3-yaml, python3-dateutil, python3-crypt-r, python3-numpy, python3-pillow/' debian/control
|
|
fi
|
|
echo 'confluent_client confluent-client' >> debian/pydist-overrides
|
|
|
|
fi
|
|
if ! grep wheezy /etc/os-release; then
|
|
sed -i 's/^Package: python3-/Package: /' debian/control
|
|
fi
|
|
head -n -1 debian/control > debian/control1
|
|
mv debian/control1 debian/control
|
|
cat > debian/postinst << \EOF
|
|
if ! getent passwd confluent > /dev/null; then
|
|
useradd -r confluent -d /var/lib/confluent -s /usr/sbin/nologin
|
|
fi
|
|
mkdir -p /etc/confluent /var/lib/confluent /var/log/confluent /var/cache/confluent
|
|
chown confluent:confluent /etc/confluent /var/lib/confluent /var/log/confluent /var/cache/confluent
|
|
|
|
sysctl -p /usr/lib/sysctl.d/confluent.conf > /dev/null 2>&1
|
|
NEEDCHOWN=0
|
|
NEEDSTART=0
|
|
[ -n "$(find /etc/confluent /var/log/confluent /var/cache/confluent -uid 0 -print -quit 2>/dev/null)" ] && NEEDCHOWN=1
|
|
if [ $NEEDCHOWN = 1 ]; then
|
|
if systemctl is-active confluent > /dev/null; then
|
|
NEEDSTART=1
|
|
systemctl stop confluent
|
|
fi
|
|
chown -R confluent:confluent /etc/confluent /var/log/confluent /var/cache/confluent
|
|
fi
|
|
systemctl daemon-reload
|
|
if systemctl is-active confluent > /dev/null || [ $NEEDSTART = 1 ]; then systemctl restart confluent > /dev/null 2>&1; fi
|
|
# -e is false for a dangling link, so an existing bad one is replaced. Linux-PAM
|
|
# reads vendor defaults from /usr/lib/pam.d and distributions are migrating there
|
|
# package by package; openssh has already done so on SUSE 16.
|
|
if [ ! -e /etc/pam.d/confluent ]; then
|
|
for pamsrc in /etc/pam.d/sshd /usr/lib/pam.d/sshd; do
|
|
if [ -f $pamsrc ]; then
|
|
ln -sf $pamsrc /etc/pam.d/confluent
|
|
break
|
|
fi
|
|
done
|
|
fi
|
|
true
|
|
EOF
|
|
echo 'export PYBUILD_INSTALL_ARGS=--install-lib=/opt/confluent/lib/python' >> debian/rules
|
|
#echo 'Provides: python-'$DPKGNAME >> debian/control
|
|
#echo 'Conflicts: python-'$DPKGNAME >> debian/control
|
|
#echo 'Replaces: python-'$DPKGNAME' (<<2)' >> debian/control
|
|
#echo 'Breaks: python-'$DPKGNAME' (<<2)' >> debian/control
|
|
|
|
dpkg-buildpackage -rfakeroot -uc -us -i
|
|
if [ $? -ne 0 ]; then
|
|
echo "[ERROR] rpmbuild returned non-zero, run: rpmbuild -ba ~/rpmbuild/SPECS/$PKGNAME.spec"
|
|
exit 1
|
|
else
|
|
cd -
|
|
# Clean up the generated files in this directory
|
|
rm -rf $PKGNAME.egg-info dist setup.py
|
|
rm -rf $(find deb_dist -mindepth 1 -maxdepth 1 -type d)
|
|
if [ ! -z "$1" ]; then
|
|
mv deb_dist/*.deb $1/
|
|
fi
|
|
fi
|
|
exit 0
|