Skip to content

Commit

Permalink
Clean up and implement a proper installer
Browse files Browse the repository at this point in the history
  • Loading branch information
nugget committed Jan 5, 2017
1 parent f88c41e commit 034eddf
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 20 deletions.
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
PREFIX?= /usr/local
LIBDIR?= lib
PROGNAME?= tcldnssrv

TARGET?= $(PREFIX)/$(LIBDIR)/$(PROGNAME)

TCLSH?= tclsh

UID?= root
GID?= wheel

all:

pkgindex:
@echo "Generating pkgIndex"
cd $(TARGET) ; umask 022 ; echo "pkg_mkIndex -direct . *.tcl" | $(TCLSH)

install-lib:
@echo "Installing $(PROGNAME) to $(TARGET)"
install -o $(UID) -g $(GID) -m 0755 -d $(TARGET)
install -o $(UID) -g $(GID) -m 0644 dnssrv.tcl $(TARGET)

install-package: install-lib pkgindex

install: install-package

uninstall:
@echo "Uninstalling $(PROGNAME)"
rm -rf $(TARGET)
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
[![GitHub
release](https://img.shields.io/github/release/nugget/tcl-dnssrv.svg)](https://github.com/nugget/tcl-dnssrv/releases)


# NAME

dnssrv - Tcl DNS SRV Client

# SYNOPSIS

package require dnssrv

````
package require dnssrv
::dnssrv::hostlist query ?options?
::dnssrv::tophost query ?options?
````
Expand Down
23 changes: 23 additions & 0 deletions example.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env tclsh

if {[catch {source dnssrv.tcl} err]} {
package require dnssrv
}

proc main {} {
lappend hostlist _sweighted._tcp.prod.macnugget.org
lappend hostlist _weighted._tcp.prod.macnugget.org
lappend hostlist _testservice._tcp.prod.macnugget.org

foreach fqdn $hostlist {
puts "# Probing ${fqdn}\n"
puts " \[::dnssrv::hostlist $fqdn\]"
puts " [::dnssrv::hostlist $fqdn]"
puts ""
puts " \[::dnssrv::tophost $fqdn\]"
puts " [::dnssrv::tophost $fqdn]"
puts "\n-- \n"
}
}

if !$tcl_interactive main
19 changes: 0 additions & 19 deletions main.tcl

This file was deleted.

0 comments on commit 034eddf

Please sign in to comment.