# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: target/mnemosyne/parse-config
# Copyright (C) 2006 - 2008 The OpenSDE Project
# Copyright (C) 2002 - 2006 Alejandro Mery
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---

mnemosynedir=$base/target/$SDECFG_TRG_MNEMOSYNE
# tweak config
[ ! -f $mnemosynedir/pkg_conf/$pkg.conf ] || . $mnemosynedir/pkg_conf/$pkg.conf
# append patches
[ ! -f $mnemosynedir/pkg_patch/$pkg.patch ] || var_append patchfiles ' ' $mnemosynedir/pkg_patch/$pkg.patch
unset mnemosynedir

# postinstall extra hackery
hook_add postinstall 5 'mnemosyne_postinstall'
mnemosyne_postinstall() {
	local x=
	case "$pkg" in
		socklog)	
			# socklog services active by default
			for x in klog syslog; do		
				ln -svnf $sysconfdir/$x $root/service/$x
			done
			;;
		bcron)
			# bcron services active by default
			for x in bcron-scheduler bcron-spooler bcron-updater; do
				ln -svnf $sysconfdir/$x $root/service/$x
			done
			;;
		alsa-utils)
			# alsa configuration save/restore
			ln -svnf /sbin/init.d/alsa "$root/etc/runit/1.d/20alsa"
			ln -svnf /sbin/init.d/alsa "$root/etc/runit/3.d/80alsa"
			;;
		kbd)
			# keyboard mappings
			ln -svnf /sbin/init.d/kbd "$root/etc/runit/1.d/05kbd"
			;;
		rocknet|etcnet)
			# network
			ln -svnf /sbin/init.d/network "$root/etc/runit/1.d/15network"
			;;
	esac
}

if [ "$SDECFG_TRG_MNEMOSYNE_DOC" == "minimal" ]; then
        echo_status "Just minimal documentation files will be flisted"
        mnemosyne_flist_just_minimal_docs() {
                sed -i	-e '/\.\(html\|pdf\|ps\|tex\)$/d;' \
			-e '/\.\(gif\|jpg\|png\)$/d;' \
			-e "/.*\/share\/\(doc\|gtk-doc\).*\/html\/.*/d;" \
			$builddir/flist.txt
	}
	hook_add postflist 5 "mnemosyne_flist_just_minimal_docs"
fi