# Building the stanford-server RPM

## Quick start

From the top-level repository directory:

```bash
redhat2/check-build-deps.sh
redhat2/build.sh
```

## Prerequisites

Install the build dependencies on RHEL/CentOS/Rocky 8+:

```bash
dnf install rpm-build perl
```

## Build steps

The `build.sh` script automates all of these steps, but if you want to
run them manually:

Set up the rpmbuild tree and create the source tarball:

```bash
mkdir -p ~/rpmbuild/{SOURCES,SPECS}

tar czf ~/rpmbuild/SOURCES/stanford-server-178.tar.gz \
    --transform='s,^,stanford-server-178/,' \
    --exclude=.git --exclude=debian --exclude=redhat \
    --exclude=redhat2 --exclude=t --exclude='*.tar.gz' \
    usr/ etc/ set-version.sh

cp redhat2/LICENSE ~/rpmbuild/SOURCES/
cp redhat2/stanford-server.spec ~/rpmbuild/SPECS/
```

Build both source and binary RPMs:

```bash
rpmbuild -ba ~/rpmbuild/SPECS/stanford-server.spec
```

The resulting packages will be in:

- `~/rpmbuild/RPMS/noarch/stanford-server-178-1.<dist>.noarch.rpm`
- `~/rpmbuild/SRPMS/stanford-server-178-1.<dist>.src.rpm`

## Install

```bash
dnf install ~/rpmbuild/RPMS/noarch/stanford-server-178-1.el8.noarch.rpm
```

## What gets installed

- `/usr/bin/*` -- user commands (sysname-check, retire-system, etc.)
- `/usr/sbin/*` -- admin scripts (key-system, monitor-base, etc.)
- `/usr/lib/nagios/plugins/*` -- Nagios check plugins
- `/etc/remctl/conf.d/*` -- remctl configuration fragments
- `/etc/remctl/acl/monitoring` -- monitoring remctl ACL
- `/etc/nagios-plugins/ipmi_sel.conf` -- IPMI SEL check configuration
- Man pages for all scripts

## Runtime dependencies

The package requires remctl-client, stanford-puppet-backend, and
various Perl modules.  These are declared as RPM dependencies and
will be pulled in automatically.
