aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--misc/afbackup/Makefile13
-rw-r--r--misc/afbackup/files/patch-aj42
-rw-r--r--misc/afbackup/pkg-install93
-rw-r--r--misc/afbackup/pkg-message16
4 files changed, 104 insertions, 60 deletions
diff --git a/misc/afbackup/Makefile b/misc/afbackup/Makefile
index 2c95dbb645c4..630f4ea6cd7c 100644
--- a/misc/afbackup/Makefile
+++ b/misc/afbackup/Makefile
@@ -7,6 +7,7 @@
PORTNAME= afbackup
PORTVERSION= 3.3.5
+PORTREVISION= 1
CATEGORIES?= misc
MASTER_SITES= ftp://ftp.vic.com/af/ \
${MASTER_SITE_SOURCEFORGE}
@@ -33,7 +34,7 @@ MAKE_ARGS+= NO_GUI=yes
.endif
USE_AUTOCONF= yes
USE_LIBTOOL= yes
-.if defined(NO_AUTOKEY) && defined(BATCH)
+.if defined(NO_AUTOKEY) && defined(PACKAGE_BUILDING)
INGORE = "cannot be build in batch mode whithout automated DES key generation"
.endif
@@ -125,6 +126,12 @@ AFBACKUP_DOCS= CONFIG \
changer.conf.mtx \
changer.conf.stctl
+.if defined(PACKAGE_BUILDING)
+PKGINSTALL_ENV= "NONINTERACTIVE=YES"
+.else
+PKGINSTALL_ENV=
+.endif
+
.if !defined(WITHOUT_SERVER) && !defined(WITHOUT_CLIENT) \
&& !defined(WITHOUT_REXECLINKS) && !defined(NO_GUI) \
&& !defined(NO_DES) && !defined(NO_AUTOKEY)
@@ -144,6 +151,7 @@ pre-fetch:
pre-configure:
@${CP} ${FILESDIR}/configure.in ${FILESDIR}/Makefile.in ${WRKSRC}
+ @${CP} ${WRKSRC}/changer.conf.chio ${WRKSRC}/changer.conf
.if !defined(NO_AUTOKEY) && !defined(NO_DES)
pre-build:
@@ -163,7 +171,7 @@ pre-install:
@${ECHO} @cwd ${PREFIX} >>${PLIST}
@${ECHO} @dirrm share/doc/${PORTNAME} >>${PLIST}
.endif
- @${PKGINSTALL} ${PKGNAME} PRE-INSTALL
+ @$(PKGINSTALL_ENV) ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
post-install:
.if !defined(NO_AUTOKEY)
@@ -183,6 +191,5 @@ post-install:
@${ECHO} " you want."
@${ECHO} "-------------------------------------------------------------------"
.endif
- @${PKGINSTALL} ${PKGNAME} POST-INSTALL
.include <bsd.port.mk>
diff --git a/misc/afbackup/files/patch-aj b/misc/afbackup/files/patch-aj
new file mode 100644
index 000000000000..c5d60559655d
--- /dev/null
+++ b/misc/afbackup/files/patch-aj
@@ -0,0 +1,42 @@
+--- sysutils.c.orig Wed Sep 12 20:29:45 2001
++++ sysutils.c Mon Jan 21 21:55:47 2002
+@@ -37,6 +37,9 @@
+ #include <grp.h>
+ #include <sysutils.h>
+ #include <fileutil.h>
++#ifdef __FreeBSD__
++#include <sys/sysctl.h>
++#endif
+
+ #define GETOUT { goto getout; }
+ #define CLEANUP { goto cleanup; }
+@@ -763,9 +766,20 @@
+ Int32
+ free_fds()
+ {
+- int *fds = NULL, *newfds = NULL, fd;
+ Int32 num_fds = 0;
+
++#ifdef __FreeBSD__
++ /* This code is for avoiding race conditions with other processes which
++ * might need a spare file descriptor while afbackup tries to find out
++ * how many of those it can use. sysctl gives us more general yet less
++ * reliable answer as it is does not count on a number of possibly
++ * opened files. */
++ size_t sz = sizeof( Int32);
++
++ sysctlbyname( "kern.maxfilesperproc", &num_fds, &sz, NULL, 0);
++#else
++ int *fds = NULL, *newfds = NULL, fd;
++
+ while((fd = open(NULLDEV, O_RDONLY)) >= 0){
+ newfds = ZSRENEWP(fds, int, num_fds + 1, num_fds);
+
+@@ -784,6 +798,7 @@
+ close(fds[fd]);
+
+ free(fds);
++#endif
+
+ return(num_fds);
+ }
diff --git a/misc/afbackup/pkg-install b/misc/afbackup/pkg-install
index 1227ea4e0300..6433712452ec 100644
--- a/misc/afbackup/pkg-install
+++ b/misc/afbackup/pkg-install
@@ -3,16 +3,35 @@
#set -vx
PKG_BATCH=${BATCH:=NO}
-
PKG_PREFIX=${PKG_PREFIX:=/usr/local}
+SERVERVARDIR=/var/spool/afbackup
+
#
# create 'afbackup' user before installing
#
+dlg() {
+ if [ X"${NONINTERACTIVE}" != "XYES" ]; then
+ dialog "$@"
+ return $?
+ else
+ i=1
+ while [ $i -lt $# ]; do
+ eval 'arg="$'$i'"'
+ if [ $arg = '--msgbox' ]; then
+ eval 'echo "$'$(($i+1))'"'
+ return 0
+ fi
+ i=$(($i+1))
+ done
+ fi
+ return 0;
+}
+
create() {
if [ ! -x /usr/sbin/pw ]; then
- dialog --msgbox "Please add a user named \`afbackup' before installing this package." 6 60
+ dlg --msgbox "Please add a user named \`afbackup' before installing this package." 6 60
exit 69
fi
@@ -22,8 +41,8 @@ create() {
shell=/nonexistent
fi
if ! pw show user afbackup -q >/dev/null; then
- if ! dialog --clear --yesno "There is no user afbackup on your system.\n\nDo you want it to be created?" 7 60; then
- dialog --msgbox "Please add a user named \`afbackup' before installing this package." 6 60
+ if ! dlg --clear --yesno "There is no user afbackup on your system.\n\nDo you want it to be created?" 7 60; then
+ dlg --msgbox "Please add a user named \`afbackup' before installing this package." 6 60
exit 69
fi
uid=100
@@ -34,7 +53,7 @@ create() {
-c "AFBackup System Owner" -s "${shell}" \
; then
e=$?
- dialog --msgbox "Failed to add user \`afbackup'. Please add it manually." 6 60
+ dlg --msgbox "Failed to add an account for \`afbackup' user. Please add it manually." 6 60
exit ${e}
fi
echo "==> Added user \`afbackup' (id ${uid})"
@@ -43,68 +62,28 @@ create() {
-c "AFBackup System Owner" -s "${shell}" \
; then
e=$?
- dialog --msgbox "Failed to update user \`afbackup'." 6 60
+ dlg --msgbox "Failed to update user \`afbackup'." 6 60
exit ${e}
fi
echo "==> Updated user \`afbackup'."
fi
}
-install_services() {
- oldmask=`umask`
- umask 077
- egrep -v "^af.?backup" /etc/services >/tmp/services
- echo "afbackup 2988/tcp" >>/tmp/services
- echo "afmbackup 2989/tcp" >>/tmp/services
- # XXX what if the original file had another mode?
- install -m 0644 -o root -g wheel /tmp/services /etc/services
- umask $oldmask
-}
-
-install_inetd_services() {
- oldmask=`umask`
- umask 077
- egrep -v "^#?af.?backup" /etc/inetd.conf >/tmp/inetd.conf
- echo "afbackup stream tcp nowait afbackup ${PKG_PREFIX}/libexec/afbackup/afserver ${PKG_PREFIX}/libexec/afbackup/afserver ${PKG_PREFIX}/etc/afbackup/server.conf" >>/tmp/inetd.conf
- echo "afmbackup stream tcp nowait afbackup ${PKG_PREFIX}/libexec/afbackup/afmserver ${PKG_PREFIX}/libexec/afbackup/afmserver ${PKG_PREFIX}/etc/afbackup/server.conf" >>/tmp/inetd.conf
- # XXX what if the original file had another mode?
- install -m 0644 -o root -g wheel /tmp/inetd.conf /etc/inetd.conf
- umask $oldmask
- if [ -r /var/run/inetd.pid ]; then
- kill -1 `cat /var/run/inetd.pid`
- fi
-}
-
-check_service() {
- if [ -z "`egrep '^afm?backup' /etc/services`" ] ; then
- if dialog --clear --yesno "You don't have neither 'afbackup' nor 'afmbackup' entries\nin /etc/services.\n\nDo you want them to be created?\n\nNote that /etc/services will be forced to have root:wheel\nownership and mode 0644." 11 61; then
- install_services
- else
- dialog --msgbox "Create the entries manually then. You will need them." 5 60
- return
- fi
- fi
- if [ -z "`egrep '^#?af.?backup' /etc/inetd.conf`" ] ; then
- if dialog --clear --yesno "You don't have entries for afbackup/afmbackup server in\nyour /etc/inetd.conf file.\n\nDo you want them to be installed?" 8 60; then
- install_inetd_services
- else
- dialog --msgbox "You shell create the entries manually then." 5 60
- fi
- fi
-}
-
case $2 in
PRE-INSTALL)
create
;;
-
POST-INSTALL)
- case $1 in
- *-client*)
- ;;
- *)
- check_service
- ;;
- esac
+ case $1 in
+ *-client*)
+ ;;
+ *)
+ if [ ! -d ${SERVERVARDIR} ]; then
+ install -d -o afbackup -g operator ${SERVERVARDIR}
+ touch ${SERVERVARDIR}/readonly_tapes
+ fi
+ ;;
+ esac
+
;;
esac
diff --git a/misc/afbackup/pkg-message b/misc/afbackup/pkg-message
index bb72b3bd63cf..2c9b9b060cbd 100644
--- a/misc/afbackup/pkg-message
+++ b/misc/afbackup/pkg-message
@@ -8,4 +8,20 @@ ${PREFIX}/etc/afbackup/cryptkey. Remember to change it!
Also, ${PREFIX}/share/doc/afbackup contains the documentation
you ought to read before starting using the package.
+For server configuration one must add two services into
+/etc/services files:
+
+afbackup 2988/tcp
+afmbackup 2989/tcp
+
+and into /etc/inetd.conf:
+
+afbackup stream tcp nowait afbackup ${PKG_PREFIX}/libexec/afbackup/afserver ${PKG_PREFIX}/libexec/afbackup/afserver ${PKG_PREFIX}/etc/afbackup/server.conf
+afmbackup stream tcp nowait afbackup ${PKG_PREFIX}/libexec/afbackup/afmserver ${PKG_PREFIX}/libexec/afbackup/afmserver ${PKG_PREFIX}/etc/afbackup/server.conf
+
+For more information on how to configure the package read
+${PKG_PREFIX}/share/doc/afbackup/INSTALL keeping in mind that
+the package conforms to hier(7); in other words, paths are
+different from what is mentioned in the document.
+
--------------------------------------------------------------