Annotation of buildman/install, revision 1.2
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:
21: if [ $EUID -ne 0 ]
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:
! 50: if [ "$OS" == "SunOS" ]
! 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.1 snw 79:
80: esac
81: done
1.2 ! snw 82:
! 83: T_LOGIN=`echo ${TUSER} | cut -d: -f1`
! 84: T_UID=`echo ${TUSER} | cut -d: -f2`
! 85: T_GRPNAM=`echo ${TGROUP} | cut -d: -f1`
! 86: T_GID=`echo ${TGROUP} | cut -d: -f2`
! 87:
! 88:
! 89: groupadd -g ${T_GID} ${T_GRPNAM}
! 90: useradd -u ${T_UID} -g ${T_GRPNAM} -c "BuildMan" -m -d "${BUILDMAN_BASE}" "${T_LOGIN}"
! 91:
! 92: install -o ${T_UID} -g ${T_GID} -m 750 bm "${INSTALL_BASE}/sbin/bm"
! 93: install -o ${T_UID} -g ${T_GID} -m 750 bma "${INSTALL_BASE}/sbin/bma"
! 94:
! 95: DEF="/etc/default/bm"
! 96:
! 97: echo "BUILDMAN_BASE=${BUILDMAN_BASE}" > "${DEF}"
! 98: echo "BUILDMAN_UID=${T_UID}" >> "${DEF}"
! 99: echo "BUILDMAN_GID=${T_GID}" >> "${DEF}"
! 100: echo "BUILDMAN_MASTER=${BUILDMAN_MASTER}" >> "${DEF}"
! 101:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>