
VERSION_MAJOR = 1
VERSION_MINOR = 37

VERSION=$(VERSION_MAJOR).$(VERSION_MINOR)
cvs_ver=HOTPLUG-$(VERSION_MAJOR)-$(VERSION_MINOR)

ipkg::
	mkdir -p ipkg/etc/hotplug ipkg/etc/suspend-scripts ipkg/etc/resume-scripts
	mkdir -p ipkg/etc/init.d  ipkg/etc/sysconfig
	mkdir -p ipkg/sbin
	cp sbin/hotplug ipkg/sbin
	cp sbin/pm_helper ipkg/sbin
	cp etc/hotplug/hotplug.functions etc/hotplug/*.agent etc/hotplug/blacklist ipkg/etc/hotplug
	chmod agu+rx ipkg/etc/hotplug/*.agent
	cp etc/hotplug/sleeve.rc ipkg/etc/hotplug
	cp etc/init.d/hotplug ipkg/etc/init.d
	cp etc/resume-scripts/[RS]* ipkg/etc/resume-scripts 
	cp etc/suspend-scripts/[RS]* ipkg/etc/suspend-scripts
	cp etc/sysconfig/hotplug ipkg/etc/sysconfig

	echo "Package: hotplug" > control
	echo "Section: base" >> control
	echo "Priority: required" >> control
	echo "Version: " ${VERSION} >> control
	echo "Architecture: all" >> control
	echo "Maintainer: Jamey Hicks <jamey.hicks@hp.com>" >> control
	echo "Depends:" >> control
	echo "Source: http://www.handhelds.org/packages/hotplug/hotplug-"${VERSION}".tar.gz" >> control
	echo "Description: Hotplug add/removal scripts for iPAQ handhelds" >> control
	echo "#!/bin/sh" > postinst
	echo "rm -f /etc/rc2.d/S20hotplug" >> postinst
	chmod agu+rx postinst
	mkdir -p ipkg/CONTROL; mv control postinst ipkg/CONTROL
	cp conffiles ipkg/CONTROL
	ipkg-build -o root -g root ipkg
	rm -fr ipkg

.PHONY : tagver

tagver:
	cvs tag ${cvs_ver}
