Annotation of buildman/install, revision 1.10
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.7 snw 21: #if [ "$UID" != "0" ]
22: #then
23: # echo "$PROGN error: must run as root"
24: # exit 1
25: #fi
1.1 snw 26:
27: TARGET="client"
28: TUSER="build:6000"
29: TGROUP="build:6000"
30: BUILDMAN_MASTER=""
1.10 ! snw 31: INSTALL_BASE="/usr/local/bin"
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:
1.10 ! snw 57: while getopts ':t:u:g:b:m:i:h' 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: ;;
1.10 ! snw 80:
! 81: h)
! 82: echo ""
! 83: echo "BuildMan Installer"
! 84: echo " Copyright (C) 2025 Coherent Logic Development LLC"
! 85: echo ""
! 86: echo ""
! 87: echo "usage: ${PROGN} [-i <install-base>] [-b <buildman-base>] [-u <buildman-username:buildman-uid>] [-g <buildman-groupname:buildman-gid> ] [-m <buildman-master>"
! 88: echo " <install-base> is the directory in which buildman will be installed"
! 89: echo " <buildman-base> is the directory in which buildman will operate"
! 90: echo " <buildman-username> is the username owning the files for buildman"
! 91: echo " <buildman-uid> is the numeric UID of the owner of the buildman files"
! 92: echo " <buildman-groupname> is the group name owning the files for buildman"
! 93: echo " <buildman-gid> is the numeric GID of the group owning the buildman files"
! 94: echo " <buildman-master> is the primary buildman host, supplied as IP address or FQDN"
! 95: exit 0
! 96: ;;
1.1 snw 97: esac
98: done
1.2 snw 99:
100: T_LOGIN=`echo ${TUSER} | cut -d: -f1`
101: T_UID=`echo ${TUSER} | cut -d: -f2`
102: T_GRPNAM=`echo ${TGROUP} | cut -d: -f1`
103: T_GID=`echo ${TGROUP} | cut -d: -f2`
104:
105:
106: groupadd -g ${T_GID} ${T_GRPNAM}
107: useradd -u ${T_UID} -g ${T_GRPNAM} -c "BuildMan" -m -d "${BUILDMAN_BASE}" "${T_LOGIN}"
108:
1.10 ! snw 109: install -o ${T_UID} -g ${T_GID} -m 750 bm "${INSTALL_BASE}/bm"
! 110: install -o ${T_UID} -g ${T_GID} -m 750 bma "${INSTALL_BASE}/bma"
1.2 snw 111:
112: DEF="/etc/default/bm"
113:
1.3 snw 114:
1.2 snw 115: echo "BUILDMAN_BASE=${BUILDMAN_BASE}" > "${DEF}"
1.9 snw 116: echo "BUILDMAN_USER=${T_LOGIN}" >> "${DEF}"
117: echo "BUILDMAN_GROUP=${T_GRPNAM}" >> "${DEF}"
1.2 snw 118: echo "BUILDMAN_UID=${T_UID}" >> "${DEF}"
119: echo "BUILDMAN_GID=${T_GID}" >> "${DEF}"
120: echo "BUILDMAN_MASTER=${BUILDMAN_MASTER}" >> "${DEF}"
121:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>