mirror of
https://github.com/ben-grande/qusal.git
synced 2024-12-25 23:49:39 -05:00
bdd4c789c1
Echo can interpret operand as an option and checking every variable to be echoed is troublesome while with printf, if the format specifier is present before the operand, printing as string can be enforced.
25 lines
581 B
Bash
Executable File
25 lines
581 B
Bash
Executable File
#!/bin/sh
|
|
|
|
## SPDX-FileCopyrightText: 2023 - 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
|
##
|
|
## SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
set -eu
|
|
|
|
# shellcheck disable=3028
|
|
hostname="$(hostname)"
|
|
test "${hostname}" = "dom0" ||
|
|
{ printf '%s\n' "Must be run from dom0" >&2; exit 1; }
|
|
uid="$(id -u)"
|
|
test "${uid}" = "0" || exec sudo "${0}"
|
|
|
|
group="qusal"
|
|
file_roots="/srv/salt/${group}"
|
|
|
|
cd "${0%/*}"/..
|
|
## 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}"
|