Skip to content

Commit

Permalink
[Build] Creating a new recipe to uninstall binaries
Browse files Browse the repository at this point in the history
* DKMS, CKMS are now using default extra modules directories
  • Loading branch information
cyring committed Nov 18, 2023
1 parent 4fb0c0d commit 3512685
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 15 deletions.
47 changes: 42 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ CC ?= cc
WARNING = -Wall -Wfatal-errors -Wno-unused-variable
SYMLINK ?= ln -s
INSTALL ?= install
DEPMOD ?= depmod
MKDIR ?= mkdir
RMDIR ?= rmdir
RM ?= rm -f
PWD ?= $(shell pwd)
BUILD ?= build
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
KERNELREL ?= /lib/modules/$(shell uname -r)
KERNELDIR ?= $(KERNELREL)/build
PREFIX ?= /usr
UBENCH = 0
CORE_COUNT ?= 256
Expand Down Expand Up @@ -113,12 +115,47 @@ prepare:
$(BUILD)/module/corefreqk.c; \
fi

.PHONY: uninstall
uninstall:
@if [ -e $(PREFIX)/bin/corefreq-cli ]; then \
$(RM) $(PREFIX)/bin/corefreq-cli; \
fi
@if [ -e $(PREFIX)/bin/corefreqd ]; then \
$(RM) $(PREFIX)/bin/corefreqd; \
fi
@if [ -e $(PREFIX)/lib/systemd/system/corefreqd.service ]; then \
$(RM) $(PREFIX)/lib/systemd/system/corefreqd.service; \
fi
@MCNT=0; \
for MDIR in updates extra ; do \
if [ -d $(KERNELREL)/$${MDIR} ]; then \
for MEXT in ko ko.gz ko.xz ko.zst ; do \
MFILE=$(KERNELREL)/$${MDIR}/corefreqk.$${MEXT}; \
if [ -e $${MFILE} ]; then \
$(RM) $${MFILE}; \
if [ $$? -eq 0 ]; then \
MCNT=$$((MCNT + 1)); \
fi \
fi \
done \
fi \
done; \
if [ $${MCNT} -ge 1 ]; then \
$(DEPMOD) -a; \
fi

.PHONY: install
install: module-install
$(INSTALL) -Dm 0755 $(BUILD)/corefreq-cli $(BUILD)/corefreqd \
-t $(PREFIX)/bin
$(INSTALL) -Dm 0644 corefreqd.service \
$(PREFIX)/lib/systemd/system/corefreqd.service
@if [ -e $(BUILD)/corefreq-cli ]; then \
$(INSTALL) -m 0755 $(BUILD)/corefreq-cli $(PREFIX)/bin; \
fi
@if [ -e $(BUILD)/corefreqd ]; then \
$(INSTALL) -m 0755 $(BUILD)/corefreqd $(PREFIX)/bin; \
fi
@if [ -d $(PREFIX)/lib/systemd/system ]; then \
$(INSTALL) -m 0644 corefreqd.service \
$(PREFIX)/lib/systemd/system; \
fi

.PHONY: module-install
module-install:
Expand Down
4 changes: 2 additions & 2 deletions ckms.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
#
[general]
name = corefreqk
version = 1.97.0
version = 1.97
strip = yes
make = gmake
initramfs = no
[hooks]
build = ${MAKE} ${CKMS_MAKE_ARGS}
[module.corefreqk]
path = build
dest = kernel/drivers/misc
dest = extra
16 changes: 9 additions & 7 deletions dkms.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,27 @@
# Licenses: GPL2
#
AUTOINSTALL="yes"
REMAKE_INITRD="no"
DRV_PATH=/kernel/drivers/misc
## REMAKE_INITRD="no"
DRV_PATH=/updates
DRV_VERSION=1.97
PACKAGE_NAME="corefreqk"
PACKAGE_VERSION="$DRV_VERSION"
BUILT_MODULE_NAME[0]="corefreqk"
BUILT_MODULE_LOCATION[0]="build/"
DEST_MODULE_LOCATION[0]="$DRV_PATH"
CLEAN="make -C $source_tree/$PACKAGE_NAME-$PACKAGE_VERSION KERNELDIR=$kernel_source_dir clean"
# CLEAN="make -C $source_tree/$PACKAGE_NAME-$PACKAGE_VERSION KERNELDIR=$kernel_source_dir clean"
MAKE[0]="make -C $source_tree/$PACKAGE_NAME-$PACKAGE_VERSION KERNELDIR=$kernel_source_dir"
#
DAEMON="\$source_tree/\$PACKAGE_NAME-\$PACKAGE_VERSION/corefreqd"
CLIENT="\$source_tree/\$PACKAGE_NAME-\$PACKAGE_VERSION/corefreq-cli"
DAEMON="\$source_tree/\$PACKAGE_NAME-\$PACKAGE_VERSION/build/corefreqd"
CLIENT="\$source_tree/\$PACKAGE_NAME-\$PACKAGE_VERSION/build/corefreq-cli"
SCRIPT="scripter.sh"
COMMAND="install -Dm 0755 -s -t /bin"
OBJECTS="\$source_tree/\$PACKAGE_NAME-\$PACKAGE_VERSION/*.o"
OBJECTS="\$source_tree/\$PACKAGE_NAME-\$PACKAGE_VERSION/build/*.o"
BINARIES="/bin/corefreqd /bin/corefreq-cli"
CLEANUP="rm -f"
#
POST_BUILD="$SCRIPT $COMMAND -- $DAEMON $CLIENT"
POST_INSTALL="$SCRIPT $CLEANUP -- $OBJECTS"
POST_REMOVE="$SCRIPT $CLEANUP -- $BINARIES"
#
PRE_BUILD="$SCRIPT make -- prepare"
PRE_INSTALL="$SCRIPT $COMMAND -- $DAEMON $CLIENT"
2 changes: 1 addition & 1 deletion x86_64/corefreqk.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Copyright (C) 2015-2023 CYRIL COURTIAT
* Licenses: GPL2
*
* Infliximab [11.17.2023]
* Vedolizumab [05.25.2023]
* First injection
*
* CYRIL INGENIERIE[11.30.2022]
* Company closed down
Expand Down

0 comments on commit 3512685

Please sign in to comment.