--- buildman/bm 2025/01/20 22:40:23 1.1.1.1 +++ buildman/bm 2025/01/21 20:52:51 1.3 @@ -54,6 +54,7 @@ ACTION="" PROJECT="" BUILD_HOST="" OS=`uname` +PYES="no" if [ "$OS" = "SCO_SV" ] ; then THOST=`hostname -s` @@ -70,11 +71,14 @@ fi tmphost=`echo ${THOST} | cut -d. -f1` THOST="${tmphost}" - -while getopts ':p:h:a:bl:o:' OPTION +while getopts ':p:h:a:bl:o:y' OPTION do case $OPTION in + y) + PYES="yes" + ;; + l) ACTION="list" TOLIST="${OPTARG}" @@ -107,7 +111,7 @@ done if [ ! -z "${PROJECT}" ] then PROJECT_BASE="${BUILDMAN_BASE}/projects/${PROJECT}" - if [ "${ACTION}" == "add" -a ! -d ${PROJECT_BASE} ] + if [ "${ACTION}" = "add" -a ! -d ${PROJECT_BASE} ] then echo "$PROGN: creating ${PROJECT} in ${PROJECT_BASE}..." mkdir -p "${PROJECT_BASE}" @@ -159,7 +163,7 @@ case $ACTION in echo "$PROGN: creating directory structure for project \"${PROJECT}\"" mkdir -p "${PBASE}/hosts" - + mkdir -p "${PBASE}/scripts" ;; @@ -171,6 +175,7 @@ case $ACTION in fi PBASE="${BUILDMAN_BASE}/projects/${PROJECT}" + if [ ! -d "${PBASE}" ] then echo "$PROGN error: project \"${PROJECT}\" does not exist" @@ -190,14 +195,62 @@ case $ACTION in exit 1 fi + if [ -z "${OPTIONS}" ] + then + echo "$PROGN error: must pass -o \"os:version:arch\"" + exit 1 + fi + + PLSTR="${BUILD_HOST}:${OPTIONS}" + H_PLATFORM=`echo ${PLSTR} | cut -d: -f2` + H_VERSION=`echo ${PLSTR} | cut -d: -f3` + H_ARCH=`echo ${PLSTR} | cut -d: -f4` + + if [ "${PYES}" = "no" ] + then + echo + echo "Host Details" + echo "============" + echo "Project: ${PROJECT}" + echo "Hostname: ${BUILD_HOST}" + echo "Platform: ${H_PLATFORM}" + echo "Version: ${H_VERSION}" + echo "Architecture: ${H_ARCH}" + echo + + read -n 1 -p "OK to create? (y/n) " YORN + echo + + if [ "${YORN}" = "y" -o "${YORN}" = "Y" ] + then + CONF=1 + else + echo "$PROGN: aborted" + exit 2 + fi + fi + echo "$PROGN: adding host \"${BUILD_HOST}\" to project \"${PROJECT}\"" mkdir -p "${HBASE}" + mkdir -p "${HBASE}/jobs" + mkdir -p "${HBASE}/logs" + + PFILE="${PBASE}/${H_PLATFORM}-platform.list" + echo + echo "==================================================" + echo " Don't forget to add the BuildMan cron job" + echo " to ${BUILDMAN_USER}@${BUILD_HOST}" + echo "==================================================" + echo + echo "${PLSTR}" >> "${PFILE}" + cd ${PBASE} + ls -1 *-platform.list | cut -d- -f1 | sort | uniq > platforms.list ;; esac ;; - + build) if [ -z "${BUILD_HOST}" ] @@ -214,7 +267,7 @@ case $ACTION in exit 1 fi - BUILD_WANTED="${PROJECT_BASE}/${HOST}/build-wanted" + BUILD_WANTED="${PROJECT_BASE}/hosts/${BUILD_HOST}/build-wanted" if [ -f "${BUILD_WANTED}" ] then @@ -223,11 +276,7 @@ case $ACTION in fi touch "${BUILD_WANTED}" - echo "$PROGN: build of project ${PROJECT} requested on build host ${HOST}" + echo "$PROGN: build of project ${PROJECT} requested on build host ${BUILD_HOST}" ;; esac - - - -