#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
	dh $@ --with python2
override_dh_install:
	dh_install
	# Remove old translations
	rm -rf $(CURDIR)/debian/prey/usr/lib/prey/lang/old

override_dh_fixperms:
	# Fix permissions of scripts in /usr/lib/prey
	cd $(CURDIR)/debian/prey/usr/lib/prey &&\
	chmod +x \
		core/* \
		platform/linux/functions \
		platform/linux/settings
	# Fix permissions of the modules installed in /var/lib/prey/modules
	find $(CURDIR)/debian/prey/var/lib/prey/modules -type f | xargs chmod 744
	# Disable 'secure' module, user needs to activate it by hand.
	chmod 644 $(CURDIR)/debian/prey/var/lib/prey/modules/secure/core/run
	# Misc
	find $(CURDIR)/debian/prey/*/lib/prey -regextype posix-extended \
		-regex ".*(mp3|png|ico|version)" | xargs chmod -x
	chmod -x $(CURDIR)/debian/prey/usr/share/prey/pixmaps/prey.ico
	dh_fixperms

override_dh_installchangelogs:
	dh_installchangelogs debian/changelog.upstream


# Move to the sources root before running this.
get-orig-source:
	uscan --force-download --repack --rename
