Quote shell variables in scripts

svn path=/dists/trunk/linux-2.6/; revision=4592
This commit is contained in:
Jonas Smedegaard 2005-10-21 19:05:04 +00:00
parent 24b936cb3a
commit feedb9bc33
3 changed files with 158 additions and 143 deletions

6
debian/changelog vendored
View File

@ -3,7 +3,11 @@ linux-2.6 (2.6.13+2.6.14c5-0experimental.1) experimental; urgency=low
[ Sven Luther ]
* Upgraded to 2.6.14-rc5.
-- Sven Luther <luther@debian.org> Fri, 21 Oct 2005 18:40:40 +0000
[ Jonas Smedegaard ]
* Quote variables in debian/rules.real and postinstall (making it
safer to run with weird characters in path of build environment).
-- Jonas Smedegaard <dr@jones.dk> Fri, 21 Oct 2005 21:01:12 +0200
linux-2.6 (2.6.13+2.6.14-rc4-0experimental.1) experimental; urgency=low

225
debian/rules.real vendored
View File

@ -8,9 +8,9 @@
# variable. It will also be passed a list of source files
#
SHELL := sh -e
DEB_HOST_ARCH := $(shell dpkg-architecture -a$(ARCH) -qDEB_HOST_ARCH)
DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -a$(ARCH) -qDEB_HOST_GNU_TYPE)
DEB_BUILD_ARCH := $(shell dpkg-architecture -a$(ARCH) -qDEB_BUILD_ARCH)
DEB_HOST_ARCH := $(shell dpkg-architecture -a'$(ARCH)' -qDEB_HOST_ARCH)
DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -a'$(ARCH)' -qDEB_HOST_GNU_TYPE)
DEB_BUILD_ARCH := $(shell dpkg-architecture -a'$(ARCH)' -qDEB_BUILD_ARCH)
#
# Build the list of common config files to be included
#
@ -38,27 +38,27 @@ include debian/rules.defs
# replaced by the flavour for which the command is run.
#
kpkg_header := HEADER_CLEAN_HOOK='$(CURDIR)/$(BUILD_DIR)/header-install-$(ARCH)-$(SUBARCH)'
kpkg_header += make-kpkg --append-to-version "$(KPKG_ABINAME)"
kpkg_header += --arch $(ARCH)
kpkg_header += make-kpkg --append-to-version '$(KPKG_ABINAME)'
kpkg_header += --arch '$(ARCH)'
kpkg_header += --stem linux
kpkg_header += --config defconfig
kpkg_image := make-kpkg --append-to-version "$(KPKG_ABINAME)-$(FLAVOUR)"
kpkg_image += --arch $(ARCH)
kpkg_image := make-kpkg --append-to-version '$(KPKG_ABINAME)-$(FLAVOUR)'
kpkg_image += --arch '$(ARCH)'
kpkg_image += --stem linux
kpkg_image += --initrd
ifdef KPKG_SUBARCH
kpkg_image += --subarch $(KPKG_SUBARCH)
kpkg_header += --subarch $(KPKG_SUBARCH)
kpkg_image += --subarch '$(KPKG_SUBARCH)'
kpkg_header += --subarch '$(KPKG_SUBARCH)'
endif
ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
kpkg_header += --cross-compile=$(DEB_HOST_GNU_TYPE)
kpkg_image += --cross-compile=$(DEB_HOST_GNU_TYPE)
kpkg_header += --cross-compile='$(DEB_HOST_GNU_TYPE)'
kpkg_image += --cross-compile='$(DEB_HOST_GNU_TYPE)'
endif
setup_env := env -u ABINAME -u ARCH -u SUBARCH -u FLAVOUR -u VERSION
setup_env += DEBIAN_ABINAME=$(ABINAME) DEBIAN_FLAVOUR=$(FLAVOUR) DEBIAN_VERSION=$(VERSION)
setup_env += DEBIAN_ABINAME='$(ABINAME)' DEBIAN_FLAVOUR='$(FLAVOUR)' DEBIAN_VERSION='$(VERSION)'
setup_makeflags =
ifdef COMPILER
setup_makeflags += CC=$$$$(CROSS_COMPILE)$(COMPILER)
setup_makeflags += CC="$$$$(CROSS_COMPILE)$(COMPILER)"
endif
setup_env += MAKEFLAGS='$(setup_makeflags)'
ifndef headers_dirs
@ -80,8 +80,8 @@ setup-subarch: $(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH)
setup-flavour: $(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH)-$(FLAVOUR)
$(BUILD_DIR)/header-install-$(ARCH)-$(SUBARCH): $(TEMPLATES_DIR)/header-install.in
sed -e 's,@headers_dirs@,$(headers_dirs),g' $< > $@
chmod u+x $@
sed -e 's,@headers_dirs@,$(headers_dirs),g' '$<' > '$@'
chmod u+x '$@'
#
# The way to make the correct package names is to make a
# subarch-specific post-install script...
@ -95,7 +95,7 @@ $(BUILD_DIR)/post-install-$(ARCH)-$(SUBARCH): $(TEMPLATES_DIR)/post-install.in
sed -e 's,@initrd_modules@,$(initrd_modules),' \
-e 's,@extra_postinstall_command@,$(extra_command),' \
-e 's,@headers_dirs@,$(headers_dirs),g' \
$< > $@
'$<' > '$@'
#
# Generates the kernel config file for a subarch by merging
# the arch-independent config file (arch/config),
@ -111,37 +111,37 @@ ifneq ($(SUBARCH),none)
endif
$(BUILD_DIR)/config.$(ARCH)-$(SUBARCH)-$(FLAVOUR): $(basedir)/config.$(FLAVOUR) $(config_common)
@echo "Generating configuration file $@:"
rm -f $@
rm -f '$@'
for i in $(config_common); do \
if [ -f $${i} ]; then \
cat $${i} >> $@; \
fi; \
if [ -f "$${i}" ]; then \
cat "$${i}" >> '$@'; \
fi; \
done
# Flavour config file must be present
cat $(basedir)/config.$(FLAVOUR) >> $@
cat '$(basedir)/config.$(FLAVOUR)' >> '$@'
$(BUILD_DIR)/linux-source-$(UPSTREAM_VERSION).tar.bz2: SOURCE_DIR=$(BUILD_DIR)/source
$(BUILD_DIR)/linux-source-$(UPSTREAM_VERSION).tar.bz2: DIR = $(BUILD_DIR)/linux-source-$(UPSTREAM_VERSION)
$(BUILD_DIR)/linux-source-$(UPSTREAM_VERSION).tar.bz2: $(STAMPS_DIR)/source
rm -rf $@ $(DIR)
cp -al $(SOURCE_DIR) $(DIR)
chmod -R u+rw,go=rX $(DIR)
cd $(BUILD_DIR); tar -cjf linux-source-$(UPSTREAM_VERSION).tar.bz2 linux-source-$(UPSTREAM_VERSION)
rm -rf $(DIR)
rm -rf '$@' '$(DIR)'
cp -al '$(SOURCE_DIR)' '$(DIR)'
chmod -R u+rw,go=rX '$(DIR)'
cd '$(BUILD_DIR)'; tar -cjf 'linux-source-$(UPSTREAM_VERSION).tar.bz2' 'linux-source-$(UPSTREAM_VERSION)'
rm -rf '$(DIR)'
srcfiles := $(filter-out debian, $(wildcard *))
$(STAMPS_DIR)/source: DIR=$(BUILD_DIR)/source
$(STAMPS_DIR)/source: debian/bin/apply
rm -rf $(DIR)
mkdir -p $(DIR)
cp -al $(srcfiles) $(DIR)
cd $(DIR); override_version="$(SOURCE_VERSION)" override_revisions="$(REVISIONS)" home=$(CURDIR)/debian/patches-debian sh $(CURDIR)/debian/bin/apply
rm -rf '$(DIR)'
mkdir -p '$(DIR)'
cp -al $(srcfiles) '$(DIR)'
cd '$(DIR)'; override_version='$(SOURCE_VERSION)' override_revisions='$(REVISIONS)' home='$(CURDIR)/debian/patches-debian' sh '$(CURDIR)/debian/bin/apply'
#make-kpkg does this when building kernel-source.
mv $(DIR)/scripts/package/Makefile $(DIR)/scripts/package/Makefile.dist
mv $(DIR)/scripts/package/builddeb $(DIR)/scripts/package/builddeb.dist
echo "# Dummy Makefile" > $(DIR)/scripts/package/Makefile
echo "all:" >> $(DIR)/scripts/package/Makefile
touch $@
mv '$(DIR)/scripts/package/Makefile' '$(DIR)/scripts/package/Makefile.dist'
mv '$(DIR)/scripts/package/builddeb' '$(DIR)/scripts/package/builddeb.dist'
echo "# Dummy Makefile" > '$(DIR)/scripts/package/Makefile'
echo "all:" >> '$(DIR)/scripts/package/Makefile'
touch '$@'
patches := $(wildcard debian/patches-arch/$(SUBARCH).*)
patches += $(wildcard debian/patches-arch/$(SUBARCH)_*)
@ -151,19 +151,21 @@ patches := $(strip $(patches))
$(STAMPS_DIR)/source-$(ARCH)-$(SUBARCH): SOURCE_DIR=$(BUILD_DIR)/source
$(STAMPS_DIR)/source-$(ARCH)-$(SUBARCH): DIR=$(BUILD_DIR)/source-$(ARCH)-$(SUBARCH)
$(STAMPS_DIR)/source-$(ARCH)-$(SUBARCH): $(BUILD_DIR)/post-install-$(ARCH)-$(SUBARCH) $(STAMPS_DIR)/source
rm -rf $(DIR)
cp -al $(SOURCE_DIR) $(DIR)
mkdir -p $(DIR)/debian
cp debian/changelog $(DIR)/debian
cp debian/copyright $(DIR)/debian
cp debian/control $(DIR)/debian/control
touch $(DIR)/debian/official
rm -rf '$(DIR)'
cp -al '$(SOURCE_DIR)' '$(DIR)'
mkdir -p '$(DIR)/debian'
cp debian/changelog '$(DIR)/debian'
cp debian/copyright '$(DIR)/debian'
cp debian/control '$(DIR)/debian/control'
touch '$(DIR)/debian/official'
if [ -n '$(patches)' ]; then \
cd $(DIR); \
for patch in $(patches); do cat "$(CURDIR)/$$patch" | patch -p1; done; \
cd '$(DIR)'; \
for patch in $(patches); do \
cat "$(CURDIR)/$$patch" | patch -p1; \
done; \
fi
install $< $(DIR)/debian/post-install
touch $@
install '$<' '$(DIR)/debian/post-install'
touch '$@'
#
# This target performs a build for a particular flavour. Note
# that in this file it should be always placed *before* the
@ -171,29 +173,29 @@ $(STAMPS_DIR)/source-$(ARCH)-$(SUBARCH): $(BUILD_DIR)/post-install-$(ARCH)-$(SUB
#
$(STAMPS_DIR)/build-$(ARCH)-$(SUBARCH)-$(FLAVOUR): DIR=$(BUILD_DIR)/build-$(ARCH)-$(SUBARCH)-$(FLAVOUR)
$(STAMPS_DIR)/build-$(ARCH)-$(SUBARCH)-$(FLAVOUR): $(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH)-$(FLAVOUR)
ln -fs $$(command -v touch) debian/build/touch.orig
cd $(DIR); $(setup_env) PATH=$(CURDIR)/build:$(CURDIR)/bin:$(PATH) $(kpkg_image) build
ln -fs "$$(command -v touch)" debian/build/touch.orig
cd '$(DIR)'; $(setup_env) PATH='$(CURDIR)/build:$(CURDIR)/bin:$(PATH)' $(kpkg_image) build
ifdef image_postproc
cd $(DIR); $(image_postproc)
cd '$(DIR)'; $(image_postproc)
endif
touch $@
touch '$@'
$(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH)-$(FLAVOUR): SOURCE_DIR=$(BUILD_DIR)/source-$(ARCH)-$(SUBARCH)
$(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH)-$(FLAVOUR): DIR=$(BUILD_DIR)/build-$(ARCH)-$(SUBARCH)-$(FLAVOUR)
$(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH)-$(FLAVOUR): $(BUILD_DIR)/config.$(ARCH)-$(SUBARCH)-$(FLAVOUR) $(STAMPS_DIR)/source-$(ARCH)-$(SUBARCH)
rm -rf $(DIR)
cp -al $(SOURCE_DIR) $(DIR)
cp $< $(DIR)/.config
cd $(DIR); $(setup_env) $(kpkg_image) configure
touch $@
rm -rf '$(DIR)'
cp -al '$(SOURCE_DIR)' '$(DIR)'
cp '$<' '$(DIR)/.config'
cd '$(DIR)'; $(setup_env) $(kpkg_image) configure
touch '$@'
$(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH): SOURCE_DIR=$(BUILD_DIR)/source-$(ARCH)-$(SUBARCH)
$(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH): DIR=$(BUILD_DIR)/build-$(ARCH)-$(SUBARCH)
$(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH): $(STAMPS_DIR)/source-$(ARCH)-$(SUBARCH)
rm -rf $(DIR)
cp -al $(SOURCE_DIR) $(DIR)
cd $(DIR); $(setup_env) $(kpkg_header) configure
touch $@
rm -rf '$(DIR)'
cp -al '$(SOURCE_DIR)' '$(DIR)'
cd '$(DIR)'; $(setup_env) $(kpkg_header) configure
touch '$@'
install-base:
dh_compress
@ -206,19 +208,22 @@ install-base:
install-doc: SOURCE_DIR=$(BUILD_DIR)/source
install-doc: DIR=$(BUILD_DIR)/$@
install-doc: $(STAMPS_DIR)/source
rm -rf $(DIR)
cp -al $(SOURCE_DIR) $(DIR)
mkdir -p $(DIR)/debian
cp debian/changelog $(DIR)/debian
cp debian/copyright $(DIR)/debian
cp debian/control $(DIR)/debian/control
touch $(DIR)/debian/official
rm $(DIR)/Makefile
sed -e 's,^EXTRAVERSION.*$$,EXTRAVERSION =,' < $(SOURCE_DIR)/Makefile > $(DIR)/Makefile
cd $(DIR) && $(setup_env) make-kpkg --stem linux kernel-manual
cat $(DIR)/debian/files >> debian/files
@for i in $$(awk '{ print $$1; }' $(DIR)/debian/files); do echo mv $(BUILD_DIR)/$$i ..; mv $(BUILD_DIR)/$$i ..; done
rm -rf $(DIR)
rm -rf '$(DIR)'
cp -al '$(SOURCE_DIR)' '$(DIR)'
mkdir -p '$(DIR)/debian'
cp debian/changelog '$(DIR)/debian'
cp debian/copyright '$(DIR)/debian'
cp debian/control '$(DIR)/debian/control'
touch '$(DIR)/debian/official'
rm '$(DIR)/Makefile'
sed -e 's,^EXTRAVERSION.*$$,EXTRAVERSION =,' < '$(SOURCE_DIR)/Makefile' > '$(DIR)/Makefile'
cd '$(DIR)' && $(setup_env) make-kpkg --stem linux kernel-manual
cat '$(DIR)/debian/files' >> debian/files
@for i in $$(awk '{ print $$1; }' '$(DIR)/debian/files'); do \
echo "mv \"$(BUILD_DIR)/$$i\" .."; \
mv "$(BUILD_DIR)/$$i" ..; \
done
rm -rf '$(DIR)'
install-dummy:
dh_testdir
@ -231,31 +236,37 @@ install-dummy:
install-image-$(ARCH)-$(SUBARCH)-$(FLAVOUR): SOURCE_DIR=$(BUILD_DIR)/build-$(ARCH)-$(SUBARCH)-$(FLAVOUR)
install-image-$(ARCH)-$(SUBARCH)-$(FLAVOUR): DIR=$(BUILD_DIR)/$@
install-image-$(ARCH)-$(SUBARCH)-$(FLAVOUR): $(STAMPS_DIR)/build-$(ARCH)-$(SUBARCH)-$(FLAVOUR)
rm -rf $(DIR)
cp -al $(SOURCE_DIR) $(DIR)
cd $(DIR); $(setup_env) $(kpkg_image) kernel-image
cat $(DIR)/debian/files >> debian/files
@for i in $$(awk '{ print $$1; }' $(DIR)/debian/files); do echo mv $(BUILD_DIR)/$$i ..; mv $(BUILD_DIR)/$$i ..; done
rm -rf $(DIR)
rm -rf '$(DIR)'
cp -al '$(SOURCE_DIR)' '$(DIR)'
cd '$(DIR)'; $(setup_env) $(kpkg_image) kernel-image
cat '$(DIR)/debian/files' >> debian/files
@for i in $$(awk '{ print $$1; }' '$(DIR)/debian/files'); do \
echo "mv \"$(BUILD_DIR)/$$i\" .."; \
mv "$(BUILD_DIR)/$$i" ..; \
done
rm -rf '$(DIR)'
install-header-$(ARCH)-$(SUBARCH): SOURCE_DIR=$(BUILD_DIR)/build-$(ARCH)-$(SUBARCH)
install-header-$(ARCH)-$(SUBARCH): DIR=$(BUILD_DIR)/$@
install-header-$(ARCH)-$(SUBARCH): $(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH) $(BUILD_DIR)/header-install-$(ARCH)-$(SUBARCH)
rm -rf $(DIR)
cp -al $(SOURCE_DIR) $(DIR)
cd $(DIR); $(setup_env) $(kpkg_header) kernel-headers
cat $(DIR)/debian/files >> debian/files
@for i in $$(awk '{ print $$1; }' $(DIR)/debian/files); do echo mv $(BUILD_DIR)/$$i ..; mv $(BUILD_DIR)/$$i ..; done
rm -rf $(DIR)
rm -rf '$(DIR)'
cp -al '$(SOURCE_DIR)' '$(DIR)'
cd '$(DIR)'; $(setup_env) $(kpkg_header) kernel-headers
cat '$(DIR)/debian/files' >> debian/files
@for i in $$(awk '{ print $$1; }' '$(DIR)/debian/files'); do \
echo "mv \"$(BUILD_DIR)/$$i\" .."; \
mv "$(BUILD_DIR)/$$i" ..; \
done
rm -rf '$(DIR)'
install-headers-all: DH_OPTIONS = -plinux-headers-$(VERSION)
install-headers-all:
dh_testdir
dh_testroot
dh_install $(DH_OPTIONS) debian/arch /usr/src/linux-headers-$(VERSION)/debian
dh_install $(DH_OPTIONS) debian/arch '/usr/src/linux-headers-$(VERSION)/debian'
dh_installdocs $(DH_OPTIONS)
dh_installchangelogs $(DH_OPTIONS)
$(MAKE) -f debian/rules.real install-base DH_OPTIONS=$(DH_OPTIONS)
$(MAKE) -f debian/rules.real install-base DH_OPTIONS='$(DH_OPTIONS)'
install-patch: PACKAGE = linux-patch-debian-$(VERSION)
install-patch: pbase := /usr/src/kernel-patches/all/$(SOURCE_UPSTREAM)
@ -266,43 +277,43 @@ install-patch:
dh_testdir
dh_testroot
dh_clean -d -k $(DH_OPTIONS)
dh_installdirs $(DH_OPTIONS) $(pbase)/apply $(pbase)/debian $(pbase)/unpatch
dh_install $(DH_OPTIONS) debian/patches-debian/* $(pbase)/debian
dh_installdirs $(DH_OPTIONS) '$(pbase)/apply' '$(pbase)/debian' '$(pbase)/unpatch'
dh_install $(DH_OPTIONS) debian/patches-debian/* '$(pbase)/debian'
# Install the debian patches
sed -e 's/@version@/$(SOURCE_VERSION)/g' -e 's/@revisions@/$(REVISIONS)/' debian/bin/apply > $(pfull)/apply/debian
sed -e 's/@upstream@/$(SOURCE_UPSTREAM)/g' debian/bin/unpatch > $(pfull)/unpatch/debian
chmod 755 $(pfull)/apply/debian $(pfull)/unpatch/debian
chmod 644 $(pfull)/debian/*.patch
bzip2 -9 $(pfull)/debian/*.patch
sed -e 's/@version@/$(SOURCE_VERSION)/g' -e 's/@revisions@/$(REVISIONS)/' debian/bin/apply > '$(pfull)/apply/debian'
sed -e 's/@upstream@/$(SOURCE_UPSTREAM)/g' debian/bin/unpatch > '$(pfull)/unpatch/debian'
chmod 755 '$(pfull)/apply/debian' '$(pfull)/unpatch/debian'
chmod 644 '$(pfull)/debian/'*.patch
bzip2 -9 '$(pfull)/debian/'*.patch
# Now the arch/subarch-specific patches
for i in $(ptchs); do \
arch=$${i%%.*}; \
arch="$${i%%.*}"; \
( \
echo "Patch-name: $${arch}"; \
echo "Patch-id: $${arch}_$(subst .,_,$(VERSION))"; \
echo "Path-strip-level: 1"; \
echo; \
echo "Patch-file: debian/patches-arch/$${i}"; \
echo "Architecture: $${arch}"; \
echo "Kernel-version: $(VERSION)"; \
echo; \
) > debian/$(PACKAGE).kpatches.arch; \
dh_installkpatches $(DH_OPTIONS); \
echo "Patch-id: $${arch}_$(subst .,_,$(VERSION))"; \
echo "Path-strip-level: 1"; \
echo; \
echo "Patch-file: debian/patches-arch/$${i}"; \
echo "Architecture: $${arch}"; \
echo "Kernel-version: $(VERSION)"; \
echo; \
) > 'debian/$(PACKAGE).kpatches.arch'; \
dh_installkpatches $(DH_OPTIONS); \
done
dh_installdocs $(DH_OPTIONS)
dh_installchangelogs $(DH_OPTIONS)
$(MAKE) -f debian/rules.real install-base DH_OPTIONS=$(DH_OPTIONS)
$(MAKE) -f debian/rules.real install-base DH_OPTIONS='$(DH_OPTIONS)'
install-source: DH_OPTIONS = -plinux-source-$(VERSION)
install-source: $(BUILD_DIR)/linux-source-$(UPSTREAM_VERSION).tar.bz2
dh_testdir
dh_testroot
dh_install $(DH_OPTIONS) $< /usr/src
dh_install $(DH_OPTIONS) '$<' /usr/src
dh_installdocs $(DH_OPTIONS) README
dh_installchangelogs $(DH_OPTIONS)
$(MAKE) -f debian/rules.real install-base DH_OPTIONS=$(DH_OPTIONS)
$(MAKE) -f debian/rules.real install-base DH_OPTIONS='$(DH_OPTIONS)'
install-tree: DH_OPTIONS = -plinux-tree-$(VERSION)
install-tree:
$(MAKE) -f debian/rules.real install-dummy DH_OPTIONS=$(DH_OPTIONS)
$(MAKE) -f debian/rules.real install-dummy DH_OPTIONS='$(DH_OPTIONS)'

View File

@ -32,10 +32,10 @@ debhelper_post() {
# to linux-headers-$(subarch)-$(version)-$(abiname),
# not just linux-headers-$(version)-$(abiname).
#
prefix=$DEBIAN_VERSION-$DEBIAN_ABINAME
pkg=linux-headers-$prefix-$DEBIAN_FLAVOUR
top=$PWD/debian/$pkg
dir=$top/usr/src/$pkg
prefix="$DEBIAN_VERSION-$DEBIAN_ABINAME"
pkg="linux-headers-$prefix-$DEBIAN_FLAVOUR"
top="$PWD/debian/$pkg"
dir="$top/usr/src/$pkg"
#
# Here we need to find the kernel architecture which
# is appropriate for the current flavour. It is available
@ -45,23 +45,23 @@ dir=$top/usr/src/$pkg
# Currently we just use the fact that in the build directory
# the symlink include/asm must point to include/asm-${arch}
#
arch=$(readlink include/asm)
arch=$(basename "${arch}")
arch="$(readlink include/asm)"
arch="$(basename "${arch}")"
arch="${arch#asm-}"
debhelper_pre $pkg
debhelper_pre "$pkg"
#
# Stuff below is ugly as hell, but does the trick so I'm not
# touching it until we can invent something better.
#
mkdir -p $dir/arch/$arch/kernel
mkdir -p $dir/include/asm-$arch
mkdir -p $dir/include/linux
cp -a .config $dir
echo $DEBIAN_VERSION-$DEBIAN_ABINAME-$DEBIAN_FLAVOUR > $dir/.extraversion
mkdir -p "$dir/arch/$arch/kernel"
mkdir -p "$dir/include/asm-$arch"
mkdir -p "$dir/include/linux"
cp -a .config "$dir"
echo "$DEBIAN_VERSION-$DEBIAN_ABINAME-$DEBIAN_FLAVOUR" > "$dir/.extraversion"
cp -a Module.symvers $dir
cp -a Module.symvers "$dir"
find . -mindepth 1 -maxdepth 1 \
! -name debian -a ! -name Documentation -a ! -name include -a \
@ -70,33 +70,33 @@ find . -mindepth 1 -maxdepth 1 \
-printf "../linux-headers-$prefix/%f\n" |
xargs ln -s --target-directory="$dir"
find arch/$arch -mindepth 1 -maxdepth 1 \( \
find "arch/$arch" -mindepth 1 -maxdepth 1 \( \
-type d -a ! -name kernel -o \
-type f -a \( -name 'Makefile*' -o -name 'Kconfig*' \) \) \
-printf "../../../linux-headers-$prefix/%p\n" |
xargs ln -s --target-directory=$dir/arch/$arch
[ -f arch/$arch/kernel/asm-offsets.s ] && ln -f arch/$arch/kernel/asm-offsets.s $dir/arch/$arch/kernel
ln -s ../../../../linux-headers-$prefix/arch/$arch/kernel/Makefile $dir/arch/$arch/kernel
xargs ln -s --target-directory="$dir/arch/$arch"
[ -f "arch/$arch/kernel/asm-offsets.s" ] && ln -f "arch/$arch/kernel/asm-offsets.s" "$dir/arch/$arch/kernel"
ln -s "../../../../linux-headers-$prefix/arch/$arch/kernel/Makefile" "$dir/arch/$arch/kernel"
find include -mindepth 1 -maxdepth 1 \
! -name config -a ! -name linux -a ! -name 'asm-*' \
-printf "../../linux-headers-$prefix/%p\n" |
xargs ln -s --target-directory=$dir/include
cp -a include/config $dir/include
ln -sf asm-${arch} $dir/include/asm
find include/asm-$arch -mindepth 1 -maxdepth 1 \
xargs ln -s --target-directory="$dir/include"
cp -a include/config "$dir/include"
ln -sf "asm-${arch}" "$dir/include/asm"
find "include/asm-$arch" -mindepth 1 -maxdepth 1 \
\( -type f -a ! -links 2 -o ! -type f \) \
-printf "../../../linux-headers-$prefix/%p\n" |
xargs --no-run-if-empty ln -s --target-directory=$dir/include/asm-$arch
find include/asm-$arch -mindepth 1 -maxdepth 1 \
xargs --no-run-if-empty ln -s --target-directory="$dir/include/asm-$arch"
find "include/asm-$arch" -mindepth 1 -maxdepth 1 \
-type f -links 2 |
xargs --no-run-if-empty ln -f --target-directory=$dir/include/asm-$arch
xargs --no-run-if-empty ln -f --target-directory="$dir/include/asm-$arch"
for i in include/asm-*
do
case ${i#include/asm-} in
$arch)
;;
generic | @headers_dirs@)
ln -s ../../linux-headers-$prefix/$i $dir/$i
ln -s "../../linux-headers-$prefix/$i" "$dir/$i"
;;
*)
;;
@ -105,27 +105,27 @@ done
find include/linux -mindepth 1 -maxdepth 1 \
! -name autoconf.h -a ! -name compile.h -a ! -name version.h \
-printf "../../../linux-headers-$prefix/%p\n" |
xargs ln -s --target-directory=$dir/include/linux
xargs ln -s --target-directory="$dir/include/linux"
cp -a include/linux/autoconf.h include/linux/compile.h \
include/linux/version.h $dir/include/linux
include/linux/version.h "$dir/include/linux"
mkdir -p $top/lib/modules/$version
ln -s /usr/src/linux-headers-$version $top/lib/modules/$version/build
mkdir -p "$top/lib/modules/$version"
ln -s "/usr/src/linux-headers-$version" "$top/lib/modules/$version/build"
mkdir -p $dir/scripts
cp scripts/Makefile* $dir/scripts
mkdir -p "$dir/scripts"
cp scripts/Makefile* "$dir/scripts"
for i in $(find scripts -type f -perm +111 -o -name "*.sh" -o -name "*.pl"); do
mkdir -p $dir/$(dirname $i)
cp $i $dir/$i
mkdir -p "$dir/$(dirname $i)"
cp "$i" "$dir/$i"
done
debhelper_post $pkg
debhelper_post "$pkg"
#
# Check whether we should force any modules to be available
# on the initrd.
#
cd ${IMAGE_TOP}/lib/modules/${version}
cd "${IMAGE_TOP}/lib/modules/${version}"
modules='@initrd_modules@'
if [ -n "${modules}" ]; then
mkdir initrd