1
0

rewrite scripts

try to provide better syntax and avoid using bash
This commit is contained in:
Konstantin Demin 2024-10-29 05:12:06 +03:00
parent 1e13062902
commit eb2bdc81cb
24 changed files with 363 additions and 247 deletions

15
debian/bin/no-depmod vendored
View File

@ -6,13 +6,20 @@ set -e
# postinst, we do not need or want to package the files that it # postinst, we do not need or want to package the files that it
# generates. # generates.
if [ "x$1" = x-V ]; then case "$1" in
-V )
# Satisfy version test # Satisfy version test
echo 'not really module-init-tools' echo 'not really module-init-tools'
elif [ "x$1" = x-b -a "${2%/depmod.??????}" != "$2" ]; then exit
;;
-b )
if [ "${2%/depmod.??????}" != "$2" ] ; then
# Satisfy test of short kernel versions # Satisfy test of short kernel versions
mkdir -p "$2/lib/modules/$3" mkdir -p "$2/lib/modules/$3"
touch "$2/lib/modules/$3/modules.dep" touch "$2/lib/modules/$3/modules.dep"
else exit
echo 'skipping depmod'
fi fi
;;
esac
echo 'skipping depmod'

View File

@ -1,8 +1,12 @@
#!/bin/sh #!/bin/sh
set -e set -e
if [ "$1" = "configure" ]; then have_systemd=1
if [ -d /run/systemd/system ]; then [ -d /run/systemd/system ] || have_systemd=0
case "$1" in
configure )
if [ ${have_systemd} = 1 ] ; then
if [ -z "$2" ] ; then if [ -z "$2" ] ; then
# On initial install make sure udev notifies systemd # On initial install make sure udev notifies systemd
udevadm trigger || true udevadm trigger || true
@ -11,7 +15,10 @@ if [ "$1" = "configure" ]; then
systemctl try-restart hv-kvp-daemon.service hv-vss-daemon.service systemctl try-restart hv-kvp-daemon.service hv-vss-daemon.service
fi fi
fi fi
fi ;;
esac
unset have_systemd
#DEBHELPER# #DEBHELPER#

View File

@ -1,20 +1,29 @@
#!/bin/sh #!/bin/sh
set -e set -e
if [ "$1" = "upgrade" ]; then have_systemd=1
[ -d /run/systemd/system ] || have_systemd=0
case "$1" in
upgrade )
services='kvp vss' services='kvp vss'
if dpkg --compare-versions "$2" lt 6.10~rc6-1~exp1; then if dpkg --compare-versions "$2" lt '6.10~rc6-1~exp1' ; then
services="fcopy $services" services="fcopy ${services}"
fi fi
for i in $services; do for i in ${services} ; do
if [ -d /run/systemd/system ]; then init_service="hyperv-daemons.hv-$i-daemon"
systemctl stop hyperv-daemons.hv-$i-daemon.service 2>/dev/null || true systemd_unit="${init_service}.service"
fi if [ ${have_systemd} = 1 ] ; then
deb-systemd-helper purge hyperv-daemons.hv-$i-daemon.service || true systemctl stop "${systemd_unit}" 2>/dev/null || true
invoke-rc.d --skip-systemd-native hyperv-daemons.hv-$i-daemon stop || true
update-rc.d hyperv-daemons.hv-$i-daemon remove || true
done
fi fi
deb-systemd-helper purge "${systemd_unit}" || true
invoke-rc.d --skip-systemd-native "${init_service}" stop || true
update-rc.d "${init_service}" remove || true
done ; unset services i init_service systemd_unit
;;
esac
unset have_systemd
#DEBHELPER# #DEBHELPER#

View File

@ -2,10 +2,11 @@
set -e set -e
old_version_suffix="$(echo "$2" | sed -rn 's/^([0-9]+\.[0-9]+).*/\1/p')" old_version_suffix=$(printf '%s' "$2" | sed -En 's/^([0-9]+\.[0-9]+).*/\1/p')
if [ "$old_version_suffix" ]; then if [ -n "${old_version_suffix}" ] ; then
dpkg-maintscript-helper symlink_to_dir \ dpkg-maintscript-helper symlink_to_dir \
/usr/share/doc/linux-perf "linux-perf-${old_version_suffix}" 5.16\~rc8-1\~exp1 linux-perf -- "$@" /usr/share/doc/linux-perf "linux-perf-${old_version_suffix}" '5.16~rc8-1~exp1' linux-perf -- "$@"
fi fi
unset old_version_suffix
#DEBHELPER# #DEBHELPER#

View File

@ -2,21 +2,24 @@
set -e set -e
old_version_suffix="$(echo "$2" | sed -rn 's/^([0-9]+\.[0-9]+).*/\1/p')" old_version_suffix=$(printf '%s' "$2" | sed -En 's/^([0-9]+\.[0-9]+).*/\1/p')
if [ "$old_version_suffix" ]; then if [ -n "${old_version_suffix}" ] ; then
dpkg-maintscript-helper symlink_to_dir \ dpkg-maintscript-helper symlink_to_dir \
/usr/share/doc/linux-perf "linux-perf-${old_version_suffix}" 5.16\~rc8-1\~exp1 linux-perf -- "$@" /usr/share/doc/linux-perf "linux-perf-${old_version_suffix}" '5.16~rc8-1~exp1' linux-perf -- "$@"
fi fi
unset old_version_suffix
if [ "$1" = remove ] case "$1" in
then remove )
for wrapper in /usr/bin/perf \ for wrapper in \
/usr/bin/perf \
/usr/share/bash-completion/completions/perf \ /usr/share/bash-completion/completions/perf \
/usr/share/man/man1/perf.1.gz; do /usr/share/man/man1/perf.1.gz \
; do
diversion="${wrapper%/perf*}/perf.wrapper${wrapper#*/perf}" diversion="${wrapper%/perf*}/perf.wrapper${wrapper#*/perf}"
dpkg-divert --package linux-perf --divert "$diversion" --rename \ dpkg-divert --package linux-perf --divert "${diversion}" --rename --remove "${wrapper}"
--remove "$wrapper" done ; unset wrapper diversion
done ;;
fi esac
#DEBHELPER# #DEBHELPER#

View File

@ -2,21 +2,24 @@
set -e set -e
old_version_suffix="$(echo "$2" | sed -rn 's/^([0-9]+\.[0-9]+).*/\1/p')" old_version_suffix=$(printf '%s' "$2" | sed -En 's/^([0-9]+\.[0-9]+).*/\1/p')
if [ "$old_version_suffix" ]; then if [ -n "${old_version_suffix}" ] ; then
dpkg-maintscript-helper symlink_to_dir \ dpkg-maintscript-helper symlink_to_dir \
/usr/share/doc/linux-perf "linux-perf-${old_version_suffix}" 5.16\~rc8-1\~exp1 linux-perf -- "$@" /usr/share/doc/linux-perf "linux-perf-${old_version_suffix}" '5.16~rc8-1~exp1' linux-perf -- "$@"
fi fi
unset old_version_suffix
if [ "$1" = install ] || [ "$1" = upgrade ] case "$1" in
then install | upgrade )
for wrapper in /usr/bin/perf \ for wrapper in \
/usr/bin/perf \
/usr/share/bash-completion/completions/perf \ /usr/share/bash-completion/completions/perf \
/usr/share/man/man1/perf.1.gz; do /usr/share/man/man1/perf.1.gz \
; do
diversion="${wrapper%/perf*}/perf.wrapper${wrapper#*/perf}" diversion="${wrapper%/perf*}/perf.wrapper${wrapper#*/perf}"
dpkg-divert --package linux-perf --divert "$diversion" --rename \ dpkg-divert --package linux-perf --divert "${diversion}" --rename --add "${wrapper}"
--add "$wrapper" done ; unset wrapper diversion
done ;;
fi esac
#DEBHELPER# #DEBHELPER#

View File

@ -2,10 +2,11 @@
set -e set -e
old_version_suffix="$(echo "$2" | sed -rn 's/^([0-9]+\.[0-9]+).*/\1/p')" old_version_suffix=$(printf '%s' "$2" | sed -En 's/^([0-9]+\.[0-9]+).*/\1/p')
if [ "$old_version_suffix" ]; then if [ -n "${old_version_suffix}" ] ; then
dpkg-maintscript-helper symlink_to_dir \ dpkg-maintscript-helper symlink_to_dir \
/usr/share/doc/linux-perf "linux-perf-${old_version_suffix}" 5.16\~rc8-1\~exp1 linux-perf -- "$@" /usr/share/doc/linux-perf "linux-perf-${old_version_suffix}" '5.16~rc8-1~exp1' linux-perf -- "$@"
fi fi
unset old_version_suffix
#DEBHELPER# #DEBHELPER#

10
debian/rules vendored
View File

@ -5,8 +5,6 @@ include /usr/share/dpkg/pkg-info.mk
DEB_VERSION_SOURCE = $(shell echo '$(DEB_VERSION)' | sed -re 's/\+b([0-9]+)$$//') DEB_VERSION_SOURCE = $(shell echo '$(DEB_VERSION)' | sed -re 's/\+b([0-9]+)$$//')
SHELL := sh -e
include debian/rules.defs include debian/rules.defs
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
@ -90,8 +88,8 @@ clean: debian/control
rm -rf $(CLEAN_PATTERNS) rm -rf $(CLEAN_PATTERNS)
dh_clean dh_clean
CONTROL_FILES = $(BUILD_DIR)/version-info $(wildcard debian/templates/*.in) CONTROL_FILES = $(BUILD_DIR)/version-info $(sort $(wildcard debian/templates/*.in))
CONTROL_FILES += debian/config/defines.toml $(wildcard debian/config/*/defines.toml) CONTROL_FILES += debian/config/defines.toml $(sort $(wildcard debian/config/*/defines.toml))
# debian/bin/gencontrol.py uses debian/changelog as input, but the # debian/bin/gencontrol.py uses debian/changelog as input, but the
# output only depends on the source name and version. To avoid # output only depends on the source name and version. To avoid
@ -100,7 +98,7 @@ CONTROL_FILES += debian/config/defines.toml $(wildcard debian/config/*/defines.t
$(BUILD_DIR)/version-info: debian/changelog $(BUILD_DIR)/version-info: debian/changelog
mkdir -p $(@D) mkdir -p $(@D)
# Use DEB_VERSION_SOURCE to allow binNMU # Use DEB_VERSION_SOURCE to allow binNMU
printf >$@ 'Source: %s\nVersion: %s\n' $(DEB_SOURCE) $(DEB_VERSION) printf >$@ 'Source: %s\nVersion: %s\n' '$(DEB_SOURCE)' '$(DEB_VERSION)'
debian/control debian/rules.gen: debian/bin/gencontrol.py $(CONTROL_FILES) debian/control debian/rules.gen: debian/bin/gencontrol.py $(CONTROL_FILES)
ifeq ($(wildcard debian/control.md5sum),) ifeq ($(wildcard debian/control.md5sum),)
@ -113,6 +111,8 @@ endif
debian/control-real: debian/bin/gencontrol.py $(CONTROL_FILES) debian/control-real: debian/bin/gencontrol.py $(CONTROL_FILES)
# Hash randomisation makes the pickled config unreproducible # Hash randomisation makes the pickled config unreproducible
PYTHONHASHSEED=0 $< PYTHONHASHSEED=0 $<
find debian/ -name __pycache__ -type d -exec rm -rf {} +
find debian/ -name '*.pyc' -type f -exec rm -f {} +
md5sum $(sort $^) > debian/control.md5sum md5sum $(sort $^) > debian/control.md5sum
@echo @echo
@echo This target is made to fail intentionally, to make sure @echo This target is made to fail intentionally, to make sure

View File

@ -25,10 +25,13 @@ install: install-local install-recursive
%-recursive: %-recursive:
+@list='$(SUBDIRS)' ; \ +@list='$(SUBDIRS)' ; \
for subdir in $$list; do \ for i in $$list ; do \
echo "Making $* in $$subdir"; \ echo "Making $* in $$i" ; \
mkdir -p $$subdir; \ mkdir -p "$$i" ; \
$(MAKE) -C $$subdir -f $(top_rulesdir)/$(OUTDIR)/$$subdir/Makefile OUTDIR=$(OUTDIR)/$$subdir $*; \ $(MAKE) -C "$$i" \
-f $(top_rulesdir)/$(OUTDIR)/$$i/Makefile \
OUTDIR=$(OUTDIR)/$$i \
$* ; \
done done
all-local: $(PROGS) all-local: $(PROGS)
@ -38,7 +41,7 @@ install-local: install-local-progs install-local-scripts install-local-data
install-local-progs: $(PROGS) install-local-progs: $(PROGS)
@for p in $^ ; do \ @for p in $^ ; do \
echo " install -m755 '$$p' '$(DESTDIR)/$(installdir)'" ; \ echo " install -m755 '$$p' '$(DESTDIR)/$(installdir)'" ; \
install -D -m755 "$$p" "$(DESTDIR)/$(installdir)/$$(basename $$p)"; \ install -D -m755 "$$p" "$(DESTDIR)/$(installdir)/$$(basename "$$p")" ; \
done done
SCRIPTS_REAL = $(wildcard $(addprefix $(top_srcdir)/$(OUTDIR)/,$(SCRIPTS))) SCRIPTS_REAL = $(wildcard $(addprefix $(top_srcdir)/$(OUTDIR)/,$(SCRIPTS)))
@ -48,7 +51,7 @@ install-local-scripts: $(SCRIPTS_REAL)
echo " install -m755 '$$p' '$(DESTDIR)/$(installdir)'" ; \ echo " install -m755 '$$p' '$(DESTDIR)/$(installdir)'" ; \
install -D -m755 \ install -D -m755 \
-s --strip-program $(top_srcdir)/debian/bin/fix-shebang \ -s --strip-program $(top_srcdir)/debian/bin/fix-shebang \
"$$p" "$(DESTDIR)/$(installdir)/$$(basename $$p)"; \ "$$p" "$(DESTDIR)/$(installdir)/$$(basename "$$p")" ; \
done done
DATA_REAL = $(wildcard $(addprefix $(top_srcdir)/$(OUTDIR)/,$(DATA))) DATA_REAL = $(wildcard $(addprefix $(top_srcdir)/$(OUTDIR)/,$(DATA)))
@ -56,6 +59,6 @@ DATA_REAL = $(wildcard $(addprefix $(top_srcdir)/$(OUTDIR)/,$(DATA)))
install-local-data: $(DATA_REAL) install-local-data: $(DATA_REAL)
@for p in $^ ; do \ @for p in $^ ; do \
echo " install -m644 '$$p' '$(DESTDIR)/$(installdir)'" ; \ echo " install -m644 '$$p' '$(DESTDIR)/$(installdir)'" ; \
install -D -m644 "$$p" "$(DESTDIR)/$(installdir)/$$(basename $$p)"; \ install -D -m644 "$$p" "$(DESTDIR)/$(installdir)/$$(basename "$$p")" ; \
done done

View File

@ -11,12 +11,17 @@ objtool.real-%:
# these on the command line to make cross-builds work. But it also # these on the command line to make cross-builds work. But it also
# builds fixdep which still needs to be native in a cross-build. Set # builds fixdep which still needs to be native in a cross-build. Set
# REALHOSTCC and REALHOSTLD variables which will be used for fixdep. # REALHOSTCC and REALHOSTLD variables which will be used for fixdep.
$(MAKE) -C $(top_srcdir)/tools/objtool O=$(CURDIR)/$* \ $(MAKE) -C $(top_srcdir)/tools/objtool \
HOSTARCH=$(KERNEL_ARCH) ARCH=$* \ O=$(CURDIR)/$* \
HOSTCC=$(CC) KBUILD_HOSTCFLAGS='$(CFLAGS) $(CPPFLAGS)' \ HOSTARCH=$(KERNEL_ARCH) \
HOSTLD=$(CROSS_COMPILE)ld KBUILD_HOSTLDFLAGS='$(LDFLAGS)' \ ARCH=$* \
HOSTCC=$(CC) \
KBUILD_HOSTCFLAGS='$(CFLAGS) $(CPPFLAGS)' \
HOSTLD=$(CROSS_COMPILE)ld \
KBUILD_HOSTLDFLAGS='$(LDFLAGS)' \
HOSTAR=$(CROSS_COMPILE)ar \ HOSTAR=$(CROSS_COMPILE)ar \
REALHOSTCC=gcc REALHOSTLD=ld \ REALHOSTCC=gcc \
REALHOSTLD=ld \
V=1 V=1
ln -f $*/objtool $@ ln -f $*/objtool $@

View File

@ -1,6 +1,6 @@
include $(top_rulesdir)/Makefile.inc include $(top_rulesdir)/Makefile.inc
MAKE_CPUPOWER := CFLAGS='$(CFLAGS) $(CPPFLAGS)' LDFLAGS='$(LDFLAGS)' $(MAKE) O=$(CURDIR) CPUFREQ_BENCH=false V=true mandir=/usr/share/man MAKE_CPUPOWER := CFLAGS='$(CFLAGS) $(CPPFLAGS)' LDFLAGS='$(LDFLAGS)' $(MAKE) -C $(top_srcdir)/tools/power/cpupower O=$(CURDIR) CPUFREQ_BENCH=false V=true mandir=/usr/share/man
MAKE_CPUPOWER += DEBUG=$(if $(filter noopt,$(DEB_BUILD_OPTIONS)),true,) MAKE_CPUPOWER += DEBUG=$(if $(filter noopt,$(DEB_BUILD_OPTIONS)),true,)
@ -12,10 +12,10 @@ MAKE_CPUPOWER += CROSS='$(CROSS_COMPILE)'
MAKE_CPUPOWER += libdir=/usr/lib/$(DEB_HOST_MULTIARCH) MAKE_CPUPOWER += libdir=/usr/lib/$(DEB_HOST_MULTIARCH)
all: all:
+$(MAKE_CPUPOWER) -C $(top_srcdir)/tools/power/cpupower +$(MAKE_CPUPOWER)
install: install:
+$(MAKE_CPUPOWER) -C $(top_srcdir)/tools/power/cpupower install DESTDIR=$(DESTDIR) +$(MAKE_CPUPOWER) install DESTDIR=$(DESTDIR)
clean: clean:
+$(MAKE_CPUPOWER) -C $(top_srcdir)/tools/power/cpupower clean +$(MAKE_CPUPOWER) clean

View File

@ -1,15 +1,15 @@
include $(top_rulesdir)/Makefile.inc include $(top_rulesdir)/Makefile.inc
# Intel Speed Select Tool (ISST) # Intel Speed Select Tool (ISST)
MAKE_ISST := CFLAGS='$(CFLAGS) $(CPPFLAGS)' LDFLAGS='$(LDFLAGS)' $(MAKE) O=$(CURDIR) MAKE_ISST := CFLAGS='$(CFLAGS) $(CPPFLAGS)' LDFLAGS='$(LDFLAGS)' $(MAKE) -C $(top_srcdir)/tools/power/x86/intel-speed-select O=$(CURDIR)
MAKE_ISST += bindir=/usr/sbin V=1 MAKE_ISST += bindir=/usr/sbin V=1
all: all:
$(MAKE_ISST) -C $(top_srcdir)/tools/power/x86/intel-speed-select $(MAKE_ISST)
install: install:
$(MAKE_ISST) -C $(top_srcdir)/tools/power/x86/intel-speed-select install DESTDIR=$(DESTDIR) $(MAKE_ISST) install DESTDIR=$(DESTDIR)
clean: clean:
$(MAKE_ISST) -C $(top_srcdir)/tools/power/x86/intel-speed-select clean $(MAKE_ISST) clean

View File

@ -4,6 +4,9 @@ installdir = /usr/sbin
include $(top_rulesdir)/Makefile.inc include $(top_rulesdir)/Makefile.inc
CPPFLAGS += -I"$(top_srcdir)/tools/include" -DMSRHEADER='"$(top_srcdir)/arch/x86/include/asm/msr-index.h"' -DINTEL_FAMILY_HEADER='"$(top_srcdir)/arch/x86/include/asm/intel-family.h"' -DBUILD_BUG_HEADER='"$(top_srcdir)/include/linux/build_bug.h"' CPPFLAGS += -I$(top_srcdir)/tools/include
CPPFLAGS += -DMSRHEADER='"$(top_srcdir)/arch/x86/include/asm/msr-index.h"'
CPPFLAGS += -DINTEL_FAMILY_HEADER='"$(top_srcdir)/arch/x86/include/asm/intel-family.h"'
CPPFLAGS += -DBUILD_BUG_HEADER='"$(top_srcdir)/include/linux/build_bug.h"'
LDLIBS += -lcap -lrt LDLIBS += -lcap -lrt

View File

@ -4,4 +4,5 @@ installdir = /usr/sbin
include $(top_rulesdir)/Makefile.inc include $(top_rulesdir)/Makefile.inc
CPPFLAGS += -I"$(top_srcdir)/tools/include" -DMSRHEADER='"$(top_srcdir)/arch/x86/include/asm/msr-index.h"' CPPFLAGS += -I$(top_srcdir)/tools/include
CPPFLAGS += -DMSRHEADER='"$(top_srcdir)/arch/x86/include/asm/msr-index.h"'

View File

@ -5,8 +5,10 @@ srcdir := $(top_srcdir)/tools/usb/usbip
# sub-make command line. # sub-make command line.
unexport MAKEFLAGS unexport MAKEFLAGS
all: export CFLAGS := $(shell dpkg-buildflags --get CFLAGS) CPPFLAGS_COMMON := -Wno-error=address-of-packed-member
all: export CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS) \
all: export CFLAGS := $(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS_COMMON)
all: export CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS) $(CPPFLAGS_COMMON) \
-isystem $(top_srcdir)/debian/build/build-tools/include -isystem $(top_srcdir)/debian/build/build-tools/include
all: export LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS) all: export LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)
all: all:

19
debian/rules.defs vendored
View File

@ -1,2 +1,21 @@
ifeq (,$(filter --no-print-directory,$(MAKEFLAGS)))
MAKEFLAGS +=--no-print-directory
endif
define flush_vars=
$(foreach _____v,$(1),$(eval unexport $(_____v)))
$(foreach _____v,$(1),$(eval override undefine $(_____v)))
endef
$(call flush_vars, LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE )
$(call flush_vars, LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS )
$(call flush_vars, LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION )
$(call flush_vars, GREP_OPTIONS POSIXLY_CORRECT )
export LC_ALL :=C.UTF-8
export LANG :=C.UTF-8
SHELL :=sh -e
BUILD_DIR = debian/build BUILD_DIR = debian/build
STAMPS_DIR = debian/stamps STAMPS_DIR = debian/stamps

138
debian/rules.real vendored
View File

@ -8,7 +8,6 @@
include /usr/share/dpkg/default.mk include /usr/share/dpkg/default.mk
SHELL := bash -e
MAINTAINER := $(shell sed -ne 's,^Maintainer: .[^<]*<\([^>]*\)>,\1,p' debian/control) MAINTAINER := $(shell sed -ne 's,^Maintainer: .[^<]*<\([^>]*\)>,\1,p' debian/control)
SOURCE_DATE_UTC_ISO := $(shell date -u -d '@$(SOURCE_DATE_EPOCH)' +%Y-%m-%d) SOURCE_DATE_UTC_ISO := $(shell date -u -d '@$(SOURCE_DATE_EPOCH)' +%Y-%m-%d)
@ -28,26 +27,27 @@ export DEB_HOST_ARCH DEB_HOST_GNU_TYPE DEB_BUILD_ARCH
export DEB_BUILD_PATH = $(CURDIR) export DEB_BUILD_PATH = $(CURDIR)
export DEB_RULES_REQUIRES_ROOT ?= no export DEB_RULES_REQUIRES_ROOT ?= no
# Set LANG rather than LC_ALL because upstream wants to override
# specific categories and may undefine LC_ALL. To ensure that the
# build environment does not affect our locale, undefine all other
# locale variables.
export LANG = C.UTF-8
$(foreach var,LC_ALL LANGUAGE LC_ADDRESS LC_COLLATE LC_CTYPE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME,$(eval undefine $(var)))
stamp = [ -d $(dir $@) ] || mkdir $(dir $@); touch $@ stamp = [ -d $(dir $@) ] || mkdir $(dir $@); touch $@
cleanup_config = sed -E -e '/CONFIG_(BUILD_SALT|MODULE_SIG_(ALL|KEY)|SYSTEM_TRUSTED_KEYS)[ =]/d'
setup_env := env -u ABINAME -u ARCH -u FEATURESET -u FLAVOUR -u VERSION -u LOCALVERSION setup_env := env -u ABINAME -u ARCH -u FEATURESET -u FLAVOUR -u VERSION -u LOCALVERSION
# XXX: All the tools leak flags between host and build all the time, just don't care. See #1050991. # XXX: All the tools leak flags between host and build all the time, just don't care. See #1050991.
setup_env += -u KBUILD_HOSTCFLAGS -u HOSTCFLAGS -u KBUILD_HOSTLDFLAGS setup_env += -u KBUILD_HOSTCFLAGS -u HOSTCFLAGS -u KBUILD_HOSTLDFLAGS
setup_env += DISTRIBUTION_OFFICIAL_BUILD=1 DISTRIBUTOR="$(DEB_VENDOR)" DISTRIBUTION_VERSION="$(SOURCEVERSION)" KBUILD_BUILD_TIMESTAMP="@$(SOURCE_DATE_EPOCH)" KBUILD_BUILD_VERSION_TIMESTAMP="$(DEB_VENDOR) $(SOURCEVERSION) ($(SOURCE_DATE_UTC_ISO))" KBUILD_BUILD_USER="$(word 1,$(subst @, ,$(MAINTAINER)))" KBUILD_BUILD_HOST="$(word 2,$(subst @, ,$(MAINTAINER)))" setup_env += DISTRIBUTION_OFFICIAL_BUILD=1
setup_env += KBUILD_VERBOSE=1 setup_env += DISTRIBUTOR="$(DEB_VENDOR)"
setup_env += DISTRIBUTION_VERSION="$(SOURCEVERSION)"
setup_env += KBUILD_BUILD_TIMESTAMP="@$(SOURCE_DATE_EPOCH)"
setup_env += KBUILD_BUILD_VERSION_TIMESTAMP="$(DEB_VENDOR) $(SOURCEVERSION) ($(SOURCE_DATE_UTC_ISO))"
setup_env += KBUILD_BUILD_USER="$(word 1,$(subst @, ,$(MAINTAINER)))"
setup_env += KBUILD_BUILD_HOST="$(word 2,$(subst @, ,$(MAINTAINER)))"
setup_env += KBUILD_VERBOSE=$(if $(filter verbose,$(DEB_BUILD_OPTIONS)),1,0)
MAKE_CLEAN = $(setup_env) $(MAKE) KCFLAGS=-fdebug-prefix-map=$(CURDIR)/= KAFLAGS=-fdebug-prefix-map=$(CURDIR)/= MAKE_CLEAN = $(setup_env) $(MAKE) KCFLAGS=-fdebug-prefix-map=$(CURDIR)/= KAFLAGS=-fdebug-prefix-map=$(CURDIR)/=
MAKE_SELF := $(MAKE) -f debian/rules.real $(MAKEOVERRIDES) MAKE_SELF := $(MAKE) -f debian/rules.real $(MAKEOVERRIDES)
MAKEOVERRIDES = MAKEOVERRIDES =
BUILDDEB_ARGS := -Zxz $(if $(filter pkg.linux.quick,$(DEB_BUILD_PROFILES)),-z0) BUILDDEB_ARGS := -Zxz $(if $(filter pkg.linux.quick,$(DEB_BUILD_PROFILES)),-z1)
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
THREAD_COUNT = $(subst parallel=,,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) THREAD_COUNT = $(subst parallel=,,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
@ -83,30 +83,34 @@ $(BUILD_DIR)/$(SOURCE_BASENAME)-source-$(UPSTREAMVERSION).tar.xz: $(STAMPS_DIR)/
rm -rf '$@' '$(DIR)' rm -rf '$@' '$(DIR)'
$(call copy_source,$(DIR)) $(call copy_source,$(DIR))
chmod -R u+rw,go=rX '$(DIR)' chmod -R u+rw,go=rX '$(DIR)'
find '$(DIR)' -depth -newermt '@$(SOURCE_DATE_EPOCH)' -print0 | \ find $(DIR)/ -name __pycache__ -type d -exec rm -rf {} +
xargs -0r touch --no-dereference --date='@$(SOURCE_DATE_EPOCH)' find $(DIR)/ -name '*.pyc' -type f -exec rm -f {} +
cd '$(BUILD_DIR)'; \ find $(DIR)/ -depth -newermt '@$(SOURCE_DATE_EPOCH)' -print0 \
find '$(SOURCE_BASENAME)-source-$(UPSTREAMVERSION)' \ | xargs -0r touch --no-dereference --date='@$(SOURCE_DATE_EPOCH)'
-name '*.pyc' -prune -o \ n='$(SOURCE_BASENAME)-source-$(UPSTREAMVERSION)' ; \
-print0 | \ cd $(BUILD_DIR) ; \
sort -z | \ find $$n/ -print0 | sort -z \
tar --owner=root --group=root --numeric-owner \ | tar --owner=root --group=root --numeric-owner --no-recursion --null -T - -c \
--no-recursion --null -T - -c | xz -T$(THREAD_COUNT) > '$(SOURCE_BASENAME)-source-$(UPSTREAMVERSION).tar.xz' | xz -T$(THREAD_COUNT) > $$n.tar.xz
rm -rf '$(DIR)' rm -rf '$(DIR)'
$(BUILD_DIR)/linux-patch-$(UPSTREAMVERSION)-%.patch.xz: $(STAMPS_DIR)/source_none $(STAMPS_DIR)/source_% $(BUILD_DIR)/linux-patch-$(UPSTREAMVERSION)-%.patch.xz: $(STAMPS_DIR)/source_none $(STAMPS_DIR)/source_%
set -o pipefail; \ ( \
(cd '$(BUILD_DIR)'; \ cd '$(BUILD_DIR)' ; \
set +e ; \ set +e ; \
diff -urN -p -x debian -x .pc -x .git -x '*.pyc' source_none source_$* ; \ diff -urN -p -x debian -x .pc -x .git -x '*.pyc' source_none source_$* ; \
test $$? -eq 1) | \ test $$? -eq 1 ; \
filterdiff --remove-timestamps --strip=1 --addoldprefix=a/ --addnewprefix=b/ | \ ) \
xz -c >$@ || \ | filterdiff --remove-timestamps --strip=1 --addoldprefix=a/ --addnewprefix=b/ \
(rm -f $@; exit 1) | xz -c >$@ \
|| (rm -f $@ ; exit 1 ; )
$(STAMPS_DIR)/source: $(STAMPS_DIR)/source:
test -d .pc test -d .pc
set +e; QUILT_PC=.pc quilt unapplied --quiltrc - >/dev/null && echo 'Patch series not fully applied'; test $$? -eq 1 set +e ; \
QUILT_PC=.pc quilt unapplied --quiltrc - >/dev/null \
&& echo 'Patch series not fully applied' ; \
test $$? -eq 1
@$(stamp) @$(stamp)
$(STAMPS_DIR)/source_%: SOURCE_DIR=$(BUILD_DIR)/source $(STAMPS_DIR)/source_%: SOURCE_DIR=$(BUILD_DIR)/source
@ -115,7 +119,8 @@ $(STAMPS_DIR)/source_%: $(STAMPS_DIR)/source
mkdir -p '$(BUILD_DIR)' mkdir -p '$(BUILD_DIR)'
rm -rf '$(DIR)' rm -rf '$(DIR)'
$(call copy_source,$(DIR)) $(call copy_source,$(DIR))
cd '$(DIR)' && QUILT_PATCHES='$(CURDIR)/debian/patches-$*' QUILT_PC=.pc quilt push --quiltrc - -a -q --fuzz=0 cd '$(DIR)' \
&& QUILT_PATCHES='$(CURDIR)/debian/patches-$*' QUILT_PC=.pc quilt push --quiltrc - -a -q --fuzz=0
@$(stamp) @$(stamp)
.PRECIOUS: $(STAMPS_DIR)/source_% .PRECIOUS: $(STAMPS_DIR)/source_%
@ -235,19 +240,18 @@ binary_headers-common: DIR = $(DESTDIR)/$(BASE_DIR)
binary_headers-common: $(STAMPS_DIR)/source_$(FEATURESET) binary_headers-common: $(STAMPS_DIR)/source_$(FEATURESET)
$(dh_binary_pre) $(dh_binary_pre)
set -o pipefail; \ cd '$(SOURCE_DIR)' ; \
cd $(SOURCE_DIR); \
( \ ( \
echo Makefile ; \ echo Makefile ; \
for arch in $(ALL_KERNEL_ARCHES) ; do \ for arch in $(ALL_KERNEL_ARCHES) ; do \
find arch/$$arch -maxdepth 1 -name 'Makefile*' -print; \ find "arch/$$arch/" -maxdepth 1 -name 'Makefile*' -print ; \
find arch/$$arch \( -name 'Kbuild.platforms' -o -name 'Platform' \) -print; \ find "arch/$$arch/" \( -name 'Kbuild.platforms' -o -name 'Platform' \) -print ; \
find $$(find arch/$$arch \( -name include -o -name scripts \) -type d -print) -print; \ find $$(find "arch/$$arch/" \( -name include -o -name scripts \) -type d -printf '%p/\n') -print ; \
done ; \ done ; \
find include -print ; \ find include -print ; \
) \ ) \
| \ | sort -uV \
cpio -pd --preserve-modification-time '$(DIR)' | cpio -pd --preserve-modification-time '$(DIR)'
dh_link /usr/lib/$(PACKAGE_NAME_KBUILD)/scripts $(BASE_DIR)/scripts dh_link /usr/lib/$(PACKAGE_NAME_KBUILD)/scripts $(BASE_DIR)/scripts
dh_link /usr/lib/$(PACKAGE_NAME_KBUILD)/tools $(BASE_DIR)/tools dh_link /usr/lib/$(PACKAGE_NAME_KBUILD)/tools $(BASE_DIR)/tools
@ -268,13 +272,18 @@ binary_headers: $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
$(dh_binary_pre) $(dh_binary_pre)
mkdir -p $(DIR)/arch/$(KERNEL_ARCH)/kernel mkdir -p $(DIR)/arch/$(KERNEL_ARCH)/kernel
cp -a $(SOURCE_DIR)/{.config,.kernel*,Module.symvers,include} $(DIR) { \
cd $(SOURCE_DIR) ; \
tar -cf - .config .kernel* Module.symvers include ; \
} | tar -C $(DIR) -xf -
cp -a $(SOURCE_DIR)/arch/$(KERNEL_ARCH)/include $(DIR)/arch/$(KERNEL_ARCH) cp -a $(SOURCE_DIR)/arch/$(KERNEL_ARCH)/include $(DIR)/arch/$(KERNEL_ARCH)
find $(DIR) -name '*.cmd' -delete find $(DIR) -name '*.cmd' -delete
if [ -f $(SOURCE_DIR)/arch/$(KERNEL_ARCH)/lib/crtsavres.o ]; then \ f='$(SOURCE_DIR)/arch/$(KERNEL_ARCH)/lib/crtsavres.o' ; \
mkdir $(DIR)/arch/$(KERNEL_ARCH)/lib; \ d='$(DIR)/arch/$(KERNEL_ARCH)/lib' ; \
cp -a $(SOURCE_DIR)/arch/$(KERNEL_ARCH)/lib/crtsavres.o $(DIR)/arch/$(KERNEL_ARCH)/lib; \ if [ -f "$$f" ] ; then \
mkdir -p "$$d" ; \
cp -a "$$f" "$$d/" ; \
fi fi
cp -a $(SOURCE_DIR)/scripts/module.lds $(DIR)/arch/$(KERNEL_ARCH) cp -a $(SOURCE_DIR)/scripts/module.lds $(DIR)/arch/$(KERNEL_ARCH)
@ -310,8 +319,9 @@ binary_libc-dev: $(STAMPS_DIR)/build_libc-dev
# Generate symlink farms for every supported multiarch identifier # Generate symlink farms for every supported multiarch identifier
for spec in $(ALL_LIBCDEV_MULTIARCHES) ; do \ for spec in $(ALL_LIBCDEV_MULTIARCHES) ; do \
IFS=: read -r MULTIARCH KERNELARCH <<< "$$spec"; \ MULTIARCH=$${spec%%:*} ; \
dh_link --all $$(find $(DIR)/usr/lib/linux/uapi/$$KERNELARCH/asm -type f -name '*.h' -printf "usr/lib/linux/uapi/$$KERNELARCH/asm/%P usr/include/$$MULTIARCH/asm/%P\\n"); \ KERNELARCH=$${spec#*:} ; \
dh_link --all $$(find "$(DIR)/usr/lib/linux/uapi/$$KERNELARCH/asm/" -type f -name '*.h' -printf "usr/lib/linux/uapi/$$KERNELARCH/asm/%P usr/include/$$MULTIARCH/asm/%P\\n") ; \
done done
$(dh_binary_post) $(dh_binary_post)
@ -322,11 +332,11 @@ build_bpf-dev: $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
mkdir -p $(DIR)/tools/bpf/bpftool mkdir -p $(DIR)/tools/bpf/bpftool
+$(MAKE_CLEAN) -C '$(SOURCE_DIR)/tools/bpf/bpftool' O=$(CURDIR)/$(DIR)/tools/bpf/bpftool CROSS_COMPILE= FEATURE_TESTS= FEATURE_DISPLAY= +$(MAKE_CLEAN) -C '$(SOURCE_DIR)/tools/bpf/bpftool' O=$(CURDIR)/$(DIR)/tools/bpf/bpftool CROSS_COMPILE= FEATURE_TESTS= FEATURE_DISPLAY=
if grep -q CONFIG_DEBUG_INFO_BTF=y $(DIR)/.config; then \ if grep -Fxq CONFIG_DEBUG_INFO_BTF=y $(DIR)/.config ; then \
$(DIR)/tools/bpf/bpftool/bpftool btf dump file $(DIR)/vmlinux format c > $(DIR)/vmlinux.h; \ $(DIR)/tools/bpf/bpftool/bpftool btf dump file $(DIR)/vmlinux format c ; \
else \ else \
echo '#error "Kernel build without CONFIG_DEBUG_INFO_BTF, no type info available"' > $(DIR)/vmlinux.h; \ echo '#error "Kernel build without CONFIG_DEBUG_INFO_BTF, no type info available"' ; \
fi fi > $(DIR)/vmlinux.h
binary_bpf-dev: DH_INSTALL_ARGS = --sourcedir=$(BUILD_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR) binary_bpf-dev: DH_INSTALL_ARGS = --sourcedir=$(BUILD_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
binary_bpf-dev: build_bpf-dev binary_bpf-dev: build_bpf-dev
@ -339,7 +349,7 @@ binary_support: PACKAGE_ROOT = /usr/share/$(PACKAGE_NAME)
binary_support: binary_support:
$(dh_binary_pre) $(dh_binary_pre)
dh_installdirs $(PACKAGE_ROOT)/lib/python/debian_linux $(PACKAGE_ROOT)/modules dh_installdirs $(PACKAGE_ROOT)/lib/python/debian_linux $(PACKAGE_ROOT)/modules
cp debian/lib/python/debian_linux/*.py $(DESTDIR)$(PACKAGE_ROOT)/lib/python/debian_linux cp debian/lib/python/debian_linux/*.py $(DESTDIR)$(PACKAGE_ROOT)/lib/python/debian_linux/
dh_python3 dh_python3
dh_link $(PACKAGE_ROOT) /usr/src/$(PACKAGE_NAME) dh_link $(PACKAGE_ROOT) /usr/src/$(PACKAGE_NAME)
$(dh_binary_post) $(dh_binary_post)
@ -362,15 +372,15 @@ binary_image:
ifneq ($(filter arm64 armel armhf mipsel mips64el mipsr6 mipsr6el mips64r6 mips64r6el riscv64,$(ARCH)),) ifneq ($(filter arm64 armel armhf mipsel mips64el mipsr6 mipsr6el mips64r6 mips64r6el riscv64,$(ARCH)),)
dh_install --sourcedir=$(DIR2) usr dh_install --sourcedir=$(DIR2) usr
endif endif
sed '/CONFIG_\(MODULE_SIG_\(ALL\|KEY\)\|SYSTEM_TRUSTED_KEYS\|BUILD_SALT\)[ =]/d' $(DIR)/.config > $(DESTDIR)/boot/config-$(REAL_VERSION) $(cleanup_config) $(DIR)/.config > $(DESTDIR)/boot/config-$(REAL_VERSION)
xz -9k < $(DIR)/System.map > $(DESTDIR)/$(SYSTEM_MAP_PATH) xz -9k < $(DIR)/System.map > $(DESTDIR)/$(SYSTEM_MAP_PATH)
echo "ffffffffffffffff B The real System.map is compressed into /$(SYSTEM_MAP_PATH)" > $(DESTDIR)/boot/System.map-$(REAL_VERSION) echo "ffffffffffffffff B The real System.map is compressed into /$(SYSTEM_MAP_PATH)" > $(DESTDIR)/boot/System.map-$(REAL_VERSION)
rm $(DESTDIR)/lib/firmware -rf rm -rf $(DESTDIR)/lib/firmware
$(dh_binary_post) $(dh_binary_post)
build_source: build_source:
binary_source: BUILDDEB_ARGS = -Zxz -z0 binary_source: BUILDDEB_ARGS = -Zxz -z1
binary_source: $(BUILD_DIR)/$(SOURCE_BASENAME)-source-$(UPSTREAMVERSION).tar.xz $(foreach FEATURESET,$(filter-out none,$(ALL_FEATURESETS)),$(BUILD_DIR)/linux-patch-$(UPSTREAMVERSION)-$(FEATURESET).patch.xz) binary_source: $(BUILD_DIR)/$(SOURCE_BASENAME)-source-$(UPSTREAMVERSION).tar.xz $(foreach FEATURESET,$(filter-out none,$(ALL_FEATURESETS)),$(BUILD_DIR)/linux-patch-$(UPSTREAMVERSION)-$(FEATURESET).patch.xz)
$(dh_binary_pre) $(dh_binary_pre)
dh_install $^ /usr/src dh_install $^ /usr/src
@ -379,23 +389,35 @@ binary_source: $(BUILD_DIR)/$(SOURCE_BASENAME)-source-$(UPSTREAMVERSION).tar.xz
build_config: build_config:
binary_config: TRIPLETS = $(subst $(BUILD_DIR)/build_,,$(wildcard $(BUILD_DIR)/build_$(ARCH)_*_*)) binary_config: TRIPLETS = $(subst $(BUILD_DIR)/build_,,$(wildcard $(BUILD_DIR)/build_$(ARCH)_*_*))
binary_config: CONFDIR = usr/src/linux-config-$(UPSTREAMVERSION)
binary_config: binary_config:
$(dh_binary_pre) $(dh_binary_pre)
dh_installdirs /usr/src/linux-config-$(UPSTREAMVERSION) dh_installdirs /$(CONFDIR)
# Fix the module signing configuration to work for custom kernels. Also delete # Fix the module signing configuration to work for custom kernels. Also delete
# CONFIG_BUILD_SALT which makes no sense for custom kernels. # CONFIG_BUILD_SALT which makes no sense for custom kernels.
for triplet in $(TRIPLETS); do \ for i in $(TRIPLETS) ; do \
sed '/CONFIG_\(MODULE_SIG_\(ALL\|KEY\)\|SYSTEM_TRUSTED_KEYS\|BUILD_SALT\)[ =]/d' $(BUILD_DIR)/build_$$triplet/.config | xz -c >debian/$(PACKAGE_NAME)/usr/src/linux-config-$(UPSTREAMVERSION)/config.$$triplet.xz; \ $(cleanup_config) $(BUILD_DIR)/build_$$i/.config \
| xz -c > debian/$(PACKAGE_NAME)/$(CONFDIR)/config.$$i.xz ; \
done done
$(dh_binary_post) $(dh_binary_post)
define make-tools define make-tools
+mkdir -p $(BUILD_DIR)/build-tools/$(1) && $(MAKE_CLEAN) -C $(BUILD_DIR)/build-tools/$(1) -f $(CURDIR)/debian/rules.d/$(1)/Makefile top_srcdir=$(CURDIR) top_rulesdir=$(CURDIR)/debian/rules.d OUTDIR=$(1) VERSION=$(VERSION) KERNEL_ARCH=$(KERNEL_ARCH) +mkdir -p $(BUILD_DIR)/build-tools/$(1) \
&& $(MAKE_CLEAN) \
-C $(BUILD_DIR)/build-tools/$(1) \
-f $(CURDIR)/debian/rules.d/$(1)/Makefile \
top_srcdir=$(CURDIR) \
top_rulesdir=$(CURDIR)/debian/rules.d \
OUTDIR=$(1) \
VERSION=$(VERSION) \
KERNEL_ARCH=$(KERNEL_ARCH)
endef endef
$(STAMPS_DIR)/build-tools-headers: $(STAMPS_DIR)/build-tools-headers:
mkdir -p $(BUILD_DIR)/build-tools/headers-tools mkdir -p $(BUILD_DIR)/build-tools/headers-tools
$(MAKE) ARCH=$(KERNEL_ARCH) O=$(BUILD_DIR)/build-tools/headers-tools \ $(MAKE) \
ARCH=$(KERNEL_ARCH) \
O=$(BUILD_DIR)/build-tools/headers-tools \
INSTALL_HDR_PATH=$(CURDIR)/$(BUILD_DIR)/build-tools \ INSTALL_HDR_PATH=$(CURDIR)/$(BUILD_DIR)/build-tools \
headers_install headers_install
@$(stamp) @$(stamp)
@ -464,7 +486,7 @@ binary_perf: DH_SHLIBDEPS_ARGS = -Xperf-read-vdso
binary_perf: build_perf binary_perf: build_perf
$(dh_binary_pre) $(dh_binary_pre)
$(call make-tools,tools/perf) install $(call make-tools,tools/perf) install
# do not ship python2 script : # do not ship python2 script
rm -f $(DIR)/usr/lib/perf-core/scripts/python/call-graph-from-sql.py rm -f $(DIR)/usr/lib/perf-core/scripts/python/call-graph-from-sql.py
dh_perl /usr/lib/perf-core/scripts/perl/Perf-Trace-Util/lib/ dh_perl /usr/lib/perf-core/scripts/perl/Perf-Trace-Util/lib/
dh_python3 /usr/lib/perf-core/scripts/python/Perf-Trace-Util/lib/ dh_python3 /usr/lib/perf-core/scripts/python/Perf-Trace-Util/lib/
@ -488,10 +510,10 @@ build_hyperv-daemons: $(STAMPS_DIR)/build-tools-headers
binary_hyperv-daemons: build_hyperv-daemons binary_hyperv-daemons: build_hyperv-daemons
$(dh_binary_pre) $(dh_binary_pre)
$(call make-tools,tools/hv) install $(call make-tools,tools/hv) install
for service in kvp vss; do \ for i in kvp vss ; do \
dh_installsystemd --name hv-$$service-daemon --no-enable --no-start \ dh_installsystemd --name hv-$$i-daemon --no-enable --no-start \
|| break ; \ || break ; \
dh_installinit --name hv-$$service-daemon \ dh_installinit --name hv-$$i-daemon \
|| break ; \ || break ; \
done done
$(dh_binary_post) $(dh_binary_post)

View File

@ -8,9 +8,8 @@ $|=1;
my $version = "@abiname@@localversion@"; my $version = "@abiname@@localversion@";
if (-d "/etc/kernel/header_postinst.d") { if (-d "/etc/kernel/header_postinst.d") {
system ("run-parts --report --exit-on-error --arg=$version " . system ("run-parts --report --exit-on-error --arg=$version /etc/kernel/header_postinst.d")
"/etc/kernel/header_postinst.d") && && die "Failed to process /etc/kernel/header_postinst.d";
die "Failed to process /etc/kernel/header_postinst.d";
} }
exit 0; exit 0;

View File

@ -1,25 +1,27 @@
#!/bin/sh -e #!/bin/sh
set -e
version=@abiname@@localversion@ [ "$1" = configure ] || exit 0
image_path=/boot/@image-stem@-$version
if [ "$1" != configure ]; then version='@abiname@@localversion@'
exit 0 image_path="/boot/@image-stem@-${version}"
fi
depmod $version depmod "${version}"
if [ -f /lib/modules/$version/.fresh-install ]; then if command -v linux-update-symlinks >/dev/null ; then
change=install change=install
else [ -f "/lib/modules/${version}/.fresh-install" ] || change=upgrade
change=upgrade
linux-update-symlinks "${change}" "${version}" "${image_path}"
fi fi
linux-update-symlinks $change $version $image_path rm -f "/lib/modules/${version}/.fresh-install"
rm -f /lib/modules/$version/.fresh-install
if [ -d /etc/kernel/postinst.d ] ; then if [ -d /etc/kernel/postinst.d ] ; then
DEB_MAINT_PARAMS="$*" run-parts --report --exit-on-error --arg=$version \ DEB_MAINT_PARAMS="$*" \
--arg=$image_path /etc/kernel/postinst.d run-parts --report --exit-on-error \
"--arg=${version}" \
"--arg=${image_path}" \
/etc/kernel/postinst.d
fi fi
exit 0 exit 0

View File

@ -1,31 +1,54 @@
#!/bin/sh -e #!/bin/sh
set -e
version=@abiname@@localversion@ version='@abiname@@localversion@'
image_path=/boot/@image-stem@-$version image_path="/boot/@image-stem@-${version}"
rm -f /lib/modules/$version/.fresh-install rm -f "/lib/modules/${version}/.fresh-install"
if [ "$1" != upgrade ] && command -v linux-update-symlinks >/dev/null ; then if [ "$1" != upgrade ] && command -v linux-update-symlinks >/dev/null ; then
linux-update-symlinks remove $version $image_path linux-update-symlinks remove "${version}" "${image_path}"
fi fi
if [ -d /etc/kernel/postrm.d ] ; then if [ -d /etc/kernel/postrm.d ] ; then
DEB_MAINT_PARAMS="$*" run-parts --report --exit-on-error --arg=$version \ DEB_MAINT_PARAMS="$*" \
--arg=$image_path /etc/kernel/postrm.d run-parts --report --exit-on-error \
"--arg=${version}" \
"--arg=${image_path}" \
/etc/kernel/postrm.d
fi fi
if [ "$1" = purge ]; then if [ "$1" = purge ]; then
for extra_file in modules.dep modules.isapnpmap modules.pcimap \ for extra_file in \
modules.usbmap modules.parportmap \ 'modules.*.bin' \
modules.generic_string modules.ieee1394map \ modules.alias \
modules.ieee1394map modules.pnpbiosmap \ modules.ccwmap \
modules.alias modules.ccwmap modules.inputmap \ modules.dep \
modules.symbols modules.ofmap \ modules.devname \
modules.seriomap modules.\*.bin \ modules.generic_string \
modules.softdep modules.weakdep modules.devname; do modules.ieee1394map \
eval rm -f /lib/modules/$version/$extra_file modules.inputmap \
modules.isapnpmap \
modules.ofmap \
modules.parportmap \
modules.pcimap \
modules.pnpbiosmap \
modules.seriomap \
modules.softdep \
modules.symbols \
modules.usbmap \
modules.weakdep \
; do
case "${extra_file}" in
*\** | *\?* )
find "/lib/modules/${version}/" -mindepth 1 -maxdepth 1 -name "${extra_file}" -exec rm -f {} +
;;
* )
rm -f "/lib/modules/${version}/${extra_file}"
;;
esac
done done
rmdir /lib/modules/$version || true rmdir "/lib/modules/${version}" || true
fi fi
exit 0 exit 0

View File

@ -1,21 +1,23 @@
#!/bin/sh -e #!/bin/sh
set -e
version=@abiname@@localversion@ if [ "$1" = abort-upgrade ] ; then exit 0 ; fi
image_path=/boot/@image-stem@-$version
if [ "$1" = abort-upgrade ]; then version='@abiname@@localversion@'
exit 0 image_path="/boot/@image-stem@-${version}"
fi
if [ "$1" = install ]; then if [ "$1" = install ]; then
# Create a flag file for postinst # Create a flag file for postinst
mkdir -p /lib/modules/$version mkdir -p "/lib/modules/${version}"
touch /lib/modules/$version/.fresh-install touch "/lib/modules/${version}/.fresh-install"
fi fi
if [ -d /etc/kernel/preinst.d ] ; then if [ -d /etc/kernel/preinst.d ] ; then
DEB_MAINT_PARAMS="$*" run-parts --report --exit-on-error --arg=$version \ DEB_MAINT_PARAMS="$*" \
--arg=$image_path /etc/kernel/preinst.d run-parts --report --exit-on-error \
"--arg=${version}" \
"--arg=${image_path}" \
/etc/kernel/preinst.d
fi fi
exit 0 exit 0

View File

@ -1,17 +1,21 @@
#!/bin/sh -e #!/bin/sh
set -e
version=@abiname@@localversion@ [ "$1" = remove ] || exit 0
image_path=/boot/@image-stem@-$version
if [ "$1" != remove ]; then version='@abiname@@localversion@'
exit 0 image_path="/boot/@image-stem@-${version}"
if command -v linux-check-removal >/dev/null ; then
linux-check-removal "${version}"
fi fi
linux-check-removal $version
if [ -d /etc/kernel/prerm.d ] ; then if [ -d /etc/kernel/prerm.d ] ; then
DEB_MAINT_PARAMS="$*" run-parts --report --exit-on-error --arg=$version \ DEB_MAINT_PARAMS="$*" \
--arg=$image_path /etc/kernel/prerm.d run-parts --report --exit-on-error \
"--arg=${version}" \
"--arg=${image_path}" \
/etc/kernel/prerm.d
fi fi
exit 0 exit 0