buildroot/support
Yann E. MORIN 88bad8f462 support/scripts: add helper to hardlink-or-copy
When preparing the legal-info, the source archives are copied in the
legal-info/ output directory. When the archives are big, it can take
quite a bit of time and unnecessarily uses disk space. When the
legal-info output directory is on the same filesystem as the BR2_DL_DIR,
we can easily reduce copy time and disk usage by just using hardlins
instead of copying. However, the BR2_DL_DIR may be on a different
filesystem, so we must fallback to copying in this case

Introduce a helper script that copies a source file into a destination
directory, by first attempting to hard-link, and falling back to a
plain copy in case the hardlink fails.

In case the destination already exists, it is forcibly removed first, to
avoid clobering any existing target file (and especially any hardlink to
it), since cp -f does not remove the destination file, but clobbers it.

In some situations, it will be necessary that the destination file is
named differently than the source, so if a third argument is specified,
it is treated as the basename of the destination file.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Luca Ceresoli <luca@lucaceresoli.net>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-05-11 23:14:37 +02:00
..
dependencies dependencies.sh: improve the missing perl modules detection 2015-10-15 22:51:50 +02:00
download support/download: really, really make git archives reproducible 2016-02-27 23:13:55 +01:00
dummy-external core: allow external Config.in/makefile code to be integrated 2013-12-08 22:39:42 +01:00
gnuconfig Update config.guess and config.sub scripts to latest versions. 2013-10-27 15:29:38 +01:00
kconfig merge_config.sh: create temporary files in /tmp 2016-01-31 09:09:52 +01:00
legal-info core/legal-info: update the legal-info report header 2016-02-01 22:04:39 +01:00
libtool support/libtool: add patch for newer versions 2014-12-21 13:21:56 +01:00
misc Update for 2016.02 2016-03-01 21:47:30 +01:00
scripts support/scripts: add helper to hardlink-or-copy 2016-05-11 23:14:37 +02:00