From afe4ee0d0167408ff31b2c122d525eaf223f7f97 Mon Sep 17 00:00:00 2001 From: Mick Michalski <mmichami@gmail.com> Date: Thu, 30 Mar 2017 15:53:33 -0700 Subject: [PATCH] Modified hostname.sh --- recipes-core/initscripts/files/hostname.sh | 28 +++++++--------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/recipes-core/initscripts/files/hostname.sh b/recipes-core/initscripts/files/hostname.sh index a67e212..62d2c13 100755 --- a/recipes-core/initscripts/files/hostname.sh +++ b/recipes-core/initscripts/files/hostname.sh @@ -1,21 +1,9 @@ -#!/bin/sh -### BEGIN INIT INFO -# Provides: hostname -# Required-Start: -# Required-Stop: -# Default-Start: S -# Default-Stop: -# Short-Description: Set hostname based on /etc/hostname -### END INIT INFO -HOSTNAME=$(/bin/hostname) - -# Use gateway_hostaname if avaiable, if not use hostname file -if [ -f /etc/hostname ]; then - if [ -f /usr/bin/gateway_hostname ]; then - hostname `/usr/bin/gateway_hostname` - else - hostname `cat /etc/hostname` - fi -elif [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" -o ! -z "`echo $HOSTNAME | sed -n '/^[0-9]*\.[0-9].*/p'`" ] ; then - hostname localhost +url="rigadogateway.com" +if [[ "$(cat /sys/fsl_otp/HW_OCOTP_GP37)" == "0x0" ]] ; then + # No unit serial number set, use board serial number + hostname $(board_serial_number).$url +else + # unit serial number set, use it + hostname $(unit_serial_number).$url fi + -- GitLab