From ab9970715a69d99f4cc1660f9410bf3d8f943870 Mon Sep 17 00:00:00 2001 From: Raine Date: Fri, 20 Oct 2023 15:44:39 +0200 Subject: [PATCH] refactor: setup-server.sh --- tools/server-setup.d/00-apply-skel.sh | 6 ++++++ .../05-install-packages.sh | 0 .../10-clone-ixvd-secrets.sh | 0 .../20-ssh-authorized-keys.sh | 0 tools/{setup => server-setup.d}/30-cifs.sh | 0 tools/{setup => server-setup.d}/40-docker.sh | 0 tools/server-setup.sh | 14 +++++++++++--- tools/setup/00-apply-skel.sh | 11 ----------- 8 files changed, 17 insertions(+), 14 deletions(-) create mode 100644 tools/server-setup.d/00-apply-skel.sh rename tools/{setup => server-setup.d}/05-install-packages.sh (100%) rename tools/{setup => server-setup.d}/10-clone-ixvd-secrets.sh (100%) rename tools/{setup => server-setup.d}/20-ssh-authorized-keys.sh (100%) rename tools/{setup => server-setup.d}/30-cifs.sh (100%) rename tools/{setup => server-setup.d}/40-docker.sh (100%) delete mode 100644 tools/setup/00-apply-skel.sh diff --git a/tools/server-setup.d/00-apply-skel.sh b/tools/server-setup.d/00-apply-skel.sh new file mode 100644 index 0000000..f543c56 --- /dev/null +++ b/tools/server-setup.d/00-apply-skel.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +if ! [ -f "/etc/ixvd/version" ]; then + echo "applying overlay..." + cp -r skel/. / +fi diff --git a/tools/setup/05-install-packages.sh b/tools/server-setup.d/05-install-packages.sh similarity index 100% rename from tools/setup/05-install-packages.sh rename to tools/server-setup.d/05-install-packages.sh diff --git a/tools/setup/10-clone-ixvd-secrets.sh b/tools/server-setup.d/10-clone-ixvd-secrets.sh similarity index 100% rename from tools/setup/10-clone-ixvd-secrets.sh rename to tools/server-setup.d/10-clone-ixvd-secrets.sh diff --git a/tools/setup/20-ssh-authorized-keys.sh b/tools/server-setup.d/20-ssh-authorized-keys.sh similarity index 100% rename from tools/setup/20-ssh-authorized-keys.sh rename to tools/server-setup.d/20-ssh-authorized-keys.sh diff --git a/tools/setup/30-cifs.sh b/tools/server-setup.d/30-cifs.sh similarity index 100% rename from tools/setup/30-cifs.sh rename to tools/server-setup.d/30-cifs.sh diff --git a/tools/setup/40-docker.sh b/tools/server-setup.d/40-docker.sh similarity index 100% rename from tools/setup/40-docker.sh rename to tools/server-setup.d/40-docker.sh diff --git a/tools/server-setup.sh b/tools/server-setup.sh index 4f9a456..9d5af4f 100644 --- a/tools/server-setup.sh +++ b/tools/server-setup.sh @@ -13,7 +13,7 @@ if ! [ "$UID" = "0" ]; then fi echo "testing git connection..." -if ! ssh -Tq git@git.ixvd.net &> /dev/null; then +if ! ssh -Tq git@git.ixvd.net &>/dev/null; then echo "can't connect to git, please setup ssh" exit 1 fi @@ -22,7 +22,15 @@ fi set -e -for s in tools/setup/*; do +if [ -d "servers/$HOSTNAME/setup.d" ]; then + echo "running server specific setup scripts..." + for s in servers/$HOSTNAME/setup.d/*; do + echo "running $s..." + sh $s + done +fi + +for s in tools/server-setup.d/*; do echo "running $s..." sh $s -done \ No newline at end of file +done diff --git a/tools/setup/00-apply-skel.sh b/tools/setup/00-apply-skel.sh deleted file mode 100644 index d630276..0000000 --- a/tools/setup/00-apply-skel.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -if ! [ -f "/etc/ixvd/version" ]; then - echo "applying overlay..." - cp -r skel/. / -fi - -if [ -d "servers/$HOSTNAME/skel" ]; then - echo "applying server specific skeleton..." - cp -r servers/$HOSTNAME/skel/. / -fi