# RCTS CentOS 6 Build

## 1. 컨테이너 실행

```bash
podman run -d --name rcts-centos6 centos:centos6 sleep infinity
podman exec -it rcts-centos6 bash
```

## 2. 저장소 설정

```bash
cp -p /etc/yum.repos.d/CentOS-Base.repo \
  /etc/yum.repos.d/CentOS-Base.repo.before-vault

sed -i \
  -e 's|^mirrorlist=|#mirrorlist=|' \
  -e 's|^#baseurl=http://mirror.centos.org/centos/\$releasever|baseurl=http://vault.centos.org/6.10|' \
  /etc/yum.repos.d/CentOS-Base.repo
```

## 3. 의존성 설치

```bash
yum install -y gcc gcc-c++ make pkgconfig
yum install -y boost-devel openssl-devel sqlite-devel openldap-devel
```

```bash
yum install -y \
  http://archives.fedoraproject.org/pub/archive/epel/6/x86_64/epel-release-6-8.noarch.rpm

sed -i \
  -e 's|^mirrorlist=|#mirrorlist=|' \
  -e 's|^#baseurl=http://download.fedoraproject.org/pub/epel/6/\$basearch|baseurl=http://archives.fedoraproject.org/pub/archive/epel/6/\$basearch|' \
  /etc/yum.repos.d/epel.repo

yum install -y libxml++-devel
```

```bash
PG93_BASE=http://download.postgresql.org/pub/repos/yum/9.3/redhat/rhel-6-x86_64

yum install -y \
  ${PG93_BASE}/postgresql93-9.3.25-1PGDG.rhel6.x86_64.rpm \
  ${PG93_BASE}/postgresql93-libs-9.3.25-1PGDG.rhel6.x86_64.rpm \
  ${PG93_BASE}/postgresql93-devel-9.3.25-1PGDG.rhel6.x86_64.rpm
```

```bash
mkdir -p /user/db
ln -s /usr/pgsql-9.3 /user/db/pgsql
```

## 4. 소스 복사

호스트에서 실행한다.

```bash
podman exec rcts-centos6 mkdir -p /workspace
git archive --format=tar HEAD rcts \
  | podman exec -i rcts-centos6 tar -xf - -C /workspace
```

## 5. 링크 옵션 보정

컨테이너 안에서 실행한다.

```bash
for f in /workspace/rcts/*/src/Makefile /workspace/rcts/rc_du/Makefile; do
  sed -i -r \
    '/^[[:space:]]*LIBS[[:space:]]*=/ s|$| -lssl -lcrypto -lgssapi_krb5 -lcrypt -lldap_r -lpthread|' \
    "$f"
done
```

## 6. 빌드

```bash
for component in rc_accessd rc_apid rc_balanced rc_cmove rc_du \
  rc_gcmd rc_mngd rc_mond rc_rmcd rc_sscd rc_syncd; do
  make -C /workspace/rcts/${component} all
done
```

결과: 11개 컴포넌트 빌드 성공.

실행 파일 위치:

```text
/workspace/rcts/rc_du/rc_du
/workspace/rcts/<component>/src/<component>
```
