#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1


%:
	dh $@ --with modaliases

current_dir=$(shell pwd)
override_dh_auto_configure:
	mkdir "$(current_dir)/debian/temp"
	tar -zxvf sar_config_files.tar.gz -C "$(current_dir)/debian/temp"

override_dh_installsystemd:
	dh_installsystemd -p lenovo-wwan-unlock lenovo-cfgservice.service
	dh_installsystemd -p lenovo-wwan-unlock lenovo-fccunlock.service --no-enable --no-start

execute_after_dh_install:
	install -m 0644 -D debian/opt.fcc_lenovo.configservice_lenovo -t debian/lenovo-wwan-unlock/etc/apparmor.d
	install -m 0644 -D debian/opt.fcc_lenovo.DPR_Fcc_unlock_service -t debian/lenovo-wwan-unlock/etc/apparmor.d
	dh_apparmor --profile-name=opt.fcc_lenovo.configservice_lenovo -p lenovo-wwan-unlock
	dh_apparmor --profile-name=opt.fcc_lenovo.DPR_Fcc_unlock_service -p lenovo-wwan-unlock

override_dh_auto_clean:
	dh_auto_clean
	rm -rf "$(current_dir)/debian/temp"
