Skip to content

Commit b44aa8c

Browse files
committed
kbuild: deb-pkg: make .orig tarball a hard link if possible
If '..' belongs to the same filesystem, create a hard link instead of a copy. In most cases, you can save disk space. I do not want to use 'mv' because keeping linux.tar.gz is useful to avoid unneeded rebuilding of the tarball. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nicolas Schier <[email protected]>
1 parent 6eabebb commit b44aa8c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scripts/Makefile.package

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ debian-orig: private source = $(shell dpkg-parsechangelog -S Source)
9696
debian-orig: private version = $(shell dpkg-parsechangelog -S Version | sed 's/-[^-]*$$//')
9797
debian-orig: private orig-name = $(source)_$(version).orig.tar.gz
9898
debian-orig: linux.tar.gz debian
99-
$(Q)cp $< ../$(orig-name)
99+
$(Q)if [ "$(df --output=target .. 2>/dev/null)" = "$(df --output=target $< 2>/dev/null)" ]; then \
100+
ln -f $< ../$(orig-name); \
101+
else \
102+
cp $< ../$(orig-name); \
103+
fi
100104

101105
PHONY += deb-pkg
102106
deb-pkg: debian-orig

0 commit comments

Comments
 (0)