Add copyright
Convert to config/functions/die()
Make use of bash default value mechanic
Combine some if tests
Get PKG_BUILD quoted
Replace `` with $()
Signed-off-by: Ian Leonard <antonlacon@gmail.com>
Replace "which" with "command -v", which is part of POSIX.
Make offering to install packages contingent on having the sudo command.
Not every distro uses sudo. It is optional in Gentoo, for example.
Signed-off-by: Ian Leonard <antonlacon@gmail.com>
Squashfs allows configuring a blocksize between 4KB and 1MB. The default is
128KB. Increasing blocksize, in general, increases compression efficiency
at a cost of increased access time. Using 256KB for a blocksize appears to be
a sweet spot balancing the two for gzip and zstd. Blocksize 512KB appears
right for lzo.
Gzip decreases by ~700KB.
Lzo decreases by ~1.25MB.
Zstd decreaes by ~2.5MB.
Signed-off-by: Ian Leonard <antonlacon@gmail.com>
GNU tar can automatically detect the compression format based on
the file name since at least 2006. So just use "tar xf" to extract
all tarballs and drop the redundant cases.
GNU tar can also strip the top level directory from the archive
which allows us to extract it to the directory wanted by the
build system ($PKG_NAME-$PKG_VERSION), so packages don't need to
specify PKG_SOURCE_DIR if the top level dir from that and scripts/unpack
doesn't need to rename the directory.
If PKG_SOURCE_DIR is not set the top level dir is automatically
stripped from the archive and extracted to $BUILD/$PKG_NAME-$PKG_VERSION
If PKG_SOURCE_DIR is set, scripts/extract behaviour is unchanged.
Signed-off-by: Matthias Reichl <hias@horus.com>