1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-20 20:09:11 +00:00

- Update to 0.3

- Add pkg-message
- Add filename remapping for tftp-hpa
- Use PYTHON_CMD in scripts
- Update master sites
- Pass maintainership to submitter

PR:		ports/115301
Submitted by:	Alex Deiter <tiamat at komi.mts.ru>
This commit is contained in:
Rong-En Fan 2007-08-12 11:03:16 +00:00
parent f03036d08d
commit ba7c5acdb8
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=197500
13 changed files with 177 additions and 91 deletions

View File

@ -6,13 +6,13 @@
#
PORTNAME= ris
PORTVERSION= 0.1
PORTVERSION= 0.3
CATEGORIES= net
MASTER_SITES= http://oss.netfarm.it/guides/ \
http://freebsd.komi.mtsnet.ru/ports/distfiles/
DISTNAME= ris-linux
http://m.komi.mtsnet.ru/FreeBSD/distfiles/
DISTNAME= ris-linux-${PORTVERSION}
MAINTAINER= ports@FreeBSD.org
MAINTAINER= tiamat@komi.mts.ru
COMMENT= OpenSource alternative to Microsoft Windows RIS
RUN_DEPENDS= ${LOCALBASE}/libexec/in.tftpd:${PORTSDIR}/ftp/tftp-hpa
@ -23,28 +23,43 @@ NO_BUILD= yes
VARDIR= /var
PID_FILE?= ${VARDIR}/run/binlsrv.pid
LOG_FILE?= ${VARDIR}/log/binlsrv.log
DEVLIST_CACHE?= ${VARDIR}/db/devlist.cache
PLIST_FILES= sbin/binlsrv.py sbin/decode.py \
sbin/fixloader.py sbin/infparser.py \
sbin/fixup-repository.sh
SCRIPTS= binlsrv.py decode.py \
fixloader.py hexdump.py \
infdump.py infparser.py \
modldr.py fixup-repository.sh
SUB_LIST= PYTHON_CMD=${PYTHON_CMD} \
PID_FILE=${PID_FILE} \
SUB_FILES= pkg-message
SUB_LIST= PYTHON_CMD=${PYTHON_CMD} \
PID_FILE=${PID_FILE} \
LOG_FILE=${LOG_FILE} \
DEVLIST_CACHE=${DEVLIST_CACHE}
post-patch:
.for SCRIPT in ${PLIST_FILES}
.for SCRIPT in ${SCRIPTS}
@${REINPLACE_CMD} -e \
's|@PYTHON_CMD@|${PYTHON_CMD}|; \
s|@PID_FILE@|${PID_FILE}|; \
s|@DEVLIST_CACHE@|${DEVLIST_CACHE}|' \
${WRKSRC}/${SCRIPT:S/sbin\///}
's|@PYTHON_CMD@|${PYTHON_CMD}|; \
s|@PID_FILE@|${PID_FILE}|; \
s|@LOG_FILE@|${LOG_FILE}|; \
s|@DEVLIST_CACHE@|${DEVLIST_CACHE}|' \
${WRKSRC}/${SCRIPT}
.endfor
do-install:
.for SCRIPT in ${PLIST_FILES}
${INSTALL_SCRIPT} ${WRKSRC}/${SCRIPT:S/sbin\///} ${PREFIX}/sbin
@${MKDIR} ${DATADIR}
@${MKDIR} ${DATADIR}/inf
@${MKDIR} ${DATADIR}/sys
@${INSTALL_DATA} ${WRKSRC}/winnt.sif ${DATADIR}
@${INSTALL_DATA} ${WRKSRC}/winnt-ris.sif ${DATADIR}
@${INSTALL_DATA} ${FILESDIR}/tftp.map ${DATADIR}
.for SCRIPT in ${SCRIPTS}
@${INSTALL_SCRIPT} ${WRKSRC}/${SCRIPT} ${DATADIR}
.endfor
post-install:
@${CAT} ${PKGMESSAGE}
.include <bsd.port.mk>

View File

@ -1,3 +1,3 @@
MD5 (ris-linux.tar.gz) = 23b8e9c73d3a37e2e9b90bb8433e7ace
SHA256 (ris-linux.tar.gz) = 9ecd127b520fea2dc16b24a0053e1d185c516abba9e3038b2029ff0dbcabb3e6
SIZE (ris-linux.tar.gz) = 10805
MD5 (ris-linux-0.3.tar.gz) = 1e089d285ea5651dd50325ac704dff70
SHA256 (ris-linux-0.3.tar.gz) = fca88b9c64fc93d1ff1abacfbe4ff96548d28739512326ffd6b70ea0289e3072
SIZE (ris-linux-0.3.tar.gz) = 19303

View File

@ -5,28 +5,35 @@
# BEFORE: LOGIN
# KEYWORD: shutdown
# Define these variables in one of these files:
# /etc/rc.conf
# /etc/rc.conf.local
# /etc/rc.conf.d/binlsrv
#
# Add the following lines to /etc/rc.conf to enable binlsrv:
#
# binlsrv_enable="YES"
# binlsrv_infdir="/path/to/dir_with_inf_files"
# binlsrv_infdir="/path/to/inf/files"
#
. /etc/rc.subr
. %%RC_SUBR%%
name="binlsrv"
rcvar=`set_rcvar`
command="%%PYTHON_CMD%%"
command_args="%%PREFIX%%/sbin/${name}.py -d"
required_dirs="${binlsrv_infdir}"
load_rc_config "${name}"
# Set defaults
: ${binlsrv_enable:="NO"}
: ${binlsrv_infdir:="%%PREFIX%%/share/ris/inf"}
pidfile="%%PID_FILE%%"
command="%%PYTHON_CMD%%"
command_args="%%PREFIX%%/share/ris/${name}.py -d"
required_dirs="$binlsrv_infdir"
start_precmd="binlsrv_start_precmd"
stop_postcmd="binlsrv_stop_postcmd"
binlsrv_start_precmd()
{
%%PREFIX%%/sbin/infparser.py ${binlsrv_infdir}
%%PREFIX%%/share/ris/infparser.py ${binlsrv_infdir}
}
binlsrv_stop_postcmd()
@ -34,8 +41,4 @@ binlsrv_stop_postcmd()
rm -f ${pidfile}
}
load_rc_config "$name"
: ${binlsrv_enable="NO"}
: ${binlsrv_infdir=""}
run_rc_command "$1"

View File

@ -1,39 +1,32 @@
--- binlsrv.py.orig Fri Sep 2 14:15:31 2005
+++ binlsrv.py Fri Sep 2 14:21:11 2005
--- binlsrv.py.orig Tue Aug 7 16:06:15 2007
+++ binlsrv.py Tue Aug 7 16:35:02 2007
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#! @PYTHON_CMD@
# -*- Mode: Python; tab-width: 4 -*-
#
# Boot Information Negotiation Layer - OpenSource Implementation
@@ -671,7 +671,12 @@
@@ -40,7 +40,7 @@
[--pid pidfile] [devlist.cache]
-h, --help : show this help
-d, --daemon : daemonize, unix only [false]
--l, --logfile= : logfile when used in daemon mode [/var/log/binlsrv.log]
+-l, --logfile= : logfile when used in daemon mode [@LOG_FILE@]
-a, --address= : ip address to bind to [all interfaces]
-p, --port= : port to bind to [4011]
--pid= : pid file to use instead of the default
@@ -839,11 +839,11 @@
## Defaults
global pidfile, s
daemon = False
- logfile = '/var/log/binlsrv.log'
+ logfile = '@LOG_FILE@'
address = ''
port = 4011
- devfile = 'devlist.cache'
- pidfile = '/var/run/binlsrv.pid'
+ devfile = '@DEVLIST_CACHE@'
+ pidfile = '@PID_FILE@'
import sys
- if (fork()): sys_exit()
+ pid=fork()
+ if (pid):
+ pidfile=open('@PID_FILE@', 'w')
+ pidfile.write('%d\n' % pid)
+ pidfile.close()
+ sys_exit()
close(sys.stdin.fileno())
sys.stdin = open('/dev/null')
@@ -683,7 +688,7 @@
sys.stderr = Log(open(LOGFILE, 'a+'))
try:
- devlist = load(open('devlist.cache'))
+ devlist = load(open('@DEVLIST_CACHE@'))
except:
print 'Could not load devlist.cache, build it with infparser.py'
sys_exit(-1)
@@ -694,7 +699,6 @@
s = socket(AF_INET, SOCK_DGRAM)
s.bind(('', 4011))
- print 'Binlserver started... pid %d' % getpid()
while 1:
addr, t, data = get_packet(s)
if t == FILEREQ:
## Parse command line arguments
shortopts = 'hdl:a:p:'

View File

@ -0,0 +1,8 @@
--- decode.py.orif Tue Aug 7 16:37:19 2007
+++ decode.py Tue Aug 7 16:37:41 2007
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#! @PYTHON_CMD@
# -*- Mode: Python; tab-width: 4 -*-
#
# Boot Information Negotiation Layer Packet decoder

View File

@ -0,0 +1,8 @@
--- fixloader.py.orig Tue Aug 7 16:38:09 2007
+++ fixloader.py Tue Aug 7 16:38:22 2007
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#! @PYTHON_CMD@
# -*- Mode: Python; tab-width: 4 -*-
#
# Fix for setuploader

View File

@ -0,0 +1,8 @@
--- hexdump.py.orig Tue Aug 7 16:39:44 2007
+++ hexdump.py Tue Aug 7 16:39:56 2007
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#! @PYTHON_CMD@
# -*- Mode: Python; tab-width: 4 -*-
#
# Boot Information Negotiation Layer Packet Dumper

View File

@ -0,0 +1,8 @@
--- infdump.py.orig Tue Aug 7 16:40:17 2007
+++ infdump.py Tue Aug 7 16:40:51 2007
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#! @PYTHON_CMD@
# -*- Mode: Python; tab-width: 4 -*-
#
# Inf Cache dumper

View File

@ -1,37 +1,38 @@
--- infparser.py.orig Fri Sep 2 14:15:32 2005
+++ infparser.py Fri Sep 2 14:18:12 2005
--- infparser.py.orig Tue Aug 7 16:10:14 2007
+++ infparser.py Tue Aug 7 17:09:32 2007
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#! @PYTHON_CMD@
# -*- Mode: Python; tab-width: 4 -*-
#
# Inf Driver parser
@@ -143,7 +143,7 @@
if name.endswith('.services'):
prefix = name.split('.services', 1)[0]
check = prefix.split('.')
- if check[-1].startswith('nt'):
+ if check[-1].startswith('nt') and not check[-1].endswith('64'):
check = check[:-1]
check = check + ['services']
name = '.'.join(check)
@@ -154,7 +154,7 @@
while check[-1].isdigit() and len(check)>1:
check = check[:-1]
- if check[-1].startswith('nt'):
+ if check[-1].startswith('nt') and not check[-1].endswith('64'):
check = check[:-1]
name = '.'.join(check)
@@ -283,8 +283,8 @@
@@ -293,28 +293,6 @@
if inffile.split('/').pop() not in exclude:
devlist.update(scan_inf(inffile))
- print 'Compiled %d drivers' % len(devlist)
+ print 'Starting inf parser: compiled %d drivers.' % len(devlist)
- fd = open('devlist.cache','w')
+ fd = open('@DEVLIST_CACHE@','w')
- print 'Compiled %d drivers' % len(devlist)
-
- fd = open('devlist.cache', 'w')
+ fd = open('@DEVLIST_CACHE@', 'w')
dump(devlist, fd)
fd.close()
- print 'generated devlist.cache'
-
- fd = open('nics.txt', 'w')
- drvhash = {}
- for nic in devlist.items():
- entry = nic[0].split('&')
- if len(entry) < 2: continue # just to be sure
- if not entry[0].startswith('PCI'): continue # skip usb
- vid = entry[0].split('VEN_').pop().lower()
- pid = entry[1].split('DEV_').pop().lower()
- key = (vid, pid)
- line = '%4s %4s %s %s\n' % (vid, pid, nic[1]['drv'], nic[1]['svc'])
- drvhash[key] = line
-
- drvlist = drvhash.values()
- drvlist.sort()
- fd.writelines(drvlist)
- fd.close()
-
- print 'generated nics.txt'

View File

@ -0,0 +1,8 @@
--- modldr.py.orig Tue Aug 7 16:41:37 2007
+++ modldr.py Tue Aug 7 16:41:50 2007
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#! @PYTHON_CMD@
# -*- Mode: Python; tab-width: 4 -*-
#
# Windows OSLoader Modification Tool

View File

@ -0,0 +1,15 @@
You can use the following parameters on /etc/rc.conf:
binlsrv_enable (bool): Set to "NO" by default.
Set it to "YES" to enable binlsrv.
binlsrv_infdir (path): Set to "%%PREFIX%%/share/ris/inf" by default.
Set it to your directory with inf files.
Put all *.inf files into ${binlsrv_infdir} and start binlsrv.
You can use the following parameters on /etc/inetd.conf:
tftp dgram udp wait root %%PREFIX%%/libexec/in.tftpd in.tftpd -v -m %%PREFIX%%/share/ris/tftp.map -s /tftpboot
See http://oss.netfarm.it/guides/ for more details.

2
net/ris/files/tftp.map Normal file
View File

@ -0,0 +1,2 @@
rg \\ /
r .* \L\0

17
net/ris/pkg-plist Normal file
View File

@ -0,0 +1,17 @@
@stopdaemon binlsrv
%%DATADIR%%/tftp.map
%%DATADIR%%/winnt.sif
%%DATADIR%%/winnt-ris.sif
%%DATADIR%%/binlsrv.py
%%DATADIR%%/decode.py
%%DATADIR%%/fixloader.py
%%DATADIR%%/hexdump.py
%%DATADIR%%/infdump.py
%%DATADIR%%/infparser.py
%%DATADIR%%/modldr.py
%%DATADIR%%/fixup-repository.sh
@exec mkdir -p %D/%%DATADIR%%/inf
@exec mkdir -p %D/%%DATADIR%%/sys
@dirrmtry %%DATADIR%%/inf
@dirrmtry %%DATADIR%%/sys
@dirrmtry %%DATADIR%%