-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patharchive.sh
More file actions
executable file
·30 lines (24 loc) · 853 Bytes
/
Copy patharchive.sh
File metadata and controls
executable file
·30 lines (24 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
set -e
if [[ ! -d .git/ ]]; then
echo "WARNING: You are not in git tree." >&2
set -x
fi
version=${VERSION}
gitversion=$(git describe --abbrev=0 --tags 2>/dev/null || true)
specversion=v$(rpmspec -q --qf "%{version}\n" ulpatch.spec | head -n1)
# Read version from ulpatch.spec, cause, in github workflow, there is no .git/
# exist anywhere.
[[ -z ${version} ]] && version=${gitversion}
[[ -z ${version} ]] && version=${specversion}
[[ -z ${version} ]] && echo "ERROR: Couldn't found version anywhere!!!" && exit 1
name=ulpatch-${version}
# Use git repo first
if [[ -d .git/ ]]; then
git archive --format tar.gz --prefix=${name}/ --output ${name}.tar.gz master
else
rm -rf build/ build-ci/ #${name}
#ln -s . ${name}
tar -czf ${name}.tar.gz --transform "s|^|${name}/|" --dereference *
fi