From 94fc6d49c2c624464cd4d094d91ea7d5312c080e Mon Sep 17 00:00:00 2001 From: Marius Strobl Date: Mon, 20 Feb 2006 20:10:14 +0000 Subject: - Switch to a rc.d startup script. - Remove obsolete USE_REINPLACE. Approved by: netchild --- sysutils/afbinit/Makefile | 12 +++---- sysutils/afbinit/files/afbinit.sh.in | 42 ++++++++++++++++++++++ sysutils/afbinit/files/patch-debian::afbinit.init | 44 ----------------------- sysutils/afbinit/pkg-message | 4 +++ sysutils/afbinit/pkg-plist | 1 - 5 files changed, 51 insertions(+), 52 deletions(-) create mode 100644 sysutils/afbinit/files/afbinit.sh.in delete mode 100644 sysutils/afbinit/files/patch-debian::afbinit.init (limited to 'sysutils/afbinit') diff --git a/sysutils/afbinit/Makefile b/sysutils/afbinit/Makefile index 287464f7aeb7..c737a9578162 100644 --- a/sysutils/afbinit/Makefile +++ b/sysutils/afbinit/Makefile @@ -7,7 +7,7 @@ PORTNAME= afbinit PORTVERSION= 1.0 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= sysutils graphics MASTER_SITES= ${MASTER_SITE_DEBIAN} MASTER_SITE_SUBDIR= pool/contrib/a/afbinit @@ -22,18 +22,18 @@ MAINTAINER= marius@FreeBSD.org COMMENT= Sun AFB aka Sun Elite 3D microcode firmware loader ONLY_FOR_ARCHS= sparc64 -USE_REINPLACE= yes +USE_RC_SUBR= afbinit.sh WRKSRC= ${WRKDIR}/${DISTNAME:S/_/-/} PKGMESSAGE= ${WRKDIR}/pkg-message MAN8= afbinit.8 post-patch: -.for i in afbinit.c debian/afbinit.8 debian/afbinit.init +.for i in afbinit.c debian/afbinit.8 @${REINPLACE_CMD} -E -e 's|\/usr\/lib|${DATADIR}|g; \ s|(\/dev\/fb\[)[0-3]+(\])|\10-7\2|g; \ - s|\/etc\/init.d\/afb|${PREFIX}/etc/afbinit.sh|g; \ - s|\/usr\/sbin|${PREFIX}/sbin|g' ${WRKSRC}/${i} + s|\/etc\/init.d\/afb|${PREFIX}/etc/rc.d/afbinit\{,.sh\}|g' \ + ${WRKSRC}/${i} .endfor @${SED} 's|%%DATADIR%%|${DATADIR}|g' ${PKGDIR}/pkg-message > \ ${WRKDIR}/pkg-message @@ -44,8 +44,6 @@ do-build: do-install: @${INSTALL_PROGRAM} ${WRKSRC}/afbinit ${PREFIX}/sbin @${INSTALL_MAN} ${WRKSRC}/debian/afbinit.8 ${PREFIX}/man/man8 - @${INSTALL_SCRIPT} ${WRKSRC}/debian/afbinit.init \ - ${PREFIX}/etc/rc.d/afbinit.sh @${INSTALL} -d ${DATADIR} post-install: diff --git a/sysutils/afbinit/files/afbinit.sh.in b/sysutils/afbinit/files/afbinit.sh.in new file mode 100644 index 000000000000..4af10f97013e --- /dev/null +++ b/sysutils/afbinit/files/afbinit.sh.in @@ -0,0 +1,42 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: afbinit +# REQUIRE: devfs +# +# Available configuration variables for afbinit are: +# +# afbinit_enable (bool): Set to "YES" to enable afbinit. +# Defaults to "NO". +# +# Add at least the following line to /etc/rc.conf or /etc/rc.conf.local to +# enable afbinit: +# +# afbinit="YES" +# + +. %%RC_SUBR%% + +name="afbinit" +rcvar=${name}_enable + +start_cmd="afbinit_startcmd" + +afbinit_startcmd() +{ + if [ ! -r %%DATADIR%%/afb.ucode ]; then + err 1 '%%DATADIR%%/afb.ucode is not readable.' + fi + + for fb in /dev/fb[0-7]; do + %%PREFIX%%/sbin/afbinit ${fb} %%DATADIR%%/afb.ucode + done +} + +load_rc_config $name + +: ${afbinit_enable="NO"} + +run_rc_command "$1" diff --git a/sysutils/afbinit/files/patch-debian::afbinit.init b/sysutils/afbinit/files/patch-debian::afbinit.init deleted file mode 100644 index 7001bf00d7e1..000000000000 --- a/sysutils/afbinit/files/patch-debian::afbinit.init +++ /dev/null @@ -1,44 +0,0 @@ ---- debian/afbinit.init.orig Mon Sep 15 17:41:40 2003 -+++ debian/afbinit.init Mon Sep 15 18:08:15 2003 -@@ -1,35 +1,28 @@ - #!/bin/sh - --PATH=/sbin:/bin:/usr/sbin:/usr/bin --set -e -- - # This only applies to UltraSPARC's --[ `uname -m` = "sparc64" ] || exit 0 -+[ `/usr/bin/uname -m` = "sparc64" ] || exit 0 - - # The microcode loader binary and the microcode itself must exist. - if [ ! -x /usr/sbin/afbinit -o ! -f /usr/lib/afb.ucode ]; then - exit - fi - --# Need a better way to test this --[ `dmesg | grep -c "Elite 3D"` -ne 0 ] || exit -- - case "$1" in - start) - # Make FB device list. -- afb_devs=`/bin/dmesg | /bin/egrep -i "Elite 3D" | /bin/sed 's/\:.*//'` -+ afb_devs=`/bin/ls /dev/fb[0-7]` - - # Load microcode onto each card. - for AFB in ${afb_devs}; do -- echo -n "${AFB}: Loading Elite3D microcode... " -- /usr/sbin/afbinit /dev/${AFB} /usr/lib/afb.ucode -- echo "done." -+ /usr/sbin/afbinit ${AFB} /usr/lib/afb.ucode > /dev/null - done -+ echo -n ' afbinit' - ;; -- stop|restart|force-reload) # Nothing -+ stop|restart) # Nothing - ;; - *) -- echo "Usage: $0 start" >&2 -+ echo "Usage: `basename $0` start" >&2 - exit 1 - ;; - esac diff --git a/sysutils/afbinit/pkg-message b/sysutils/afbinit/pkg-message index d5656197e4c0..9f7244956f72 100644 --- a/sysutils/afbinit/pkg-message +++ b/sysutils/afbinit/pkg-message @@ -2,5 +2,9 @@ In order to use afbinit(8) you have to manually copy /usr/lib/afb.ucode from a SunOS/Solaris installation over to %%DATADIR%%. +In order to automatically load the microcode during boot add the following +line to to /etc/rc.conf or /etc/rc.conf.local: + +afbinit_enable="YES" =========================================================================== diff --git a/sysutils/afbinit/pkg-plist b/sysutils/afbinit/pkg-plist index 60cb39356474..c222e0822625 100644 --- a/sysutils/afbinit/pkg-plist +++ b/sysutils/afbinit/pkg-plist @@ -1,4 +1,3 @@ -etc/rc.d/afbinit.sh sbin/afbinit @exec install -d %D/%%DATADIR%% @unexec rmdir %D/%%DATADIR%% 2> /dev/null || echo "If permanently deleting this package, %D/%%DATADIR%% and its contents must be removed manually." -- cgit v1.2.3