#!/bin/bash

set -x

readonly FENCE_AGENTS_BASE="debian/fence-agents-base"
readonly FENCE_AGENTS_EXTRA="debian/fence-agents-extra"

mkdir -p "$FENCE_AGENTS_BASE"/usr/sbin \
         "$FENCE_AGENTS_BASE"/usr/share/man/man8

for agent in $(cat debian/curated-agents); do
  mv "$FENCE_AGENTS_EXTRA"/usr/sbin/$agent \
     "$FENCE_AGENTS_BASE"/usr/sbin/
  mv "$FENCE_AGENTS_EXTRA"/usr/share/man/man8/$agent.8 \
     "$FENCE_AGENTS_BASE"/usr/share/man/man8/
done
