-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathentrypoint.sh
executable file
·66 lines (53 loc) · 1.55 KB
/
entrypoint.sh
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh
set -eux
INPUT_VERSION="$(echo "$INPUT_VERSION" | sed -E "s,^refs/tags/,,")"
if [ "$INPUT_VENDOR" = "" ]; then
INPUT_VENDOR="$INPUT_MAINTAINER"
fi
/replacetool \
--specfile:/template.spec \
--build-requires:"$INPUT_BUILD_REQUIRES" \
--requires:"$INPUT_REQUIRES" \
--summary:"$INPUT_SUMMARY" \
--package-root:"$INPUT_PACKAGE_ROOT" \
--package:"$INPUT_PACKAGE" \
--version:"$INPUT_VERSION" \
--arch:"$INPUT_ARCH" \
--maintainer:"$INPUT_MAINTAINER" \
--vendor:"$INPUT_VENDOR" \
--description:"$INPUT_DESC" \
--license:"$INPUT_LICENSE" \
--post:"$INPUT_POST"
readonly RPMBUILD_DIR="$HOME/rpmbuild"
readonly RPMBUILD_SOURCE_DIR="$RPMBUILD_DIR/SOURCES"
readonly RPMBUILD_SPEC_DIR="$RPMBUILD_DIR/SPECS"
(
readonly WORKDIR="/tmp/work"
mkdir "$WORKDIR"
cp /template.spec "$WORKDIR"
cp -rp "$INPUT_PACKAGE_ROOT" "$WORKDIR/$INPUT_PACKAGE"
cd "$WORKDIR"
tar czf tmp.tar.gz "$INPUT_PACKAGE/"
mkdir -p "$RPMBUILD_SOURCE_DIR"
mkdir -p "$RPMBUILD_SPEC_DIR"
mv tmp.tar.gz "$RPMBUILD_SOURCE_DIR"
cp -p template.spec "$RPMBUILD_SPEC_DIR"
cat template.spec
rpmbuild -bb "$RPMBUILD_SPEC_DIR/template.spec"
)
cp -p "$RPMBUILD_DIR/RPMS/$(uname -m)"/*.rpm .
ls -lah ./*.rpm
# for grep
set +e
for f in *.rpm; do
# exclude debuginfo file
line_count="$(echo "$f" | grep -Eoc "^${INPUT_PACKAGE}-debuginfo-")"
if [ "$line_count" -ne 0 ]; then
RPM_DEBUGINFO_FILE="$f"
continue
fi
RPM_FILE="$f"
done
set -e
echo "file_name=$RPM_FILE" >> "${GITHUB_OUTPUT}"
echo "debuginfo_file_name=$RPM_DEBUGINFO_FILE" >> "${GITHUB_OUTPUT}"