# Variablen JAR_SOURCE=build/libs/CampOrganizer2.jar DEPLOY_DIR=debian-deploy PACKAGE_NAME=camporganizer.deb .PHONY: all deb clean all: deb deb: @echo "get version..." $(eval VERSION := $(shell ./gradlew properties -q | grep '^version:' | awk '{print $$2}')) @echo "found version ${VERSION}" @echo "Starting Gradle-Build..." ./gradlew clean bootJar @echo "prepare package structure..." mkdir -p $(DEPLOY_DIR)/opt/camporganizer cp $(JAR_SOURCE) $(DEPLOY_DIR)/opt/camporganizer/CampOrganizer2.jar chmod 755 $(DEPLOY_DIR)/DEBIAN/postinst chmod 755 $(DEPLOY_DIR)/DEBIAN/postrm @echo "Generiere finale DEBIAN/control Datei mit Version $(VERSION)..." sed "s/__VERSION__/$(VERSION)/g" $(DEPLOY_DIR)/DEBIAN/control.template > $(DEPLOY_DIR)/DEBIAN/control @echo "Building Debian package..." dpkg-deb --root-owner-group --build $(DEPLOY_DIR) $(PACKAGE_NAME) @echo "Done! Package created: $(PACKAGE_NAME)" clean: @echo "Cleaning up..." rm -rf $(DEPLOY_DIR)/opt/ rm -f $(DEPLOY_DIR)/DEBIAN/control rm -f $(PACKAGE_NAME) ./gradlew clean