Skip to content

Commit

Permalink
generate packaging related bits dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario Limonciello committed Jan 17, 2018
1 parent dec8e9f commit 7c9e3ab
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 4,397 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
biosdisk.8.gz
tmp
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,35 @@ datadir ?= $(prefix)share/biosdisk
mandir ?= $(prefix)/share/man/man8
sharedstatedir ?= /var/lib/biosdisk

VERSION=$(shell git describe --abbrev=0 | sed "s,v,,")
DESCRIBE=$(shell git describe)

all:
gzip -c biosdisk.8 > biosdisk.8.gz

packages: clean-packages rpm deb

rpm:
#put spec in common build area
mkdir -p tmp/SPECS
sed "s,##VERSION##,$(VERSION)," biosdisk.spec.in > tmp/SPECS/biosdisk.spec
rpmbuild --define "_topdir `pwd`/tmp" -ba tmp/SPECS/biosdisk.spec

deb:
#copy to the common area to build RPM/deb
mkdir -p tmp/BUILD
rsync -av --exclude='tmp' . tmp/BUILD
cd tmp/BUILD
pwd
sed "s,##VERSION##,$(VERSION),; \
s,##DESCRIBE##,$(DESCRIBE),;" tmp/BUILD/debian/changelog.in > \
tmp/BUILD/debian/changelog
cd tmp/BUILD && fakeroot dpkg-buildpackage
cd tmp/BUILD && debian/rules clean

clean-packages:
rm -fr tmp

install: all
mkdir -p $(sharedstatedir)
mkdir -p $(datadir)
Expand Down
42 changes: 10 additions & 32 deletions biosdisk.spec → biosdisk.spec.in
Original file line number Diff line number Diff line change
@@ -1,42 +1,32 @@
%define name biosdisk
%define version 0.75
%define version ##VERSION##
%define release 1

Summary: Creates BIOS flash floppy images from Dell BIOS executables
Name: %{name}
Version: %{version}
Release: %{release}
URL: http://linux.dell.com/biosdisk/
URL: http://github.com/dell/biosdisk
License: GPLv2+
Group: Applications/File
Source0: %{name}-%{version}.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildArch: noarch
Requires(post): syslinux
Requires: unix2dos, wget, /usr/bin/rpmbuild
Requires: syslinux, /usr/bin/rpmbuild

%description
Provides biosdisk utility for creating BIOS disk images in Linux

%prep
%setup -q
mkdir -p %{_topdir}/BUILD
rsync -av --exclude='tmp' ../.. .

%build
make

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/%{_sbindir}
mkdir -p %{buildroot}%{_localstatedir}/lib/%{name}
mkdir -p %{buildroot}/%{_datadir}/%{name}
mkdir -p %{buildroot}%{_mandir}/man8
mkdir -p %{buildroot}/%{_sysconfdir}


#place files
install -m 755 biosdisk %{buildroot}%{_sbindir}
install -m 644 biosdisk.conf %{buildroot}/%{_sysconfdir}
install -m 644 biosdisk.8.gz %{buildroot}%{_mandir}/man8
cp -R freedos-iso %{buildroot}%{_datadir}/%{name}
make install sharedstatedir=%{buildroot}%{_localstatedir}/lib/%{name} \
confdir=%{buildroot}/%{_sysconfdir}/ \
prefix=%{buildroot}/%{_prefix}/

%clean
rm -rf %{buildroot}
Expand All @@ -48,19 +38,7 @@ rm -rf %{buildroot}
%{_datadir}/%{name}/
%config(noreplace) %{_sysconfdir}/%{name}.conf
%{_mandir}/man8/%{name}.8.gz
%doc COPYING ChangeLog AUTHORS README INSTALL TODO README.dosdisk

%post
# copy memdisk to /boot
# yes rpmlint throws warnings about hardcoded paths and unsafe use of cp
if ! [ -e /boot/memdisk ]; then
for i in /usr/lib/syslinux/memdisk %{_datadir}/syslinux/memdisk
do
if [ -e $i ]; then
cp -f $i /boot
fi
done
fi
%doc COPYING AUTHORS README.md README.dosdisk

%changelog
* Tue Jun 10 2008 - Matt Domsch <[email protected]>
Expand Down
5 changes: 0 additions & 5 deletions debian/changelog

This file was deleted.

5 changes: 5 additions & 0 deletions debian/changelog.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
biosdisk (##VERSION##) UNRELEASED; urgency=low

* Built from ##DESCRIBE##

-- Dell Linux Team <[email protected]> Wed, 17 Jan 2018 00:55:38 -0500
Loading

0 comments on commit 7c9e3ab

Please sign in to comment.