You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.2 KiB

#!/bin/bash
# Copyright 2018 Denes Matetelki
# This file is part of ${NAME}.
# ${NAME} is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License v3 as published by the Free
# Software Foundation.
# ${NAME} is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License v3 for
# more details.
# You should have received a copy of the GNU General Public License v3 along
# with ${NAME}. If not, see
# https://www.gnu.org/licenses/gpl-3.0.html.
NAME="battery-status-led"
VERSION="0.1"
RELEASE="1"
rm -rf build*
mkdir build
cat > build/${NAME}.spec <<EOL
Name: ${NAME}
Version: ${VERSION}
Release: ${RELEASE}%{?dist}
URL: https://gitea.matetelki.eu/denes/battery-status-led
Packager: Denes Matetelki <denes@matetelki.com>
Summary: Battery status indication on an LED
Group: Utilities
License: GPLv3
BuildArch: noarch
Source0: ${NAME}.service
Source1: ${NAME}
Source2: README.md
6 years ago
Source3: ${NAME}.1
%description
Battery (low/critical) status indication by making a (the caps-lock) LED blink
# %prep
%install
mkdir -p %{buildroot}%{_unitdir}
install -p -m 0644 %{SOURCE0} %{buildroot}%{_unitdir}
mkdir -p %{buildroot}/%{_bindir}
install -p -m 755 %{SOURCE1} %{buildroot}/%{_bindir}
mkdir -p %{buildroot}/%{_docdir}/${NAME}
install -p -m 0644 %{SOURCE2} %{buildroot}%{_docdir}/${NAME}/
6 years ago
mkdir -p %{buildroot}/%{_mandir}/man1
install -p -m 0644 %{SOURCE3} %{buildroot}%{_mandir}/man1/
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%{_unitdir}/${NAME}.service
%{_bindir}/${NAME}
%{_docdir}/${NAME}/README.md
%{_mandir}/man1/${NAME}.1.*
%changelog
* Fri Aug 31 2018 Denes Matetelki <denes@matetelki.com> - 0.1-1
- Initial release
EOL
cp ../${NAME}.service build/
cp ../${NAME} build/
cp ../README.md build/
6 years ago
cp ../${NAME}.1 build/
# bzip2 -z -9 build/${NAME}.1
cd build
rpmbuild --define "_sourcedir $PWD" --define "_rpmdir $PWD" --define "_unitdir /lib/systemd/system" -bb ${NAME}.spec
cd ..
mv build/noarch/${NAME}-${VERSION}-${RELEASE}.noarch.rpm .
#rm -rf build