#!/bin/bash
set -x
case $1 in
start)
sleep 120
apt-get update
export DEBIAN_FRONTEND=noninteractive
apt-get install -yq aldpro-client
mkdir -p /etc/ssl/freeipa
sed -e 's/127\.0\.1\.1.*//g' -i /etc/hosts
echo -e "search {DOMAIN_REALM}\nnameserver 10.177.208.208" > /etc/resolv.conf
/opt/rbta/aldpro/client/bin/aldpro-client-installer -c {DOMAIN_REALM} -p '{DOMAIN_PASSWORD}' -d comp$RANDOM -i -u {DOMAIN_LOGIN}
systemctl disable firststart
;;
stop)
systemctl disable firststart
;;
*)
echo "$Usage: $0 {start|stop}"
;;
esac