Index: head/sysutils/cbsd/Makefile =================================================================== --- head/sysutils/cbsd/Makefile (revision 424938) +++ head/sysutils/cbsd/Makefile (revision 424939) @@ -1,52 +1,53 @@ # $FreeBSD$ PORTNAME= cbsd PORTVERSION= 11.0.4 +PORTREVISION= 1 CATEGORIES= sysutils MAINTAINER= olevole@olevole.ru COMMENT= Yet another FreeBSD Jail and Bhyve Management Utility LICENSE= BSD2CLAUSE RUN_DEPENDS= rsync:net/rsync \ sudo:security/sudo \ sqlite3:databases/sqlite3 LIB_DEPENDS= libssh2.so:security/libssh2 \ libsqlite3.so:databases/sqlite3 USE_GITHUB= yes GH_ACCOUNT= olevole USES= libedit USE_RC_SUBR= cbsdd cbsdrsyncd SUB_FILES= pkg-message PLIST_FILES+= man/man8/cbsd.8.gz CBSD_HOME?= ${PREFIX}/cbsd .include USERS= ${PORTNAME} GROUPS= ${PORTNAME} .if ${OPSYS} == FreeBSD && ${OSVERSION} < 1000000 IGNORE= does not support FreeBSD versions < 10.0 .endif do-install: @${ECHO} "Installing in ${CBSD_HOME}" ${MKDIR} ${STAGEDIR}${CBSD_HOME} ${CP} -a ${WRKSRC}/ ${STAGEDIR}${CBSD_HOME} ${INSTALL_MAN} ${WRKSRC}/man/cbsd.8 ${STAGEDIR}${PREFIX}/man/man8/cbsd.8 ${INSTALL_PROGRAM} ${WRKSRC}/bin/cbsdsh/cbsd ${STAGEDIR}${PREFIX}/bin post-install: ${CAT} ${PKGDIR}/pkg-plist-chunk > ${TMPPLIST} ; @${FIND} -s ${STAGEDIR}${CBSD_HOME} -not -type d | ${SORT} | \ ${SED} -e 's#^${STAGEDIR}${PREFIX}/##' >> ${TMPPLIST} @${MKDIR} ${STAGEDIR}${PREFIX}/libexec/bsdconfig @${LN} -sf ${CBSD_HOME}/share/bsdconfig/cbsd ${STAGEDIR}${PREFIX}/libexec/bsdconfig/cbsd .include Index: head/sysutils/cbsd/files/cbsdd.in =================================================================== --- head/sysutils/cbsd/files/cbsdd.in (revision 424938) +++ head/sysutils/cbsd/files/cbsdd.in (revision 424939) @@ -1,92 +1,110 @@ #!/bin/sh # # PROVIDE: cbsdd # REQUIRE: LOGIN FILESYSTEMS sshd # KEYWORD: shutdown # # cbsdd_enable="YES" # . /etc/rc.subr name=cbsdd rcvar=cbsdd_enable load_rc_config $name : ${cbsdd_enable="NO"} export workdir="${cbsd_workdir}" export NO_CBSD_HISTORY=yes globalconf=${cbsd_globalconf:-"${workdir}/cbsd.conf"} if [ ! -f ${globalconf} ]; then echo "cbsd: no such ${globalconf}"; exit 1 fi if [ ! -f ${mdtools} ]; then echo "cbsd: no such ${mdtools}"; exit 1 fi if [ ! -f ${subr} ]; then echo "cbsd: no such ${subr}"; exit 1 fi if [ ! -f ${localcbsdconf} ]; then echo "cbsd: no such ${localcbsdconf}"; exit 1 fi . ${globalconf} . ${mdtools} . ${subr} . ${localcbsdconf} start_precmd=${name}_prestart stop_precmd=${name}_prestop stop_cmd=${name}_stop +status_cmd="${name}_status" reload_cmd=${name}_reload extra_commands="reload" command="${toolsdir}/cbsdd" pidfile="/var/run/$name.pid" command_args="&" cbsdd_prestart() { %%PREFIX%%/bin/cbsd task mode=flushall > /dev/null 2>&1 . ${distdir}/initenv.subr . ${inventory} %%PREFIX%%/bin/cbsd sysinv mode=update %%PREFIX%%/bin/cbsd netinv update_hwinfo update_netinfo env sqlcolnames="1" ${miscdir}/sqlcli ${dbdir}/local.sqlite "SELECT * FROM local" > ${inventory} [ -n "$nat_enable" ] && %%PREFIX%%/bin/cbsd naton /usr/sbin/daemon -f ${rcddir}/jails-astart start } cbsdd_prestop() { ${rcddir}/jails-astart stop [ -n "${nat_enable}" ] && %%PREFIX%%/bin/cbsd natoff } cbsdd_stop() { - [ -f "${pidfile}" ] && kill -9 $( /bin/cat ${pidfile} ) + if [ -f "${pidfile}" ]; then + kill -9 $( /bin/cat ${pidfile} ) + /bin/rm -f ${pidfile} + fi } cbsdd_reload() { - [ -f "${pidfile}" ] && kill -9 $( /bin/cat ${pidfile} ) > /dev/null 2>&1 + if [ -f "${pidfile}" ]; then + kill -9 $( /bin/cat ${pidfile} ) > /dev/null 2>&1 + /bin/rm -f ${pidfile} + fi run_rc_command "start" exit 0 +} + +cbsdd_status() +{ + if [ -f "${pidfile}" ]; then + pids=$( /bin/cat ${pidfile} ) + echo "${name} is running as pid ${pids}." + else + echo "${name} is not running." + return 1 + fi } run_rc_command "$1"