#!/usr/bin/make -f

DEB_PYTHON2_MODULE_PACKAGES=system-config-samba
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/makefile.mk

DEB_MAKE_INSTALL_TARGET	:= install DESTDIR=$(CURDIR)/debian/tmp/
DEB_MAKE_CLEAN_TARGET	:= clean
# for CDBS rules files
DEB_DH_BUILDDEB_ARGS = -- -Z xz

clean::
	make -C po clean

binary-install/system-config-samba::
	dh_python2
	dh_desktop
	dh_icons

install/system-config-samba::
	rm debian/tmp/usr/bin/system-config-samba
	rmdir debian/tmp/usr/bin
	install -d debian/tmp/usr/sbin/
	ln -s /usr/share/system-config-samba/system-config-samba.py debian/tmp/usr/sbin/system-config-samba

# Temporary rule until the author starts being more "upstream"-ish and publishes the tarballs directly
get-orig-source::
	test -f system-config-samba.spec && mv system-config-samba.spec system-config-samba.spec.tmp

	wget http://koji.fedoraproject.org/packages/system-config-samba/1.2.63/1.fc9/src/system-config-samba-1.2.63-1.fc9.src.rpm
	rpm2cpio *.src.rpm | cpio -i
	bunzip2 -c system-config-samba-*.tar.bz2 | gzip -c > `basename system-config-samba*.bz2 .bz2`.gz
	rm system-config-samba-*.src.rpm system-config-samba-*.bz2 system-config-samba.spec

	test -f system-config-samba.spec.tmp && mv system-config-samba.spec.tmp system-config-samba.spec

