diff --git a/Makefile b/Makefile
index 5b8b5804..6ec9d7f4 100644
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,7 @@
# along with this program. If not, see .
SHELL = /usr/bin/env bash
-.PHONY: all art cleanart version program lang path deps run race bindata generate build build-debug crossbuild clean test gofmt yamlfmt format docs rpmbuild mkdirs rpm srpm spec tar upload upload-sources upload-srpms upload-rpms upload-releases copr tag mkosi mkosi_rpm mkosi_deb mkosi_pacman release releases_path release_rpm release_deb release_pacman funcgen
+.PHONY: all art cleanart version program lang path deps run race bindata generate build build-debug crossbuild clean test gofmt yamlfmt format docs rpmbuild mkdirs rpm srpm spec tar upload upload-sources upload-srpms upload-rpms upload-releases copr tag mkosi mkosi_fedora-29 mkosi_debian-10 mkosi_rpm mkosi_deb mkosi_pacman mkosi_archlinux release releases_path release_fedora-29 release_debian-10 release_rpm release_deb release_pacman release_archlinux funcgen
.SILENT: clean bindata
# a large amount of output from this `find`, can cause `make` to be much slower!
@@ -49,9 +49,12 @@ GOOSARCHES ?= linux/amd64 linux/ppc64 linux/ppc64le linux/arm64 darwin/amd64
GOHOSTOS = $(shell go env GOHOSTOS)
GOHOSTARCH = $(shell go env GOHOSTARCH)
+PKG_FEDORA-29 = releases/$(VERSION)/fedora-29/mgmt-$(VERSION)-1.x86_64.rpm
+PKG_DEBIAN-10 = releases/$(VERSION)/debian-10/mgmt_$(VERSION)_amd64.deb
RPM_PKG = releases/$(VERSION)/rpm/mgmt-$(VERSION)-1.x86_64.rpm
DEB_PKG = releases/$(VERSION)/deb/mgmt_$(VERSION)_amd64.deb
PACMAN_PKG = releases/$(VERSION)/pacman/mgmt-$(VERSION)-1-x86_64.pkg.tar.xz
+PKG_ARCHLINUX = releases/$(VERSION)/archlinux/mgmt-$(VERSION)-1-x86_64.pkg.tar.xz
SHA256SUMS = releases/$(VERSION)/SHA256SUMS
SHA256SUMS_ASC = $(SHA256SUMS).asc
@@ -347,7 +350,15 @@ tag: ## tags a new release
#
# mkosi
#
-mkosi: mkosi_rpm mkosi_deb mkosi_pacman ## builds distro packages via mkosi
+mkosi: mkosi_fedora-29 mkosi_debian-10 mkosi_rpm mkosi_deb mkosi_pacman mkosi_archlinux ## builds distro packages via mkosi
+
+mkosi_fedora-29: releases/$(VERSION)/.mkdir
+ @title='$@' ; echo "Generating: $${title#'mkosi_'} via mkosi..."
+ @title='$@' ; distro=$${title#'mkosi_'} ; ./misc/mkosi/make.sh $${distro} `realpath "releases/$(VERSION)/"`
+
+mkosi_debian-10: releases/$(VERSION)/.mkdir
+ @title='$@' ; echo "Generating: $${title#'mkosi_'} via mkosi..."
+ @title='$@' ; distro=$${title#'mkosi_'} ; ./misc/mkosi/make.sh $${distro} `realpath "releases/$(VERSION)/"`
mkosi_rpm: releases/$(VERSION)/.mkdir
@echo "Generating: rpm via mkosi..."
@@ -361,6 +372,11 @@ mkosi_pacman: releases/$(VERSION)/.mkdir
@echo "Generating: pacman via mkosi..."
./misc/mkosi/make.sh pacman mkosi.default.archlinux `realpath "releases/$(VERSION)/"`
+mkosi_archlinux: releases/$(VERSION)/.mkdir
+ @title='$@' ; echo "Generating: $${title#'mkosi_'} via mkosi..."
+ @title='$@' ; distro=$${title#'mkosi_'} ; ./misc/mkosi/make.sh $${distro} `realpath "releases/$(VERSION)/"`
+
+
#
# release
#
@@ -370,17 +386,23 @@ releases_path:
@#Don't put any other output or dependencies in here or they'll show!
@echo "releases/$(VERSION)/"
+release_fedora-29: $(PKG_FEDORA-29)
+release_debian-10: $(PKG_DEBIAN-10)
release_rpm: $(RPM_PKG)
release_deb: $(DEB_PKG)
release_pacman: $(PACMAN_PKG)
+release_archlinux: $(PKG_ARCHLINUX)
-releases/$(VERSION)/mgmt-release.url: $(RPM_PKG) $(DEB_PKG) $(PACMAN_PKG) $(SHA256SUMS_ASC)
+releases/$(VERSION)/mgmt-release.url: $(PKG_FEDORA-29) $(PKG_DEBIAN-10) $(RPM_PKG) $(DEB_PKG) $(PACMAN_PKG) $(PKG_ARCHLINUX) $(SHA256SUMS_ASC)
@echo "Creating github release..."
hub release create \
-F <( echo -e "$(VERSION)\n";echo "Verify the signatures of all packages before you use them. The signing key can be downloaded from https://purpleidea.com/contact/#pgp-key to verify the release." ) \
+ -a $(PKG_FEDORA-29) \
+ -a $(PKG_DEBIAN-10) \
-a $(RPM_PKG) \
-a $(DEB_PKG) \
-a $(PACMAN_PKG) \
+ -a $(PKG_ARCHLINUX) \
-a $(SHA256SUMS_ASC) \
$(VERSION) \
> releases/$(VERSION)/mgmt-release.url \
@@ -388,7 +410,23 @@ releases/$(VERSION)/mgmt-release.url: $(RPM_PKG) $(DEB_PKG) $(PACMAN_PKG) $(SHA2
|| rm -f releases/$(VERSION)/mgmt-release.url
releases/$(VERSION)/.mkdir:
- mkdir -p releases/$(VERSION)/{rpm,deb,pacman}/ && touch releases/$(VERSION)/.mkdir
+ mkdir -p releases/$(VERSION)/{fedora-29,debian-10,rpm,deb,pacman,archlinux}/ && touch releases/$(VERSION)/.mkdir
+
+releases/$(VERSION)/fedora-29/changelog: $(PROGRAM) releases/$(VERSION)/.mkdir
+ @title='$(@D)' ; distro=$${title#'releases/$(VERSION)/'} ; echo "Generating: $${distro} changelog..."
+ @title='$(@D)' ; distro=$${title#'releases/$(VERSION)/'} ; ./misc/make-rpm-changelog.sh "$${distro}" $(VERSION)
+
+$(PKG_FEDORA-29): releases/$(VERSION)/fedora-29/changelog
+ @title='$(@D)' ; distro=$${title#'releases/$(VERSION)/'} ; echo "Building: $${distro} package..."
+ @title='$(@D)' ; distro=$${title#'releases/$(VERSION)/'} ; ./misc/fpm-pack.sh $${distro} $(VERSION) libvirt-devel augeas-devel
+
+releases/$(VERSION)/debian-10/changelog: $(PROGRAM) releases/$(VERSION)/.mkdir
+ @title='$(@D)' ; distro=$${title#'releases/$(VERSION)/'} ; echo "Generating: $${distro} changelog..."
+ @title='$(@D)' ; distro=$${title#'releases/$(VERSION)/'} ; ./misc/make-deb-changelog.sh "$${distro}" $(VERSION)
+
+$(PKG_DEBIAN-10): releases/$(VERSION)/debian-10/changelog
+ @title='$(@D)' ; distro=$${title#'releases/$(VERSION)/'} ; echo "Building: $${distro} package..."
+ @title='$(@D)' ; distro=$${title#'releases/$(VERSION)/'} ; ./misc/fpm-pack.sh $${distro} $(VERSION) libvirt-dev libaugeas-dev
releases/$(VERSION)/rpm/changelog: $(PROGRAM) releases/$(VERSION)/.mkdir
@echo "Generating: rpm changelog..."
@@ -410,10 +448,14 @@ $(PACMAN_PKG): $(PROGRAM) releases/$(VERSION)/.mkdir
@echo "Building: pacman package..."
./misc/fpm-pack.sh pacman $(VERSION) libvirt augeas
-$(SHA256SUMS): $(RPM_PKG) $(DEB_PKG) $(PACMAN_PKG)
+$(PKG_ARCHLINUX): $(PROGRAM) releases/$(VERSION)/.mkdir
+ @title='$(@D)' ; distro=$${title#'releases/$(VERSION)/'} ; echo "Building: $${distro} package..."
+ @title='$(@D)' ; distro=$${title#'releases/$(VERSION)/'} ; ./misc/fpm-pack.sh $${distro} $(VERSION) libvirt augeas
+
+$(SHA256SUMS): $(PKG_FEDORA-29) $(PKG_DEBIAN-10) $(RPM_PKG) $(DEB_PKG) $(PACMAN_PKG) $(PKG_ARCHLINUX)
@# remove the directory separator in the SHA256SUMS file
@echo "Generating: sha256 sum..."
- sha256sum $(RPM_PKG) $(DEB_PKG) $(PACMAN_PKG) | awk -F '/| ' '{print $$1" "$$6}' > $(SHA256SUMS)
+ sha256sum $(PKG_FEDORA-29) $(PKG_DEBIAN-10) $(RPM_PKG) $(DEB_PKG) $(PACMAN_PKG) $(PKG_ARCHLINUX) | awk -F '/| ' '{print $$1" "$$6}' > $(SHA256SUMS)
$(SHA256SUMS_ASC): $(SHA256SUMS)
@echo "Signing sha256 sum..."
diff --git a/misc/fpm-pack.sh b/misc/fpm-pack.sh
index 4e2f9236..924388cc 100755
--- a/misc/fpm-pack.sh
+++ b/misc/fpm-pack.sh
@@ -1,7 +1,8 @@
#!/bin/bash
# This script packages rpm, deb, and pacman packages of mgmt with fpm. The
-# first argument is the package type, and all subsequent arguments are the
-# dependencies. Example usage: `./fpm-pack.sh deb dependency1 dependency2`
+# first argument is the distro type, and the second argument is the version. All
+# subsequent arguments are the dependencies.
+# Example usage: `./fpm-pack.sh fedora-29 0.1.2 dependency1 dependency2`
# the binary to package
BINARY="mgmt"
@@ -31,52 +32,62 @@ if [ "$TAG" == "" ]; then
exit 1
fi
-if [ "$2" == "" ]; then
- echo "version was not specified"
+DISTRO="$1"
+if [ "$1" == "" ]; then
+ echo "distro was not specified"
exit 1
fi
VERSION="$2"
+if [ "$VERSION" == "" ]; then
+ echo "version was not specified"
+ exit 1
+fi
if [ "$VERSION" != "$TAG" ]; then
echo "you must checkout the correct version before building (${VERSION} != ${TAG})"
exit 1
fi
-# make sure the package type is valid
-if [ "$1" != "rpm" ] && [ "$1" != "deb" ] && [ "$1" != "pacman" ]; then
+# make sure the distro is a known valid one
+if [[ "$DISTRO" == fedora-* ]]; then
+ typ="rpm"
+elif [[ "$DISTRO" == centos-* ]]; then
+ typ="rpm"
+elif [[ "$DISTRO" == debian-* ]]; then
+ typ="deb"
+elif [[ "$DISTRO" == ubuntu-* ]]; then
+ typ="deb"
+elif [[ "$DISTRO" == archlinux ]]; then
+ typ="pacman"
+else
+ echo "unknown distro: ${DISTRO}."
+ exit 1
+fi
+
+if [ "$typ" != "rpm" ] && [ "$typ" != "deb" ] && [ "$typ" != "pacman" ]; then
echo "invalid package type"
exit 1
fi
+# assume the file extension
+ext="$typ"
+if [ "$typ" = "pacman" ]; then # archlinux is an exception
+ ext=".tar.xz"
+fi
+
# don't run if the file already exists (bad idempotent implementation)
-if [ -d "${DIR}/${VERSION}/${1}/" ]; then
- if [ "$1" = "rpm" ]; then
- if ls "${DIR}/${VERSION}/${1}/"*.rpm &>/dev/null; then
- # update timestamp so the Makefile is happy =D
- touch "${DIR}/${VERSION}/${1}/"*.rpm
- echo "a .rpm already exists"
- exit 0 # don't error, we want to be idempotent
- fi
- fi
- if [ "$1" = "deb" ]; then
- if ls "${DIR}/${VERSION}/${1}/"*.deb &>/dev/null; then
- touch "${DIR}/${VERSION}/${1}/"*.deb
- echo "a .deb already exists"
- exit 0
- fi
- fi
- if [ "$1" = "pacman" ]; then
- if ls "${DIR}/${VERSION}/${1}/"*.tar.xz &>/dev/null; then
- touch "${DIR}/${VERSION}/${1}/"*.tar.xz
- echo "a .tar.xz already exists"
- exit 0
- fi
+if [ -d "${DIR}/${VERSION}/${DISTRO}/" ]; then
+ if ls "${DIR}/${VERSION}/${DISTRO}/"*."${ext}" &>/dev/null; then
+ # update timestamp so the Makefile is happy =D
+ touch "${DIR}/${VERSION}/${DISTRO}/"*."${ext}"
+ echo "a .${ext} already exists"
+ exit 0 # don't error, we want to be idempotent
fi
fi
# there are no changelogs for pacman packages
-if [ "$1" != "pacman" ]; then
- CHANGELOG="--${1}-changelog=${DIR}/${VERSION}/${1}/changelog"
+if [ "$typ" != "pacman" ]; then
+ CHANGELOG="--${typ}-changelog=${DIR}/${VERSION}/${DISTRO}/changelog"
fi
# arguments after the first two are deps
@@ -85,7 +96,7 @@ for i in "${@:3}"; do
done
# in case the `fpm` gem bin isn't in the $PATH
-if which ruby >/dev/null && which gem >/dev/null && ! command -v fpm 2>/dev/null; then
+if command -v ruby >/dev/null && command -v gem >/dev/null && ! command -v fpm 2>/dev/null; then
PATH="$(ruby -r rubygems -e 'puts Gem.user_dir')/bin:$PATH"
fi
@@ -99,8 +110,8 @@ fpm \
--description "$DESCRIPTION" \
--license "$LICENSE" \
--input-type dir \
- --output-type "$1" \
- --package "${DIR}/${VERSION}/${1}/" \
+ --output-type "$typ" \
+ --package "${DIR}/${VERSION}/${DISTRO}/" \
${CHANGELOG} \
${DEPS} \
--prefix "$PREFIX" \
diff --git a/misc/make-deb-changelog.sh b/misc/make-deb-changelog.sh
index 0e41bbc1..03205ba7 100755
--- a/misc/make-deb-changelog.sh
+++ b/misc/make-deb-changelog.sh
@@ -2,9 +2,19 @@
# This script generates a deb changelog from the project's git history.
# version we're releasing
-VERSION="$1"
+DISTRO="$1"
+VERSION="$2"
+if [ "$VERSION" = "" ]; then
+ echo "usage: ./$0 "
+ exit 1
+fi
# path to store the changelog
-CHANGELOG="releases/${VERSION}/deb/changelog"
+CHANGELOG="releases/${VERSION}/${DISTRO}/changelog"
+dir="$(dirname "$CHANGELOG")/"
+if [ ! -d "$dir" ]; then
+ echo "changelog dir ($dir) does not exist"
+ exit 1
+fi
# input to format flag for git tag
TAG_FORMAT="-- %(creator) %(creatordate:format:%a, %d %b %Y %H:%M:%S %z) %(refname:lstrip=2)"
# a list of tags to be parsed in the loop
diff --git a/misc/make-rpm-changelog.sh b/misc/make-rpm-changelog.sh
index 46202d55..e55326f7 100755
--- a/misc/make-rpm-changelog.sh
+++ b/misc/make-rpm-changelog.sh
@@ -2,9 +2,19 @@
# This script generates an rpm changelog from the project's git history.
# version we're releasing
-VERSION="$1"
+DISTRO="$1"
+VERSION="$2"
+if [ "$VERSION" = "" ]; then
+ echo "usage: ./$0 "
+ exit 1
+fi
# path to store the changelog
-CHANGELOG="releases/${VERSION}/rpm/changelog"
+CHANGELOG="releases/${VERSION}/${DISTRO}/changelog"
+dir="$(dirname "$CHANGELOG")/"
+if [ ! -d "$dir" ]; then
+ echo "changelog dir ($dir) does not exist"
+ exit 1
+fi
# input to format flag for git tag
TAG_FORMAT="* %(creatordate:format:%a %b %d %Y) %(creator) %(refname:lstrip=2)"
# a list of tags to be parsed in the loop
diff --git a/misc/mkosi/make.sh b/misc/mkosi/make.sh
index 326cf870..6fc47a12 100755
--- a/misc/mkosi/make.sh
+++ b/misc/mkosi/make.sh
@@ -9,21 +9,18 @@ ROOT=$(dirname "${BASH_SOURCE}")
cd "${ROOT}"
#pwd
-if [ "$3" = "" ]; then
+if [ "$2" = "" ]; then
# output should be an absolute path
- echo "Usage: ./$0