From a60a6e65397ef38083292b276922282419ca32a6 Mon Sep 17 00:00:00 2001 From: pedro Date: Tue, 24 Sep 2024 10:51:14 -0300 Subject: [PATCH] PXE WIP --- .gitignore | 1 + pxe/.env.example | 4 +++ pxe/README.md | 3 ++ pxe/install-pxe.sh | 81 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 89 insertions(+) create mode 100644 pxe/.env.example create mode 100644 pxe/README.md create mode 100755 pxe/install-pxe.sh diff --git a/.gitignore b/.gitignore index b9aa2fd..b3b940f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ iso settings.ini # ignore all possible snapshots in this dir *.json +pxe/.env diff --git a/pxe/.env.example b/pxe/.env.example new file mode 100644 index 0000000..7f9b806 --- /dev/null +++ b/pxe/.env.example @@ -0,0 +1,4 @@ +server_ip=192.168.1.2 +nfs_allowed_lan=192.168.1.0/24 +tftp_path='/srv/pxe-tftp' +nfs_path='/srv/pxe-images' diff --git a/pxe/README.md b/pxe/README.md new file mode 100644 index 0000000..f30acc4 --- /dev/null +++ b/pxe/README.md @@ -0,0 +1,3 @@ +Run `install-pxe.sh` + +inspired on https://farga.exo.cat/exo/wiki/src/branch/master/howto/apu/apu-installer.md diff --git a/pxe/install-pxe.sh b/pxe/install-pxe.sh new file mode 100755 index 0000000..6839de8 --- /dev/null +++ b/pxe/install-pxe.sh @@ -0,0 +1,81 @@ +#!/bin/sh + +# Copyright (c) 2024 Pedro +# SPDX-License-Identifier: AGPL-3.0-or-later + +set -e +set -u +# DEBUG +set -x + +install_dependencies() { + apt update + apt install -y wget dnsmasq nfs-kernel-server +} + +backup_file() { + target="${1}" + ts="$(date +'%Y-%m-%d_%H-%M-%S')" + if [ -f "${target}" ]; then + cp -a "${target}" "${target}_bak_${ts}" + fi +} + +install_nfs() { + backup_file /etc/exports + cat /etc/exports <