GARNAME = sabayon
GARVERSION = 2.22.0
CATEGORIES = admin
DISTFILES = $(GARNAME)-$(GARVERSION).tar.bz2
PATCHFILES = make-uninstall-fixes.diff

LIBDEPS = platform/gnome-vfs platform/GConf bindings/gnome-python bootstrap/gamin

DESCRIPTION = sabayon
define BLURB
Sabayon is a system administration tool to manage GNOME desktop settings. Sabayon provides a 
sane way to edit GConf defaults and GConf mandatory keys: the same way you edit your desktop. 
Sabayon launches profiles in an Xnest window. Any changes you make in the Xnest window are 
saved back to the profile file, which can then be applied to user's accounts.
endef

CONFIGURE_SCRIPTS = $(WORKSRC)/configure
BUILD_SCRIPTS = $(WORKSRC)/Makefile
INSTALL_SCRIPTS = $(WORKSRC)/Makefile

CONFIGURE_ARGS = $(DIRPATHS)

# [hack] must manually set distro style to one of redhat, debian, slackware, or gentoo 
CONFIGURE_ARGS += --with-distro=redhat

include ../category.mk

post-install:
	@echo " ==> Creating runtime shell scripts..."
	@rm -f $(bindir)/garnome_env $(sbindir)/sabayon-bin $(sbindir)/sabayon-apply-bin \
	       $(libexecdir)/sabayon-session-bin
	@sed -e 's?%prefix%?$(prefix)?' $(FILEDIR)/garnome_env.in > $(DOWNLOADDIR)/garnome_env
	@sed -e 's?%bindir%?$(bindir)?' $(FILEDIR)/sabayon.in > $(DOWNLOADDIR)/sabayon
	@sed -e 's?%bindir%?$(bindir)?' $(FILEDIR)/sabayon-apply.in > $(DOWNLOADDIR)/sabayon-apply
	@sed -e 's?%bindir%?$(bindir)?' $(FILEDIR)/sabayon-session.in > $(DOWNLOADDIR)/sabayon-session
	@chmod +x $(DOWNLOADDIR)/garnome_env $(DOWNLOADDIR)/sabayon \
	          $(DOWNLOADDIR)/sabayon-apply $(DOWNLOADDIR)/sabayon-session
	@echo " ==> Moving runtime scripts into place..."
	@cp -f $(DOWNLOADDIR)/garnome_env $(bindir)
	@mv -f $(sbindir)/sabayon $(sbindir)/sabayon-bin
	@cp -f $(DOWNLOADDIR)/sabayon $(sbindir)
	@mv -f $(sbindir)/sabayon-apply $(sbindir)/sabayon-apply-bin
	@cp -f $(DOWNLOADDIR)/sabayon-apply $(sbindir)
	@mv -f $(libexecdir)/sabayon-session $(libexecdir)/sabayon-session-bin
	@cp -f $(DOWNLOADDIR)/sabayon-session $(libexecdir)
	@echo "Done."
	@echo "GARNOME will *not* install files into system directories."
	@echo "To complete installation two soft links must be created: "
	@echo "  ln -s $(sysconfdir)/pam.d/sabayon /etc/pam.d"
	@echo "  ln -s $(sysconfdir)/X11/xinit/xinitrc.d/sabayon-xinitrc.sh /etc/X11/xinit/xinitrc.d/"
	@$(MAKECOOKIE)

uninstall:
	@rm -f $(bindir)/garnome_env $(sbindir)/sabayon-bin $(sbindir)/sabayon-apply-bin \
	       $(libexecdir)/sabayon-session-bin
	@$(MAKE) -C $(WORKSRC) uninstall
	@rm -rf $(COOKIEDIR)/install* $(COOKIEDIR)/*-install

