adept/bin/build_rpm.sh

75 lines
1.6 KiB
Bash
Raw Normal View History

2022-10-26 19:35:23 -04:00
#!/bin/bash
# Check that we've been supplied a valid version
VERSION="$1"
if [ "$VERSION" == "" ]; then
echo -e "You must supply a version tag like './build_rpm.sh 1.2.3'."
exit 1
fi
# Trim the leading 'v' from version number
if [[ "${VERSION:0:1}" == "v" ]]; then
VERSION="${VERSION:1}"
fi
# Tar up source files
mkdir rpm-temp
cp -r cmd config transcoder util adept.go go.mod go.sum LICENSE Makefile README.md rpm-temp/
tar cvzf "adept-$VERSION.tar.gz" rpm-temp/*
mv "adept-$VERSION.tar.gz" ~/rpmbuild/SOURCES/
2022-10-26 19:35:23 -04:00
# Create debian control file
cat > "./adept.spec"<< EOF
Name: adept
Version: $VERSION
Release: 1%{?dist}
Summary: Bit Goblin video transcoding service
License: BSD 2-Clause
Source0: %{name}-%{version}.tar.gz
BuildRequires: golang
BuildRequires: systemd-rpm-macros
Provides: %{name} = %{version}
%description
Bit Goblin video transcoding service
%global debug_package %{nil}
%prep
%autosetup
2022-10-26 19:35:23 -04:00
%build
go build -v -o %{name}
%install
install -Dpm 0755 %{name} %{buildroot}%{_bindir}/%{name}
install -Dpm 0755 build/etc/%{name}/%{name}.toml %{buildroot}%{_sysconfdir}/%{name}/%{name}.toml
install -Dpm 644 build/etc/systemd/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
%check
# go test should be here... :)
%post
%systemd_post %{name}.service
%preun
%systemd_preun %{name}.service
%files
%dir %{_sysconfdir}/%{name}
%{_bindir}/%{name}
%{_unitdir}/%{name}.service
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.toml
%changelog
* Thu Nov 17 2022 Gregory Ballantine $VERSION
- check git.metaunix.net/BitGoblin/adept for a changelog
EOF
2022-10-26 19:35:23 -04:00
rpmbuild -ba adept.spec