Annotation of buildman/install, revision 1.5

1.1       snw         1: #!/bin/sh
                      2: 
                      3: # SPDX-FileCopyrightText: (C) 2025 Coherent Logic Development LLC
                      4: # SPDX-FileCopyrightText: (C) 2025 Serena Willis
                      5: #
                      6: # SPDX-License-Identifier: AGPL-3.0
                      7: 
                      8: #
                      9: # BuildMan 0.0.1
                     10: #  Distributed CI/CD system with portability to older UNIX systems
                     11: #
                     12: #  install - buildman installer
                     13: #
                     14: # Copyright (C) 2025 Coherent Logic Development LLC
                     15: #
                     16: # Author: Serena Willis <snw@coherent-logic.com>
                     17: #
                     18: 
                     19: PROGN=`basename $0`
                     20: 
1.4       snw        21: if [ $UID -ne 0 ]
1.1       snw        22: then
                     23:     echo "$PROGN error:  must run as root"
                     24:     exit 1
                     25: fi
                     26: 
                     27: TARGET="client"
                     28: TUSER="build:6000"
                     29: TGROUP="build:6000"
                     30: BUILDMAN_MASTER=""
1.2       snw        31: INSTALL_BASE="/usr/local"
1.1       snw        32: 
1.2       snw        33: OS=`uname`
                     34: 
                     35: if [ "$OS" = "SCO_SV" ] ; then
                     36:     THOST=`hostname -s`
                     37:     PATH=/usr/gnu/bin:$PATH
                     38:     export PATH
                     39: else
                     40:     if [ "$OS" = "SunOS" ] ; then
                     41:         THOST=`hostname`
                     42:     else    
                     43:         THOST=`hostname -s`
                     44:     fi
                     45: fi
                     46: 
                     47: tmphost=`echo ${THOST} | cut -d. -f1`
                     48: THOST="${tmphost}"
                     49: 
1.4       snw        50: if [ "$OS" = "SunOS" ]
1.2       snw        51: then
                     52:     BUILDMAN_BASE="/export/home/build"
                     53: else    
                     54:     BUILDMAN_BASE="/home/build"
                     55: fi
                     56: 
                     57: while getopts ':t:u:g:b:m:i:' OPTION
1.1       snw        58: do
                     59:     case $OPTION in
1.2       snw        60: 
                     61:         i)
                     62:             INSTALL_BASE="${OPTARG}"
                     63:             ;;
                     64:         
                     65:         u)
                     66:             TUSER="${OPTARG}"
                     67:             ;;
                     68: 
                     69:         g)
                     70:             TGROUP="${OPTARG}"
                     71:             ;;
1.1       snw        72:         
1.2       snw        73:         b)
                     74:             BUILDMAN_BASE="${OPTARG}"
                     75:             ;;
                     76: 
                     77:         m)
                     78:             BUILDMAN_MASTER="${OPTARG}"
1.5     ! snw        79:             ;;
        !            80:         
1.1       snw        81:     esac
                     82: done
1.2       snw        83: 
                     84: T_LOGIN=`echo ${TUSER} | cut -d: -f1`
                     85: T_UID=`echo ${TUSER} | cut -d: -f2`
                     86: T_GRPNAM=`echo ${TGROUP} | cut -d: -f1`
                     87: T_GID=`echo ${TGROUP} | cut -d: -f2`
                     88: 
                     89: 
                     90: groupadd -g ${T_GID} ${T_GRPNAM}
                     91: useradd -u ${T_UID} -g ${T_GRPNAM} -c "BuildMan" -m -d "${BUILDMAN_BASE}" "${T_LOGIN}"
                     92: 
                     93: install -o ${T_UID} -g ${T_GID} -m 750 bm "${INSTALL_BASE}/sbin/bm"
                     94: install -o ${T_UID} -g ${T_GID} -m 750 bma "${INSTALL_BASE}/sbin/bma"
                     95: 
                     96: DEF="/etc/default/bm"
                     97: 
1.3       snw        98: 
1.2       snw        99: echo "BUILDMAN_BASE=${BUILDMAN_BASE}" > "${DEF}"
                    100: echo "BUILDMAN_UID=${T_UID}" >> "${DEF}"
                    101: echo "BUILDMAN_GID=${T_GID}" >> "${DEF}"
                    102: echo "BUILDMAN_MASTER=${BUILDMAN_MASTER}" >> "${DEF}"
                    103: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>