opsi/dev-python/python-opsi/python-opsi-4.0.5.15.ebuild

105 lines
2.8 KiB
Bash
Raw Normal View History

# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="4"
PYTHON_DEPEND="2"
SUPPORT_PYTHON_ABIS="1"
RESTRICT_PYTHON_ABIS="3.* *-jython"
RPM_VER="1.2"
OPSI="opsi40"
SUSE="openSUSE_13.1"
inherit distutils eutils rpm
DESCRIPTION="opsi python library"
HOMEPAGE="http://opsi.org/"
SRC_URI="http://download.opensuse.org/repositories/home:/uibmz:/opsi:/${OPSI}/${SUSE}/src/${P}-${RPM_VER}.src.rpm"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~arm ~x86"
IUSE=""
RDEPEND="dev-python/twisted-web
dev-python/twisted-conch
dev-python/pycrypto
dev-python/python-ldap
dev-python/simplejson
dev-python/pypam
dev-python/mysql-python
dev-python/sqlalchemy
dev-python/pyasn1
dev-python/m2crypto
dev-python/pyopenssl
sys-apps/iproute2
app-backup/duplicity
dev-python/ldaptor
sys-apps/lshw
sys-apps/file[python]
sys-apps/lsb-release
dev-libs/newt
sys-apps/shadow
net-misc/zsync"
DEPEND="${RDEPEND}
sys-devel/gettext
dev-python/setuptools"
PYTHON_MODNAME="OPSI"
src_prepare() {
distutils_src_prepare
sed -i 's#/etc/dhcp3/dhcpd.conf#/etc/dhcp/dhcpd.conf#;s#/etc/init.d/dhcp3-server#/etc/init.d/dhcpd#' data/backends/dhcpd.conf
}
src_install() {
distutils_src_install
dosym ../20_legacy.conf etc/opsi/backendManager/extend.d/configed/20_legacy.conf
}
pkg_postinst() {
distutils_pkg_postinst
fileadmingroup=$(grep "fileadmingroup" /etc/opsi/opsi.conf | cut -d "=" -f 2 | sed 's/\s*//g')
if [ -z "$fileadmingroup" ]; then
fileadmingroup=pcpatch
fi
if [ $fileadmingroup != pcpatch -a -z "$(getent group $fileadmingroup)" ]; then
groupmod -n $fileadmingroup pcpatch
else
if [ -z "$(getent group $fileadmingroup)" ]; then
groupadd $fileadmingroup
fi
fi
if [ -z "`getent passwd pcpatch`" ]; then
useradd -G $fileadmingroup -d /var/lib/opsi -s /bin/bash pcpatch
fi
if [ -z "`getent group opsiadmin`" ]; then
groupadd opsiadmin
fi
chown -R root:$fileadmingroup /etc/opsi/backendManager
find /etc/opsi/backendManager -type d -exec chmod 770 {} \;
find /etc/opsi/backendManager -type f -exec chmod 660 {} \;
chown -R root:$fileadmingroup /etc/opsi/backends
chmod 770 /etc/opsi/backends
chmod 660 /etc/opsi/backends/*.conf
chown root:$fileadmingroup /etc/opsi/opsi.conf
chmod 660 /etc/opsi/opsi.conf
test -e /etc/opsi/pckeys || touch /etc/opsi/pckeys
chown root:$fileadmingroup /etc/opsi/pckeys
chmod 660 /etc/opsi/pckeys
test -e /etc/opsi/passwd || touch /etc/opsi/passwd
chown root:$fileadmingroup /etc/opsi/passwd
chmod 660 /etc/opsi/passwd
[ -e "/etc/opsi/backendManager/acl.conf" ] || ln -s /etc/opsi/backendManager/acl.conf.default /etc/opsi/backendManager/acl.conf
[ -e "/etc/opsi/backendManager/dispatch.conf" ] || ln -s /etc/opsi/backendManager/dispatch.conf.default /etc/opsi/backendManager/dispatch.conf
}