mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-25 16:46:55 +00:00
Keep explicitly listed files as separate array elements instead of joining them into one invalid path. Use pipefail so an input-listing error cannot be hidden by tar.
36 lines
842 B
Bash
Executable File
36 lines
842 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -o pipefail
|
|
|
|
usage() {
|
|
echo "Usage: $(basename "$0") name version [file ...]"
|
|
}
|
|
|
|
if [ $# -lt 2 ]; then
|
|
usage
|
|
exit 1
|
|
fi
|
|
|
|
scriptdir="$(dirname "$0")"
|
|
name="$1"; shift
|
|
version="$1"; shift
|
|
files=("$@")
|
|
if [ "${#files[@]}" -eq 0 ]; then
|
|
file_list="$("$scriptdir/list-source-files")" || exit $?
|
|
if [ -z "$file_list" ]; then
|
|
echo "Error: no source files found." >&2
|
|
exit 1
|
|
fi
|
|
mapfile -t files <<< "$file_list"
|
|
if [ -e build_mode ]; then
|
|
files+=(build_mode)
|
|
fi
|
|
fi
|
|
|
|
result="../$name-$version.tar.bz2"
|
|
rm -f "${result}"
|
|
printf '%s\n' "${files[@]}" | \
|
|
tar --owner=root --group=root --transform="s|^|$name-$version/|;s|^$name-$version/../scst/include/backport.h$|../scst/include/backport.h|;s|^$name-$version/scstadmin.sysfs$|scstadmin.sysfs|" \
|
|
-cjf "${result}" -T- &&
|
|
ls -l "${result}"
|