#!/bin/sh -e

##########################################################################
#   Script description:
#       Sync local pkgsrc from head node to all nodes
#       
#   History:
#   Date        Name        Modification
#   2020-12-22  Jason Bacon Begin
##########################################################################

usage()
{
    printf "Usage: $0\n"
    exit 1
}


##########################################################################
#   Main
##########################################################################

if [ $# != 0 ]; then
    usage
fi

case $(auto-ostype) in
RHEL)
    read -p "Are you sure? yes/[no] " sure
    if [ 0$sure = 0yes ]; then
	for node in $(cluster-all-nodes); do
            printf "$node...\n"
	    node-sync-pkgsrc $node
	done
    fi
    ;;

*)
    printf "$0: Not supported on $(auto-ostype).\n"
    exit 1
    ;;

esac
