From b257abb63fa747d830f0cdb2f7cdb9e43a248f13 Mon Sep 17 00:00:00 2001 From: asandikci Date: Wed, 23 Aug 2023 22:54:49 +0300 Subject: [PATCH] update deb packaging --- Makefile | 42 ++++++++++++++++++++++-------------------- debian/control | 3 ++- debian/rules | 6 ++---- 3 files changed, 26 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index b9f4c7a..b517440 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,22 @@ -REPO_NAME="ahenk-go" -REPO_LINK="https://git.aliberksandikci.com.tr/liderahenk/${REPO_NAME}" +REPO_NAME=ahenk-go +REPO_LINK=https://git.aliberksandikci.com.tr/liderahenk/${REPO_NAME} -DAEMON_NAME="ahenk-go" -OLD_DAEMON_NAME="ahenkd-go" -PYTHON_DAEMON_NAME="ahenkd" +DAEMON_NAME=ahenk-go +OLD_DAEMON_NAME=ahenkd-go +PYTHON_DAEMON_NAME=ahenkd -CONF_DIR="/etc/ahenk-go/" -TEMP_DIR="$(mktemp -d)" -MAIN_DIR="${TEMP_DIR}/${REPO_NAME}/" +DATA_DIR=/etc/ahenk-go/ +LIB_DIR=/usr/share/ahenk-go/ +PLUGIN_DIR=${LIB_DIR}/plugins/ +TEMP_DIR=$(mktemp -d) +MAIN_DIR=${TEMP_DIR}/${REPO_NAME}/ info: @echo "Made by Aliberk Sandıkçı - 2023" @echo "preclean: for cleaning old files, configurations" @echo "TODO test: Test go files" - @echo "install: Build and install ahenk-go" - @echo "TODO uninstall: Uninstall ahenk-go" - @echo "TODO clean: for postclean" + @echo "install: Build and install ahenk-go to DESTDIR" + @echo "uninstall: Uninstall ahenk-go from DESTDIR" preclean: sudo rm -rf /usr/bin/$(DAEMON_NAME) @@ -29,21 +30,22 @@ preclean: @# TODO @# echo -e "Do you want to remove python implementation of ahenk if installed in system?" - # read -rp "(Y/N) " input + @# read -rp "(Y/N) " input @pgrep -x ${PYTHON_DAEMON_NAME} && (sudo killall "${PYTHON_DAEMON_NAME}" || sudo systemctl disable "${PYTHON_DAEMON_NAME}" || sudo systemctl stop "${PYTHON_DAEMON_NAME}") || echo "no ${PYTHON_DAEMON_NAME} found" sudo systemctl daemon-reload - sudo rm -rf ${CONF_DIR} + sudo rm -rf ${DATA_DIR} @echo -e "PRE-CLENING DONE\n" test: - + @echo -e "Testing go files not implemented yet!" install: - go build -o ${DESTDIR}/usr/bin/${REPO_NAME} ./cmd/ahenk-go/ - @sudo mkdir -p "${CONF_DIR}" + sudo go build -o ${DESTDIR}/usr/bin/${REPO_NAME} ./cmd/ahenk-go/ + @sudo mkdir -p "${DESTDIR}/${LIB_DIR}" + @sudo mkdir -p "${DESTDIR}/${PLUGIN_DIR}" + + sudo go build -buildmode=plugin -o ${DESTDIR}/${PLUGIN_DIR}/resources.so ./plugins/resources + @sudo mkdir -p "${DESTDIR}/${DATA_DIR}" uninstall: - - -clean: #postclean: - + @sudo rm -rf ${DESTDIR}/usr/bin/${REPO_NAME} diff --git a/debian/control b/debian/control index 4dd4456..e1a75f9 100644 --- a/debian/control +++ b/debian/control @@ -4,7 +4,8 @@ Uploaders: Aliberk Sandıkçı Section: utils Testsuite: autopkgtest-pkg-go Priority: optional -Build-Depends: debhelper-compat (= 13), +Build-Depends: debhelper (>= 13), + debhelper-compat (= 10), dh-golang, golang-any, golang-github-sevlyar-go-daemon-dev, diff --git a/debian/rules b/debian/rules index 954662b..b61fdd4 100644 --- a/debian/rules +++ b/debian/rules @@ -1,10 +1,8 @@ #!/usr/bin/make -f %: - dh $@ --builddirectory=_build --buildsystem=golang --with=golang + dh $@ override_dh_auto_install: - dh_auto_install -- --no-source - # dh_systemd_enable || true - # dh_systemd_start || true + dh_auto_install dh_installsystemd