FreeBSD virtual environment management and repository

2020-10 upd: we reached the first fundraising goal and rented a server in Hetzner for development! Thank you for donating !

#!/bin/sh
. /etc/rc.conf

[ -z "${cbsd_workdir}" ] && exit
export workdir="${cbsd_workdir}"
globalconf="${workdir}/cbsd.conf";

[ ! -f ${globalconf} ] && exit
. ${globalconf}
. ${subr}
. ${inventory}

MAP="${dbdir}/jmap.txt"
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
DOCROOT="/home/web/dashboard"
INDEX="${DOCROOT}/index.html"

[ ! -d "${DOCROOT}" ] && mkdir -p ${DOCROOT}
[ ! -f "${MAP}" ] && err 1 "No such ${MAP}"

. ${MAP} 2>/dev/null

cat > ${INDEX} <









EOF

MJ=`cut -d = -f 1 ${MAP}`

for i in ${MJ}; do
    eval T="\$$i"
    NODE=$(echo ${T} |awk '{printf $1}')
    A=""

    if [ -n "${NODE}" ]; then
	A=$(cbsd rexe node=${NODE} /usr/local/bin/cbsd jdescr jname=${i} 2>/dev/null)
	TEMPLIST="/tmp/pkg_info.$$"
	cbsd rexe node=${NODE} cat /usr/jails/jails-system/${i}/pkg_info|tr -d \\r > ${TEMPLIST}
	echo "
" > ${DOCROOT}/pkg_info_${i}.html
	erro=`cbsd rexe node=${NODE} cat ${TEMPLIST} >> ${DOCROOT}/pkg_info_${i}.html 2>/dev/null`
	rm -f ${TEMPLIST}
    fi

cat >>${INDEX} <
EOF done cat < EOF
jnamesrv
${i}${T}