CCR_Hostname configures a decent hostname for the device. The hostname to use can be specified by the caller, otherwise the default behaviour is to create a unique hostname using the BeagleBone device type combined with the first 4 characters of the machine ID.
| Key | Description |
|---|---|
| available since | 2017-01 |
| package filename | ccr_hostname-xyz.deb |
| configuration | /opt/ccr/files/hostname.ccr |
| cron job | /etc/cron.d/ccr_hostname |
| scripts | /usr/bin/ccr_bbtype.sh |
| examples | ccr_bbtype.sh |
The script ccr_bbtype.sh returns a simple 1-word string that describes the BeagleBone device type. For example, it returns BBB for BeagleBone Black, and BBGW for BeagleBone Green Wireless.
The hostname to use is stored in /opt/ccr/files/hostname.ccr. If this file does not exist, then ccr_hostname.sh will call upon ccr_bbtype.sh and attempt to automatically create a semi-descriptive and semi-unique hostname.
To install:
Then either reboot the device, or manually run the script:
The new hostname can also be provided on the command-line when manually calling the script. This will automatically update /opt/ccr/files/hostname.ccr so the name is maintained through a reboot. For example:
ccr_hostname.sh to change the hostname, the command line prompt will only reflect the new name once you log out and log back into the device.A message is logged to syslog when ccr_hostname.sh changes the hostname:
Example hostnames that may be created by default with this package if hostname.ccr does not exist:
ccr_bbbw_04e8 ccr_bbg_37af ccr_bbb_c1d0 /opt/ccr/files/hostname.ccr /etc/machine-id /var/lib/dbus/machine-id /etc/hostname /etc/host