2022-03-25 11:53:28 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -eo pipefail
|
|
|
|
|
|
|
|
new_version="$1"
|
2023-04-04 15:51:21 +02:00
|
|
|
spec_dirs=(centos oracle opensuse fedora)
|
2023-04-04 15:49:56 +02:00
|
|
|
|
|
|
|
spec_files() {
|
|
|
|
for d in "${spec_dirs[@]}"; do
|
|
|
|
ls "$d"/*.spec
|
|
|
|
done
|
|
|
|
}
|
2022-03-25 11:53:28 +01:00
|
|
|
|
|
|
|
bump_version() {
|
2022-03-30 18:20:26 +02:00
|
|
|
sed -i "s/^Version:.\+/Version: $new_version/" "$1"
|
2022-03-25 11:53:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
detect_release_version() {
|
2022-03-30 18:20:26 +02:00
|
|
|
release_version=$(sed -ne 's/^Release:\s\+//p' "$1" | sed -e 's/%.\+$//')
|
2022-03-25 11:53:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bump_changelog() {
|
2022-03-30 18:20:26 +02:00
|
|
|
detect_release_version "$1"
|
2022-03-25 11:53:28 +01:00
|
|
|
|
|
|
|
local date=$(date +'%a %b %d %Y')
|
|
|
|
local changelog_version="$new_version-$release_version"
|
|
|
|
local new_changelog_entry="* $date KasmTech <info@kasmweb.com> - $changelog_version\n- Upstream release"
|
|
|
|
|
2022-03-30 18:20:26 +02:00
|
|
|
sed -i -e "s/%changelog/%changelog\n$new_changelog_entry/" "$1"
|
2022-03-25 11:53:28 +01:00
|
|
|
}
|
|
|
|
|
2023-04-04 15:49:56 +02:00
|
|
|
for spec_file in $(spec_files); do
|
2022-03-30 18:20:26 +02:00
|
|
|
bump_version $spec_file
|
|
|
|
bump_changelog $spec_file
|
|
|
|
done
|