/src/compat/Makefile.in
/src/Makefile.in
/tests/Makefile.in
-/man/Makefile.in
+/osx/Makefile.in
/ar-lib
# cscope
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = src/compat src src/daemon src/lib src/client tests
+SUBDIRS = src/compat src src/daemon src/lib src/client tests osx
EXTRA_DIST = $(DX_CONFIG) include get-version autogen.sh
DIST_SUBDIRS = $(SUBDIRS) libevent
DISTCLEANFILES = ChangeLog
lldpd (0.7.6)
+ * Features:
+ + Provide a way to build packages for OSX.
* Fixes:
+ Compilation fix for OSX 10.6.
This formula includes the ability to interface properly with launchd
to start `lldpd` at boot.
+You can also build a package with:
+
+ make -C osx pkg
+
+To avoid the package being dependent of the system you built it on,
+you are advised to use the following `./configure` invocation:
+
+ ./configure CC="gcc -arch i386 -arch x86_64" CPP="gcc -E" \
+ --prefix=/usr --sysconfdir=/etc --with-embedded-libevent
+
Usage
-----
AC_CONFIG_HEADER([config.h])
AC_CONFIG_FILES([Makefile src/Makefile src/compat/Makefile src/daemon/Makefile
src/lib/Makefile src/lib/lldpctl.pc src/client/Makefile
- tests/Makefile])
+ tests/Makefile
+ osx/Makefile osx/distribution.xml osx/im.bernat.lldpd.plist
+ osx/scripts/postinstall osx/scripts/preinstall])
AC_CONFIG_MACRO_DIR([m4])
# Configure automake
--- /dev/null
+EXTRA_DIST = resources
+
+if HOST_OS_OSX
+
+# What we need to build the package
+PKGBUILD=/usr/bin/pkgbuild
+PRODUCTBUILD=/usr/bin/productbuild
+requirements:
+ @test -x $(PKGBUILD) || { echo "Needs pkgbuild ($(PKGBUILD))." ; exit 2 ; }
+ @test -x $(PRODUCTBUILD) || { echo "Needs productbuild ($(PRODUCTBUILD))." ; exit 2 ; }
+
+PKG_NAME=@PACKAGE@-@VERSION@.pkg
+PKG_TITLE=@PACKAGE@ @VERSION@
+PKG_DIR=@PACKAGE@-@VERSION@
+
+# Main target is `pkg`
+pkg: requirements ../$(PKG_NAME)
+ @echo "The package has been built in ../$(PKG_NAME)."
+
+# This is the package (to be built with productbuild)
+../$(PKG_NAME): pkg.1/$(PKG_NAME) distribution.xml resources
+ $(PRODUCTBUILD) \
+ --distribution distribution.xml \
+ --resources resources \
+ --package-path pkg.1 \
+ --version @VERSION@ \
+ $@
+
+# This is a component. We only have one. We could have more and
+# provide optional components to be installed.
+pkg.1/$(PKG_NAME): $(PKG_DIR) scripts
+ [ -d pkg.1 ] || mkdir pkg.1
+ $(PKGBUILD) \
+ --root $(PKG_DIR) \
+ --identifier im.bernat.@PACKAGE@.daemon \
+ --version @VERSION@ \
+ --ownership recommended \
+ --scripts scripts \
+ $@
+$(PKG_DIR): stamp-$(PKG_DIR)
+stamp-$(PKG_DIR): im.bernat.lldpd.plist
+ $(MAKE) -C $(top_builddir) install DESTDIR=$(abs_builddir)/$(PKG_DIR)
+ touch $@
+
+# Install launchd plist
+install-data-local:
+ install -m 0755 -d $(DESTDIR)/Library/LaunchDaemons
+ install -m 0644 im.bernat.lldpd.plist $(DESTDIR)/Library/LaunchDaemons
+uninstall-local:
+ rm -rf $(DESTDIR)/Library/LaunchDaemons
+clean-local:
+ rm -rf $(PKG_DIR)
+ rm -f stamp-$(PKG_DIR)
+ rm -rf pkg.1
+ rm -f ../$(PKG_NAME)
+
+.PHONY: pkg requirements
+
+endif
--- /dev/null
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<!-- The documentation for this file is available here:
+ https://developer.apple.com/library/mac/#documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html -->
+<installer-gui-script minSpecVersion="1">
+ <title>@PACKAGE@ @VERSION@</title>
+ <organization>im.bernat.@PACKAGE@</organization>
+ <welcome file="Welcome.rtf" mime-type="text/rtf" />
+ <license file="license.txt" mime-type="text/plain" />
+ <pkg-ref id="im.bernat.@PACKAGE@.daemon"/>
+ <domains enable_localSystem="true"/>
+ <options customize="never" require-scripts="true" rootVolumeOnly="true" />
+ <choices-outline>
+ <line choice="im.bernat.@PACKAGE@.daemon"/>
+ </choices-outline>
+ <choice
+ id="im.bernat.@PACKAGE@.daemon"
+ visible="false"
+ title="lldpd daemon"
+ description="The LLDP daemon and its client."
+ start_selected="true">
+ <pkg-ref id="im.bernat.@PACKAGE@.daemon"/>
+ </choice>
+ <pkg-ref
+ id="im.bernat.@PACKAGE@.daemon"
+ version="0"
+ onConclusion="none"
+ auth="root">@PACKAGE@-@VERSION@.pkg</pkg-ref>
+</installer-gui-script>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Label</key>
+ <string>im.bernat.lldpd</string>
+ <key>ProgramArguments</key>
+ <array>
+ <string>@prefix@/sbin/lldpd</string>
+ </array>
+ <key>RunAtLoad</key><true/>
+ <key>KeepAlive</key><true/>
+</dict>
+</plist>
--- /dev/null
+{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf390
+{\fonttbl\f0\fnil\fcharset0 Menlo-Regular;\f1\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
+\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\sa80\pardirnatural
+
+\f0\fs24 \cf0 lldp
+\f1 d is an ISC-licensed implementation of LLDP for various Unixes. It also supports some proprietary protocols.\
+\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\sa40\pardirnatural
+\cf0 LLDP allows you to know exactly on which port is a server (and reciprocally). It is an industry standard protocol designed to supplant proprietary Link-Layer protocols such as EDP or CDP. The goal of LLDP is to provide an inter-vendor compatible mechanism to deliver Link-Layer notifications to adjacent network devices.}
\ No newline at end of file
--- /dev/null
+Copyright (c) 2008-2013 Vincent Bernat <bernat@luffy.cx>
+
+Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--- /dev/null
+#!/bin/bash
+
+set -e
+
+user="@PRIVSEP_USER@"
+group="@PRIVSEP_GROUP@"
+
+dscl=/usr/bin/dscl
+$dscl . -read "/Users/${user}" &> /dev/null || {
+ # We need to find a free UID/GID
+ uid=200
+ while $($dscl . -list /Users uid | grep -q "\b${uid}$") || \
+ $($dscl . -list /Users gid | grep -q "\b${uid}$"); do
+ uid=$((${uid} + 1))
+ done
+ $dscl . -create /Groups/${group}
+ $dscl . -create /Groups/${group} PrimaryGroupID ${uid}
+ $dscl . -create /Groups/${group} Password "*"
+ $dscl . -create /Groups/${group} RealName "lldpd privilege separation group"
+ $dscl . -create /Users/${user}
+ $dscl . -create /Users/${user} UserShell /usr/bin/false
+ $dscl . -create /Users/${user} NFSHomeDirectory /var/empty
+ $dscl . -create /Users/${user} PrimaryGroupID ${uid}
+ $dscl . -create /Users/${user} UniqueID ${uid}
+ $dscl . -create /Users/${user} Password "*"
+ $dscl . -create /Users/${user} RealName "lldpd privilege separation user"
+}
+
+/bin/launchctl load "/Library/LaunchDaemons/im.bernat.lldpd.plist"
--- /dev/null
+#!/bin/bash
+
+set -e
+
+if /bin/launchctl list "im.bernat.lldpd" &> /dev/null; then
+ /bin/launchctl unload "/Library/LaunchDaemons/im.bernat.lldpd.plist"
+fi