Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion userspace/root/etc/NetworkManager/NetworkManager.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[main]
plugins=ifupdown,keyfile
dns=default
# Hostname is set by serial-hostname service via sysctl, not /etc/hostname
# Hostname is set by /usr/comma/set-hostname.sh during boot
hostname-mode=none

[ifupdown]
Expand Down
6 changes: 1 addition & 5 deletions userspace/root/etc/runit/1
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,7 @@ for part in \
done

echo "=> Setting hostname..."
if [ -f /etc/hostname ]; then
hostname "$(cat /etc/hostname)"
else
hostname comma
fi
/usr/comma/set-hostname.sh

echo "=> Running core services..."
for f in /etc/runit/core-services/*.sh; do
Expand Down
12 changes: 9 additions & 3 deletions userspace/root/usr/comma/set-hostname.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/bin/bash
#!/bin/sh
set -e

SERIAL="$(/usr/comma/get-serial.sh)"
echo "serial: '$SERIAL'"
sysctl kernel.hostname="comma-$SERIAL"
HOSTNAME="comma"

if [ -n "$SERIAL" ] && [ "$SERIAL" != "(none)" ]; then
HOSTNAME="comma-$SERIAL"
fi

echo "hostname: '$HOSTNAME'"
hostname "$HOSTNAME"
Loading