-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
32 lines (26 loc) · 782 Bytes
/
build.sh
File metadata and controls
32 lines (26 loc) · 782 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
31
32
#!/bin/bash
set -e
# Ensure rpmbuild exists
if ! command -v rpmbuild &> /dev/null; then
echo "Error: rpmbuild is not installed."
exit 1
fi
# Prepare build directories
mkdir -p ./rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
# Create a source tarball
SRCDIR=vm_devtools-1.0.0
CURRENT_DIR=$(pwd)
rm -rf /tmp/$SRCDIR
mkdir -p /tmp/$SRCDIR
cp -r bin lib setup_vm_devtools.sh /tmp/$SRCDIR/
(cd /tmp && tar --exclude='*/__pycache__' -czf "$CURRENT_DIR/rpmbuild/SOURCES/$SRCDIR.tar.gz" $SRCDIR)
# Copy spec
cp specs/devtools.spec ./rpmbuild/SPECS/
# Build RPM
rpmbuild -bb --define "_topdir $(pwd)/rpmbuild" ./rpmbuild/SPECS/devtools.spec
if [ $? -eq 0 ]; then
echo "RPM built successfully. Find it in ./rpmbuild/RPMS/noarch/"
else
echo "RPM build failed."
exit 1
fi