Skip to content

Instantly share code, notes, and snippets.

@vieskees
Created April 8, 2020 19:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vieskees/87bc46f62af71ae4a2e78c87296a7ab7 to your computer and use it in GitHub Desktop.
Save vieskees/87bc46f62af71ae4a2e78c87296a7ab7 to your computer and use it in GitHub Desktop.
Start script hostname and ip
#! /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