wit-libvirt-tls-cert/Makefile

43 lines
1.3 KiB
Makefile

STAMP = $(shell date +%Y%m%d.%H%M%S)
ls:
@echo "make all # will make the cert file and debian package"
all:
make make-ca-private-key
make make-Certificate-Authority-Certificate-file
cd farm && make all
make create
make-ca-private-key:
certtool --generate-privkey > certificate_authority_key.pem
# umask 277 certificate_authority_key.pem
make ls
make-Certificate-Authority-Certificate-file:
certtool --generate-self-signed \
--template certificate_authority_template.info \
--load-privkey certificate_authority_key.pem \
--outfile certificate_authority_certificate.pem
create:
mkdir -p debian/files/etc/pki/CA/
mkdir -p debian/DEBIAN
cp control debian/DEBIAN/
echo "Version: 0."$(STAMP) >> debian/DEBIAN/control
echo "2.0" > debian/debian-binary
cp certificate_authority_key.pem debian/files/etc/pki/CA/cacert.pem
cp farm/*server_key.pem debian/files/etc/pki/CA/
chmod 444 debian/files/etc/pki/CA/*.pem
cd debian/files/ && md5sum etc/pki/CA/cacert.pem > ../DEBIAN/md5sum
cd debian/DEBIAN && tar --ignore-failed-read -cvJf ../control.tar.xz {post,pre}{inst,rm} md5sums control
cd debian/files && tar -cvJf ../data.tar.xz .
cd debian && ar rcs ../wit-libvirt-tls-cert.$(STAMP).deb debian-binary control.tar.xz data.tar.xz
dpkg-deb -I wit*.deb
clean:
rm -f *.pem
rm -f *.deb
rm -rf debian/
cd farm && make clean