Support stage

Use options helpers
This commit is contained in:
Baptiste Daroussin 2014-03-06 17:56:19 +00:00
parent baec7d593a
commit 50d7789ce9
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=347288
2 changed files with 37 additions and 118 deletions

View file

@ -11,9 +11,7 @@ DISTNAME= ${PORTNAME}-20110526
EXTRACT_SUFX= .tgz
MAINTAINER= gjb@FreeBSD.org
COMMENT= A tiny shell that only permits scp and sftp
MAN8= scponly.8
COMMENT= Tiny shell that only permits scp and sftp
PORTDOCS= BUILDING-JAILS.TXT INSTALL README SECURITY
@ -32,120 +30,40 @@ SVNSERVE_DESC= Suversion support for svn+ssh://
UNISON_DESC= Unisson support
WINSCP_DESC= WinSCP support
NO_STAGE= yes
.include <bsd.port.options.mk>
OPTIONS_SUB= yes
.if(!exists(/usr/bin/sftp))
RUN_DEPENDS+= sftp:${PORTSDIR}/security/openssh-portable
BUILD_DEPENDS+= sftp:${PORTSDIR}/security/openssh-portable
.endif
BUILD_DEPENDS= sftp:${PORTSDIR}/security/openssh-portable
DEFAULT_CHDIR_CONFIGURE_ON= --with-default-chdir=${SCPONLY_DEFAULT_CHDIR}
WILDCARDS_CONFIGURE_ENABLE= --enable-wildcards
GFTP_CONFIGURE_ENABLE= --enable-gftp-compat
CHROOT_CONFIGURE_ENABLE= --enable-chrooted-binary
CHROOT_USE= RC_SUBR=scponlyc
RSYNC_BUILD_DEPENDS= rsync:${PORTSDIR}/net/rsync
RSYNC_CONFIGURE_ENABLE= --enable-rsync-compat
SCP_CONFIGURE_ENABLE= --enable-scp-compat
SVN_CONFIGURE_ENABLE= --enable-svn-compat
SVN_BUILD_DEPENDS= svn:${PORTSDIR}/devel/subversion
SVNSERVE_BUILD_DEPENDS= svn:${PORTSDIR}/devel/subversion
SVNSERVE_CONFIGURE_ENABLE= --enable-svnserv-compat
UNISON_BUILD_DEPENDS= unison:${PORTSDIR}/net/unison
UNISON_CONFIGURE_ENABLE= --enable-unison-compat
WINSCP_CONFIGURE_ENABLE= --enable-winscp-compat
.if ${PORT_OPTIONS:MDEFAULT_CHDIR}
CONFIGURE_ARGS+=--with-default-chdir=${SCPONLY_DEFAULT_CHDIR}
.endif
.if ${PORT_OPTIONS:MWILDCARDS}
CONFIGURE_ARGS+=--enable-wildcards
.else
CONFIGURE_ARGS+=--disable-wildcards
.endif
.if ${PORT_OPTIONS:MGFTP}
CONFIGURE_ARGS+=--enable-gftp-compat
.else
CONFIGURE_ARGS+=--disable-gftp-compat
.endif
.if ${PORT_OPTIONS:MCHROOT}
PLIST_SUB+= SCPONLY_CHROOT=""
CONFIGURE_ARGS+=--enable-chrooted-binary
USE_RC_SUBR+= scponlyc
.else
PLIST_SUB+= SCPONLY_CHROOT="@comment "
.endif
.if ${PORT_OPTIONS:MRSYNC}
BUILD_DEPENDS+= rsync:${PORTSDIR}/net/rsync
CONFIGURE_ARGS+=--enable-rsync-compat
.else
CONFIGURE_ARGS+=--disable-rsync-compat
.endif
.if ${PORT_OPTIONS:MSCP}
CONFIGURE_ARGS+=--enable-scp-compat
.else
CONFIGURE_ARGS+=--disable-scp-compat
.endif
.if ${PORT_OPTIONS:MSVN}
CONFIGURE_ARGS+=--enable-svn-compat
.else
CONFIGURE_ARGS+=--disable-svn-compat
.endif
.if ${PORT_OPTIONS:MSVNSERVE}
CONFIGURE_ARGS+=--enable-svnserv-compat
.else
CONFIGURE_ARGS+=--disable-svnserv-compat
.endif
.if ${PORT_OPTIONS:MUNISON}
BUILD_DEPENDS+= unison:${PORTSDIR}/net/unison
CONFIGURE_ARGS+=--enable-unison-compat
.else
CONFIGURE_ARGS+=--disable-unison-compat
.endif
.if ${PORT_OPTIONS:MWINSCP}
CONFIGURE_ARGS+=--enable-winscp-compat
.else
CONFIGURE_ARGS+=--disable-winscp-compat
.endif
# svn, svnlook ... are per default in subversion
# only check for one of them!
.if ${PORT_OPTIONS:MSVN} || ${PORT_OPTIONS:MSVNSERVE}
BUILD_DEPENDS+= svn:${PORTSDIR}/devel/subversion
.endif
RUN_DEPENDS:= ${BUILD_DEPENDS}
RUN_DEPENDS= ${BUILD_DEPENDS}
post-patch:
@${ECHO_MSG} "In addition to knobs available from the OPTIONS dialog,"
@${ECHO_MSG} "you may set SCPONLY_DEFAULT_CHDIR to make users 'cd' to"
@${ECHO_MSG} "this directory after authentication."
@${REINPLACE_CMD} -e "s/-o 0 -g 0//g" ${WRKSRC}/Makefile.in
post-install:
@${ECHO_MSG} "Updating /etc/shells"
@${CP} /etc/shells /etc/shells.bak
@(${GREP} -v ${PREFIX}/bin/scponly /etc/shells.bak; \
${ECHO_CMD} ${PREFIX}/bin/scponly) > /etc/shells
@${RM} /etc/shells.bak
.if ${PORT_OPTIONS:MCHROOT}
@${CP} /etc/shells /etc/shells.bak
@(${GREP} -v ${PREFIX}/sbin/scponlyc /etc/shells.bak; \
${ECHO_CMD} ${PREFIX}/sbin/scponlyc) > /etc/shells
@${RM} /etc/shells.bak
@${MKDIR} ${EXAMPLESDIR}
@${INSTALL_SCRIPT} ${WRKSRC}/setup_chroot.sh ${EXAMPLESDIR}
@${INSTALL_DATA} ${WRKSRC}/config.h ${EXAMPLESDIR}
@${ECHO_MSG} ""
@${ECHO_MSG} "To setup chroot cage, run the following commands:"
@${ECHO_MSG} " 1) cd ${EXAMPLESDIR}/ && ${SH} setup_chroot.sh"
@${ECHO_MSG} " 2) Set scponlyc_enable=\"YES\" in /etc/rc.conf"
@${ECHO_MSG} " 3) Run ${PREFIX}/etc/rc.d/scponly start"
@${ECHO_MSG} ""
.endif
.if ${PORT_OPTIONS:MDOCS}
@${MKDIR} ${DOCSDIR}
@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
${INSTALL_SCRIPT} ${WRKSRC}/setup_chroot.sh ${STAGEDIR}${EXAMPLESDIR}
${INSTALL_DATA} ${WRKSRC}/config.h ${STAGEDIR}${EXAMPLESDIR}
@${MKDIR} ${STAGEDIR}${DOCSDIR}
.for i in ${PORTDOCS}
@${INSTALL_DATA} ${WRKSRC}/$i ${DOCSDIR}
@${INSTALL_DATA} ${WRKSRC}/$i ${STAGEDIR}${DOCSDIR}
.endfor
@${ECHO_MSG} ""
@${ECHO_MSG} "For information on several potential security concerns,"
@${ECHO_MSG} "please read:"
@${ECHO_MSG} "${DOCSDIR}/SECURITY"
@${ECHO_MSG} ""
.endif
.include <bsd.port.mk>

View file

@ -1,20 +1,21 @@
bin/scponly
@exec echo "Updating /etc/shells"; cp /etc/shells /etc/shells.bak; (grep -v %D/%F /etc/shells.bak; echo %D/%F) >/etc/shells; rm -f /etc/shells.bak
@unexec echo "Updating /etc/shells"; cp /etc/shells /etc/shells.bak; (grep -v %D/%F /etc/shells.bak) >/etc/shells; rm -f /etc/shells.bak
%%SCPONLY_CHROOT%%@exec echo ""
%%SCPONLY_CHROOT%%@exec echo "To setup chroot cage, run the following commands:"
%%SCPONLY_CHROOT%%@exec echo " 1) cd %%PREFIX%%/%%EXAMPLESDIR%%/ && /bin/sh setup_chroot.sh"
%%SCPONLY_CHROOT%%@exec echo " 2) Set scponlyc_enable=\"YES\" in /etc/rc.conf"
%%SCPONLY_CHROOT%%@exec echo " 3) Run %%PREFIX%%/etc/rc.d/scponly start"
%%CHROOT%%@exec echo ""
%%CHROOT%%@exec echo "To setup chroot cage, run the following commands:"
%%CHROOT%%@exec echo " 1) cd %%PREFIX%%/%%EXAMPLESDIR%%/ && /bin/sh setup_chroot.sh"
%%CHROOT%%@exec echo " 2) Set scponlyc_enable=\"YES\" in /etc/rc.conf"
%%CHROOT%%@exec echo " 3) Run %%PREFIX%%/etc/rc.d/scponly start"
%%PORTDOCS%%@exec echo ""
%%PORTDOCS%%@exec echo "For information on several potential security concerns,"
%%PORTDOCS%%@exec echo "please read:"
%%PORTDOCS%%@exec echo "%%PREFIX%%/%%DOCSDIR%%/SECURITY"
%%SCPONLY_CHROOT%%sbin/scponlyc
%%SCPONLY_CHROOT%%@exec cp /etc/shells /etc/shells.bak; (grep -v %D/%F /etc/shells.bak; echo %D/%F) >/etc/shells; rm -f /etc/shells.bak
%%SCPONLY_CHROOT%%@unexec cp /etc/shells /etc/shells.bak; (grep -v %D/%F /etc/shells.bak) >/etc/shells; rm -f /etc/shells.bak
%%SCPONLY_CHROOT%%%%EXAMPLESDIR%%/setup_chroot.sh
%%SCPONLY_CHROOT%%%%EXAMPLESDIR%%/config.h
%%CHROOT%%sbin/scponlyc
%%CHROOT%%@exec cp /etc/shells /etc/shells.bak; (grep -v %D/%F /etc/shells.bak; echo %D/%F) >/etc/shells; rm -f /etc/shells.bak
%%CHROOT%%@unexec cp /etc/shells /etc/shells.bak; (grep -v %D/%F /etc/shells.bak) >/etc/shells; rm -f /etc/shells.bak
%%CHROOT%%%%EXAMPLESDIR%%/setup_chroot.sh
%%CHROOT%%%%EXAMPLESDIR%%/config.h
etc/scponly/debuglevel
man/man8/scponly.8.gz
@dirrm etc/scponly
%%SCPONLY_CHROOT%%@dirrm %%EXAMPLESDIR%%
%%CHROOT%%@dirrm %%EXAMPLESDIR%%