]>
git.ipfire.org Git - thirdparty/lldpd.git/blob - osx/lldpd.rb
4 homepage
'http://vincentbernat.github.com/lldpd/'
5 url
'http://media.luffy.cx/files/lldpd/lldpd-0.7.3.tar.gz'
6 md5
'dcf567779c1b31e8b88e52848160c440'
8 option
'with-snmp', "Build SNMP subagent support"
9 option
'with-json', "Build JSON support for lldpcli"
13 depends_on
'pkg-config'
14 depends_on
'net-snmp' if build
.include? 'with-snmp'
15 depends_on
'jansson' if build
.include? 'with-json'
18 readline
= Formula
.factory
'readline'
19 args
= [ "--prefix=#{prefix}",
22 "--with-privsep-chroot=/var/empty",
23 "CPPFLAGS=-I#{readline.include} -DRONLY=1",
24 "LDFLAGS=-L#{readline.lib}" ]
25 args
<< "--with-snmp" if build
.include? 'with-snmp'
26 args
<< "--with-json" if build
.include? 'with-json'
28 system
"./configure", *args
34 result
= `dscl . -#{args.join(' ')} 2> /dev/null`
36 raise ErrorDuringExecution
, "Failure while executing dscl: #{args.join(' ')}"
41 # Create user and group if needed
44 unless Kernel
.system
"/usr/bin/dscl . -read /Users/#{u} &> /dev/null"
46 uids
= dscl("list /Users uid")
47 gids
= dscl("list /Groups gid")
49 while uids
=~ Regexp
.new("#{Regexp.escape(uid.to_s)}\n") || gids
=~ Regexp
.new("#{Regexp.escape(uid.to_s)}\n")
53 You need to create a special user to run lldpd.
54 Just type the following commands:
55 sudo dscl . -create /Groups/#{u}
56 sudo dscl . -create /Groups/#{u} PrimaryGroupID #{uid.to_s}
57 sudo dscl . -create /Groups/#{u} Password "*"
58 sudo dscl . -create /Groups/#{u} RealName "lldpd privilege separation group"
59 sudo dscl . -create /Users/#{u}
60 sudo dscl . -create /Users/#{u} UserShell /usr/bin/false
61 sudo dscl . -create /Users/#{u} NFSHomeDirectory /var/empty
62 sudo dscl . -create /Users/#{u} PrimaryGroupID #{uid.to_s}
63 sudo dscl . -create /Users/#{u} UniqueID #{uid.to_s}
64 sudo dscl . -create /Users/#{u} Password "*"
65 sudo dscl . -create /Users/#{u} RealName "lldpd privilege separation user"
71 plist_options
:startup => true
74 if build
.include? 'with-snmp'
75 additional_args
+= "<string>-x</string>"
78 <?xml version="1.0" encoding="UTF-8"?>
79 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
83 <string>#{plist_name}</string>
84 <key>ProgramArguments</key>
86 <string>#{opt_prefix}/sbin/lldpd</string>
89 <key>RunAtLoad</key><true/>
90 <key>KeepAlive</key><true/>