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.

75 lines
1.8 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}
Summary: Battery status indication on an LED
Group: Utilities
License: GPLv3
BuildArch: noarch
Source0: ${NAME}.service
Source1: ${NAME}
Source2: README.md
%description
Battery (low/critical) status indication by making a (the capslock) 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}/
# %clean
%files
%defattr(-,root,root,-)
%{_unitdir}/${NAME}.service
%{_bindir}/${NAME}
%{_docdir}/${NAME}/README.md
# %changelog
EOL
cp ../${NAME}.service build/
cp ../${NAME} build/
cp ../README.md build/
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