From 36137438446c1754a522c5b3cc3aff92c43ac1ee Mon Sep 17 00:00:00 2001 From: Aleksa Vuckovic Date: Wed, 13 Dec 2023 01:38:14 +0100 Subject: Initial commit X86/X86_64 debug/release WORKING riscv64 WORKING uart idk --- tftp/dnsmasq.conf | 20 ++++++++++++++++++++ tftp/dnsmasq.service | 20 ++++++++++++++++++++ tftp/setup.sh | 15 +++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 tftp/dnsmasq.conf create mode 100644 tftp/dnsmasq.service create mode 100755 tftp/setup.sh (limited to 'tftp') diff --git a/tftp/dnsmasq.conf b/tftp/dnsmasq.conf new file mode 100644 index 0000000..01a1782 --- /dev/null +++ b/tftp/dnsmasq.conf @@ -0,0 +1,20 @@ +interface=enp7s0 +bind-interfaces +domain=example.org +dhcp-option=3,0.0.0.0 +dhcp-option=6,0.0.0.0 +dhcp-option=121,192.168.111.0/24,192.168.111.1 +dhcp-range=192.168.111.50,192.168.111.100,5m +dhcp-range=::f,::ff,constructor:enp7s0 +dhcp-host=30:85:a9:88:61:0e,192.168.111.69 + +enable-tftp +tftp-root=/srv/tftp + +dhcp-match=set:efi-x86_64,option:client-arch,7 +dhcp-match=set:efi-x86_64,option:client-arch,9 +dhcp-match=set:efi-x86,option:client-arch,6 +dhcp-match=set:bios,option:client-arch,0 +dhcp-boot=tag:efi-x86_64,boot/grub/x86_64-efi/core.efi +dhcp-boot=tag:efi-x86,boot/grub/i386-efi/core.efi +dhcp-boot=tag:bios,boot/grub/i386-pc/core.0 diff --git a/tftp/dnsmasq.service b/tftp/dnsmasq.service new file mode 100644 index 0000000..c30c334 --- /dev/null +++ b/tftp/dnsmasq.service @@ -0,0 +1,20 @@ +[Unit] +Description=dnsmasq - A lightweight DHCP and caching DNS server +Documentation=man:dnsmasq(8) +After=network.target +Before=network-online.target nss-lookup.target +Wants=nss-lookup.target + +[Service] +Type=dbus +BusName=uk.org.thekelleys.dnsmasq +ExecStartPre=/usr/bin/dnsmasq --test +ExecStartPre=/home/aleksa/mygit/myrustkernel/tftp/setup.sh +ExecStart=/usr/bin/dnsmasq -k --enable-dbus --user=dnsmasq --pid-file +ExecReload=/bin/kill -HUP $MAINPID +Restart=on-failure +PrivateDevices=true +ProtectSystem=full + +[Install] +WantedBy=multi-user.target diff --git a/tftp/setup.sh b/tftp/setup.sh new file mode 100755 index 0000000..7e1737c --- /dev/null +++ b/tftp/setup.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +INTERFACE="enp7s0" +IP_ADDRESS="192.168.111.1/24" + +if ! ip addr show dev $INTERFACE | grep -q "$IP_ADDRESS"; then + sudo nmcli dev set $INTERFACE managed no + sudo ip link set $INTERFACE up + sudo ip addr add $IP_ADDRESS dev $INTERFACE + sudo systemctl restart dnsmasq + echo "Configuration applied successfully." +else + echo "IP address $IP_ADDRESS is already assigned to $INTERFACE." + echo "No changes made." +fi -- cgit v1.2.3