#!/bin/bash

echo "Running prsync ./sbin"
prsync -h "/app/host_vars/hosts" -avz ./sbin/ /4server/sbin/
template templates/.profile /home/4server/.profile
template templates/postgresql.conf /4server/data/postgres/data/postgresql.conf

rex doas rc-service api restart

rex doas rc-service checkCalls restart

prsync -h "/app/host_vars/hosts" -avz ./host_vars/borg-backup/* /home/4server/.ssh
rex doas chown 4server:4server /home/4server/.ssh/borg*
rex doas chmod 600 /home/4server/.ssh/borg*


# link all save scripts to /usr/sbin
rex doas ln -s /4server/sbin/activeContainers /usr/bin/
rex doas ln -s /4server/sbin/startContainer /usr/bin/
rex doas ln -s /4server/sbin/restartContainers /usr/bin/
