From e8b1d62290291e20e15dbe5d282cac917778e249 Mon Sep 17 00:00:00 2001 From: pedro Date: Wed, 6 Nov 2024 19:31:44 +0100 Subject: [PATCH] change strategy on example files (added -v to cps) - if it does not exist, copy once from example - added -v flag to cps that did not have it --- deploy-workbench.sh | 10 +++++----- pxe/install-pxe.sh | 12 ++++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/deploy-workbench.sh b/deploy-workbench.sh index 42b3002..d96afa3 100755 --- a/deploy-workbench.sh +++ b/deploy-workbench.sh @@ -199,12 +199,12 @@ create_persistence_partition() { mkdir -p "${tmp_rw_mount}" ${SUDO} mount "$(pwd)/${rw_img_path}" "${tmp_rw_mount}" ${SUDO} mkdir -p "${tmp_rw_mount}" - if [ -f "settings.ini" ]; then - ${SUDO} cp -v settings.ini "${tmp_rw_mount}/settings.ini" - else - echo "ERROR: settings.ini does not exist yet, cannot read config from there. You can take inspiration with file settings.ini.example" - exit 1 + if [ ! -f "settings.ini" ]; then + ${SUDO} cp -v settings.ini.example settings.ini + echo "WARNING: settings.ini was not there, settings.ini.example was copied, this only happens once" fi + ${SUDO} cp -v settings.ini "${tmp_rw_mount}/settings.ini" + ${SUDO} umount "${tmp_rw_mount}" uuid="$(blkid "${rw_img_path}" | awk '{ print $3; }')" diff --git a/pxe/install-pxe.sh b/pxe/install-pxe.sh index 934fb11..bf85630 100755 --- a/pxe/install-pxe.sh +++ b/pxe/install-pxe.sh @@ -37,7 +37,7 @@ backup_file() { if [ -f "${target}" ]; then if ! grep -q 'we should do a backup' "${target}"; then - ${SUDO} cp -a "${target}" "${target}-bak_${ts}" + ${SUDO} cp -v -a "${target}" "${target}-bak_${ts}" fi fi } @@ -72,7 +72,7 @@ END if [ ! -f "${nfs_path}/settings.ini" ]; then if [ -f "settings.ini" ]; then - ${SUDO} cp settings.ini "${nfs_path}/settings.ini" + ${SUDO} cp -v settings.ini "${nfs_path}/settings.ini" else echo "ERROR: $(pwd)/settings.ini does not exist yet, cannot read config from there. You can take inspiration with file $(pwd)/settings.ini.example" exit 1 @@ -110,8 +110,12 @@ install_netboot() { ${SUDO} cp -fv "${PXE_DIR}/../iso/staging/live/vmlinuz" "${tftp_path}/" ${SUDO} cp -fv "${PXE_DIR}/../iso/staging/live/initrd" "${tftp_path}/" - ${SUDO} cp /usr/lib/syslinux/memdisk "${tftp_path}/" - ${SUDO} cp /usr/lib/syslinux/modules/bios/* "${tftp_path}/" + ${SUDO} cp -v /usr/lib/syslinux/memdisk "${tftp_path}/" + ${SUDO} cp -v /usr/lib/syslinux/modules/bios/* "${tftp_path}/" + if [ ! -f ./pxe-menu.cfg ]; then + ${SUDO} cp -v ./pxe-menu.cfg.example pxe-menu.cfg + echo "WARNING: pxe-menu.cfg was not there, pxe-menu.cfg.example was copied, this only happens once" + fi envsubst < ./pxe-menu.cfg | ${SUDO} tee "${tftp_path}/pxelinux.cfg/default" fi