Skip to content

Commit 8a19947

Browse files
committed
fix: provide randomized hostname, if no hostname set
1 parent eb24a70 commit 8a19947

2 files changed

Lines changed: 2 additions & 10 deletions

File tree

‎system/cuos/init.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ prepare_data_volume() {
9090
}
9191

9292
set_hostname() {
93-
OLD_HOSTNAME="$(cat /etc/hostname)"
93+
OLD_HOSTNAME="$(cat /etc/hostname 2>/dev/null)"
9494

9595
SYSTEM_HOSTNAME="$(jq_config '.hostname // empty')"
96-
if [[ -z "${SYSTEM_HOSTNAME}" && ! -f /etc/hostname ]]; then
96+
if [[ -z "${SYSTEM_HOSTNAME}" && -z "${OLD_HOSTNAME}" ]]; then
9797
local r1 r2 hn
9898
r1=$(printf "%02X" $(( RANDOM % 256 )))
9999
r2=$(printf "%02X" $(( RANDOM % 256 )))

‎system/cuos/system-default.json‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,2 @@
11
{
2-
"hostname": "cuos-system",
3-
"update_registry": "gitlab.triovega.com:4567/securitygateway",
4-
"update_registry_user": "securitygateway",
5-
"update_registry_password": "",
6-
"initial_image": "/app-system-dev/app-system-dev:development",
7-
"initial_image_digest": "sha256:9576b02ce00d8a978992c62b0fe5ae57b9163f25445581ff3c40bbb6b492a7e1",
8-
"os_image": "/base-system-docker-boot/base-system-docker-boot-base:development",
9-
"os_image_digest": ""
102
}

0 commit comments

Comments
 (0)