2023-11-13 09:33:28 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
2024-01-29 10:49:54 -05:00
|
|
|
## SPDX-FileCopyrightText: 2023 - 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
2023-11-13 09:33:28 -05:00
|
|
|
##
|
|
|
|
## SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
2024-07-10 08:36:05 -04:00
|
|
|
# shellcheck disable=3028
|
2024-07-15 04:08:19 -04:00
|
|
|
hostname="$(hostname)"
|
2024-07-10 08:36:05 -04:00
|
|
|
test "${hostname}" = "dom0" || { echo "Must be run from dom0" >&2; exit 1; }
|
|
|
|
uid="$(id -u)"
|
|
|
|
test "${uid}" = "0" || exec sudo "${0}"
|
2023-11-13 09:33:28 -05:00
|
|
|
|
|
|
|
group="qusal"
|
|
|
|
file_roots="/srv/salt/${group}"
|
|
|
|
|
2024-01-18 03:25:01 -05:00
|
|
|
cd "${0%/*}"/..
|
2023-11-13 09:33:28 -05:00
|
|
|
## Avoid having extra unwanted files.
|
|
|
|
rm -rf "${file_roots}"
|
|
|
|
cp -f minion.d/*.conf /etc/salt/minion.d/
|
|
|
|
mkdir -p "${file_roots}"
|
|
|
|
cp -r salt/* "${file_roots}"
|