Build and spec file updates for CentOS6

This commit is contained in:
Adam Ierymenko 2016-06-25 14:04:08 -07:00
parent 06e2e8119e
commit af0a205594
6 changed files with 240 additions and 6 deletions

View File

@ -0,0 +1,138 @@
#!/bin/bash
#
# zerotier-one Start the ZeroTier One network virtualization service
#
# chkconfig: 2345 55 25
# description: ZeroTier One allows systems to join and participate in \
# ZeroTier virtual networks. See https://www.zerotier.com/
#
# processname: zerotier-one
# config: /var/lib/zerotier-one/identity.public
# config: /var/lib/zerotier-one/identity.secret
# config: /var/lib/zerotier-one/local.conf
# config: /var/lib/zerotier-one/authtoken.secret
# pidfile: /var/lib/zerotier-one/zerotier-one.pid
### BEGIN INIT INFO
# Provides: zerotier-one
# Required-Start: $local_fs $network $syslog
# Required-Stop: $local_fs $syslog
# Should-Start: $syslog
# Should-Stop: $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the ZeroTier One network virtualization service
# Description: ZeroTier One allows systems to join and participate in
# ZeroTier virtual networks. See https://www.zerotier.com/
### END INIT INFO
# source function library
. /etc/rc.d/init.d/functions
# pull in sysconfig settings
[ -f /etc/sysconfig/zerotier-one ] && . /etc/sysconfig/zerotier-one
RETVAL=0
prog="zerotier-one"
lockfile=/var/lock/subsys/$prog
ZT="/usr/sbin/zerotier-one"
PID_FILE=/var/lib/zerotier-one/zerotier-one.pid
runlevel=$(set -- $(runlevel); eval "echo \$$#" )
start()
{
[ -x $ZT ] || exit 5
echo -n $"Starting $prog: "
$ZT $ZT_OPTIONS -d && success || failure
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $lockfile
echo
return $RETVAL
}
stop()
{
echo -n $"Stopping $prog: "
killproc -p $PID_FILE $ZT
RETVAL=$?
if [ "x$runlevel" = x0 -o "x$runlevel" = x6 ] ; then
trap '' TERM
killall $prog 2>/dev/null
trap TERM
fi
[ $RETVAL -eq 0 ] && rm -f $lockfile
echo
}
reload()
{
stop
start
}
restart() {
stop
start
}
force_reload() {
restart
}
rh_status() {
status -p $PID_FILE zerotier-one
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
start
;;
stop)
if ! rh_status_q; then
rm -f $lockfile
exit 0
fi
stop
;;
restart)
restart
;;
reload)
rh_status_q || exit 7
reload
;;
force-reload)
force_reload
;;
condrestart|try-restart)
rh_status_q || exit 0
if [ -f $lockfile ] ; then
do_restart_sanity_check
if [ $RETVAL -eq 0 ] ; then
stop
# avoid race
sleep 3
start
else
RETVAL=6
fi
fi
;;
status)
rh_status
RETVAL=$?
if [ $RETVAL -eq 3 -a -f $lockfile ] ; then
RETVAL=2
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}"
RETVAL=2
esac
exit $RETVAL

View File

@ -31,7 +31,7 @@ for distro in $*; do
mv zt1-src.tar.gz ../..
cd ..
docker run --rm -v `pwd`:/artifacts --privileged -it zt1-build-${distro}-x64 /bin/bash -c 'cd /ZeroTierOne ; make debian ; cd .. ; cp *.deb /artifacts ; ls -l /artifacts'
# docker run --rm -v `pwd`:/artifacts --privileged -it zt1-build-${distro}-x64 /bin/bash -c 'cd /ZeroTierOne ; make `[ -f /etc/debian_version ] && echo debian || echo redhat` ; cd .. ; cp *.deb /artifacts ; ls -l /artifacts'
cd x86
mv ../../zt1-src.tar.gz .
@ -39,7 +39,7 @@ for distro in $*; do
mv zt1-src.tar.gz ../..
cd ..
docker run --rm -v `pwd`:/artifacts --privileged -it zt1-build-${distro}-x86 /bin/bash -c 'cd /ZeroTierOne ; make debian ; cd .. ; cp *.deb /artifacts ; ls -l /artifacts'
# docker run --rm -v `pwd`:/artifacts --privileged -it zt1-build-${distro}-x86 /bin/bash -c 'cd /ZeroTierOne ; make `[ -f /etc/debian_version ] && echo debian || echo redhat` ; cd .. ; cp *.deb /artifacts ; ls -l /artifacts'
cd ..
done

View File

@ -0,0 +1,11 @@
FROM centos:6
MAINTAINER Adam Ierymenko <adam.ierymenko@zerotier.com>
RUN yum update -y
RUN yum install -y epel-release
RUN yum install -y clang make development-tools rpmdevtools http-parser-devel lz4-devel libnatpmp-devel
ADD zt1-src.tar.gz /
#RUN ln -sf /usr/bin/clang++-3.5 /usr/bin/clang++
#RUN ln -sf /usr/bin/clang-3.5 /usr/bin/clang

View File

@ -0,0 +1,11 @@
FROM toopher/centos-i386:centos6
MAINTAINER Adam Ierymenko <adam.ierymenko@zerotier.com>
RUN yum update -y
RUN yum install -y epel-release
RUN yum install -y clang make development-tools rpmdevtools http-parser-devel lz4-devel libnatpmp-devel
ADD zt1-src.tar.gz /
#RUN ln -sf /usr/bin/clang++-3.5 /usr/bin/clang++
#RUN ln -sf /usr/bin/clang-3.5 /usr/bin/clang

Binary file not shown.

View File

@ -1,6 +1,6 @@
Name: zerotier-one
Version: 1.1.5
Release: 0.3%{?dist}
Version: 1.1.6
Release: 0.1%{?dist}
Summary: ZeroTier One network virtualization service
License: GPLv3
@ -10,17 +10,32 @@ Source0: %{name}-%{version}.tar.gz
BuildRequires: http-parser-devel
BuildRequires: lz4-devel
BuildRequires: libnatpmp-devel
%if 0%{rhel} > 7
BuildRequires: libnatpmp-devel
BuildRequires: systemd
%endif
%if 0%{?fedora} >= 21
BuildRequires: systemd
BuildRequires: json-parser-devel
%endif
Requires: http-parser
Requires: lz4
Requires: libnatpmp
%if 0%{rhel} >= 7
Requires: systemd
%endif
%if 0%{rhel} <= 6
Requires: chkconfig
%endif
%if 0%{?fedora} >= 21
BuildRequires: json-parser
Requires: systemd
Requires: json-parser
%endif
Provides: bundled(miniupnpc) = 2.0
@ -54,28 +69,87 @@ make ZT_USE_MINIUPNPC=1 %{?_smp_mflags}
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
%if 0%{rhel} >= 7
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
cp debian/zerotier-one.service $RPM_BUILD_ROOT%{_unitdir}/%{name}.service
%endif
%if 0%{fedora} >= 21
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
cp debian/zerotier-one.service $RPM_BUILD_ROOT%{_unitdir}/%{name}.service
%endif
%if 0%{rhel} <= 6
cp ext/installfiles/linux/zerotier-one.init.rhel6 $RPM_BUILD_ROOT/etc/init.d/zerotier-one
chmod 0755 $RPM_BUILD_ROOT/etc/init.d/zerotier-one
%endif
%files
%{_sbindir}/*
%{_bindir}/*
%{_mandir}/*
%{_localstatedir}/*
%if 0%{rhel} >= 7
%{_unitdir}/%{name}.service
%endif
%if 0%{fedora} >= 21
%{_unitdir}/%{name}.service
%endif
%if 0%{rhel} <= 6
/etc/init.d/zerotier-one
%endif
%doc AUTHORS.md README.md
%license LICENSE.GPL-3
%post
%if 0%{rhel} >= 7
%systemd_post zerotier-one.service
%endif
%if 0%{fedora} >= 21
%systemd_post zerotier-one.service
%endif
%if 0%{rhel} <= 6
case "$1" in
1)
chkconfig --add zerotier-one
;;
2)
chkconfig --del newservice
chkconfig --add newservice
;;
esac
%endif
%preun
%if 0%{rhel} >= 7
%systemd_preun zerotier-one.service
%endif
%if 0%{fedora} >= 21
%systemd_preun zerotier-one.service
%endif
%if 0%{rhel} <= 6
case "$1" in
0)
service zerotier-one stop
chkconfig --del zerotier-one
;;
1)
# This is an upgrade.
:
;;
esac
%endif
%postun
%if 0%{rhel} >= 7
%systemd_postun_with_restart zerotier-one.service
%endif
%if 0%{fedora} >= 21
%systemd_postun_with_restart zerotier-one.service
%endif
%changelog
* Sat Jun 25 2016 Adam Ierymenko <adam.ierymenko@zerotier.com> - 1.1.6-0.1
- now builds on CentOS 6 as well as newer distros, and some cleanup
* Wed Jun 08 2016 François Kooman <fkooman@tuxed.net> - 1.1.5-0.3
- include systemd unit file
@ -83,4 +157,4 @@ cp debian/zerotier-one.service $RPM_BUILD_ROOT%{_unitdir}/%{name}.service
- add libnatpmp as (build)dependency
* Wed Jun 08 2016 François Kooman <fkooman@tuxed.net> - 1.1.5-0.1
- initial package
- initial package