diff --git a/userspace/files/serial-hostname.service b/userspace/files/serial-hostname.service new file mode 100644 index 0000000..d4562a4 --- /dev/null +++ b/userspace/files/serial-hostname.service @@ -0,0 +1,10 @@ +[Unit] +Description=Sets the hostname to the device's serial number + +[Service] +User=root +Type=oneshot +ExecStart=/usr/comma/set-hostname.sh + +[Install] +WantedBy=multi-user.target diff --git a/userspace/services.sh b/userspace/services.sh index 9778c58..94bd002 100755 --- a/userspace/services.sh +++ b/userspace/services.sh @@ -8,6 +8,7 @@ systemctl enable cdsprpcd # Enable our services systemctl enable fs_setup.service +systemctl enable serial-hostname.service systemctl enable comma.service systemctl enable gpio.service systemctl enable lte.service diff --git a/userspace/usr/comma/set-hostname.sh b/userspace/usr/comma/set-hostname.sh new file mode 100755 index 0000000..a1e3180 --- /dev/null +++ b/userspace/usr/comma/set-hostname.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -e + +SERIAL="$(cat /proc/cmdline | sed -e 's/^.*androidboot.serialno=//' -e 's/ .*$//')" +echo "serial: '$SERIAL'" +hostname "tici-$SERIAL"