-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy_tftp.sh
executable file
·40 lines (36 loc) · 1.29 KB
/
deploy_tftp.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c)
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
set -o pipefail
set -o xtrace
set -o errexit
set -o nounset
# shellcheck disable=SC1091
source /etc/os-release || source /usr/lib/os-release
if ! command -v curl; then
case ${ID,,} in
ubuntu | debian)
sudo apt-get update
sudo apt-get install -y -qq -o=Dpkg::Use-Pty=0 curl
;;
esac
fi
# NOTE: Shorten link -> https://github.com/electrocucaracha/pkg-mgr_scripts
curl -fsSL http://bit.ly/install_bin | PKG_BINDEP_PROFILE=tftp bash
echo 'tftp dgram udp wait root /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot' | sudo tee /etc/inetd.conf
sudo tee /etc/default/tftpd-hpa <<EOF
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS=":69"
TFTP_OPTIONS="--secure"
RUN_DAEMON="no"
OPTIONS="-l -s /var/lib/tftpboot"
EOF
sudo mkdir -p /var/lib/tftpboot
sudo systemctl restart tftpd-hpa