From acedbed3081d97d60968e6218a2c1dec60a91c0c Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Thu, 22 Sep 2022 20:57:16 -0700 Subject: [PATCH] set hostname to tici- (#89) * set hostname to tici- * runs as root --- userspace/files/serial-hostname.service | 10 ++++++++++ userspace/services.sh | 1 + userspace/usr/comma/set-hostname.sh | 6 ++++++ 3 files changed, 17 insertions(+) create mode 100644 userspace/files/serial-hostname.service create mode 100755 userspace/usr/comma/set-hostname.sh 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"