Created
April 8, 2020 19:02
-
-
Save vieskees/87bc46f62af71ae4a2e78c87296a7ab7 to your computer and use it in GitHub Desktop.
Start script hostname and ip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
echo "Beerfridge Start Script: [[ HOSTNAME & IP ]]" | |
. /boot/bss_variables.config | |
# Change the hostname | |
sudo hostnamectl --transient set-hostname ${MASTER_HOSTNAME} | |
sudo hostnamectl --static set-hostname ${MASTER_HOSTNAME} | |
sudo hostnamectl --pretty set-hostname ${MASTER_HOSTNAME} | |
sudo sed -i s/raspberrypi/${MASTER_HOSTNAME}/g /etc/hosts | |
# Set the static ip | |
sudo cat <<EOT >> /etc/dhcpcd.conf | |
interface eth0 | |
static ip_address=${MASTER_IP}/24 | |
static routers=${ROUTER_IP_ADDRESS} | |
static domain_name_servers=${ROUTER_IP_ADDRESS} | |
EOT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment