mirror of
https://github.com/cockpit-project/cockpit.git
synced 2026-11-03 21:49:50 -09:00
18 lines
509 B
Bash
Executable file
18 lines
509 B
Bash
Executable file
#!/bin/sh
|
|
# patch given spec file to have the correct version and declare bundled NPM dependencies
|
|
# Usage: fix-spec <spec-file> [version]
|
|
set -eu
|
|
|
|
spec="$1"
|
|
version="${2:-}"
|
|
|
|
ROOT_DIR=$(realpath "$(dirname "$0")/..")
|
|
|
|
PROVIDES=$(awk '{print "Provides: bundled(npm(" $1 ")) = " $2}' "${ROOT_DIR}/runtime-npm-modules.txt")
|
|
awk -v p="$PROVIDES" 'gsub(/#NPM_PROVIDES/, p) 1' "$spec" > "$spec".new
|
|
|
|
if [ -n "$version" ]; then
|
|
sed -i '/Version/ s/\b0\b/'"$version"'/' "$spec".new
|
|
fi
|
|
|
|
mv -f "$spec".new "$spec"
|