From d30343f626916a5b6f23cec67df919bd5a5b643a Mon Sep 17 00:00:00 2001 From: Rene Klootwijk Date: Sat, 26 Oct 2019 12:49:30 +0200 Subject: [PATCH] Added hostname parameter --- README.md | 6 +++++- build.sh | 2 ++ stage1/02-net-tweaks/00-run.sh | 2 +- stage1/02-net-tweaks/files/hostname | 1 - 4 files changed, 8 insertions(+), 3 deletions(-) delete mode 100644 stage1/02-net-tweaks/files/hostname diff --git a/README.md b/README.md index 33f085e..e131ca4 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ The following environment variables are supported: be built and cached. Note, `WORK_DIR` stores a complete copy of the target system for each build stage, amounting to tens of gigabytes in the case of Raspbian. - + **CAUTION**: If your working directory is on an NTFS partition you probably won't be able to build. Make sure this is a proper Linux filesystem. * `DEPLOY_DIR` (Default: `"$BASE_DIR/deploy"`) @@ -82,6 +82,10 @@ The following environment variables are supported: Default system locale. + * `HOSTNAME` (Default: "raspberrypi" ) + + Setting the hostname to the specified value. + * `KEYBOARD_KEYMAP` (Default: "gb" ) Default keyboard keymap. diff --git a/build.sh b/build.sh index 81ef26f..a730e44 100755 --- a/build.sh +++ b/build.sh @@ -161,6 +161,8 @@ export DEPLOY_DIR=${DEPLOY_DIR:-"${BASE_DIR}/deploy"} export DEPLOY_ZIP="${DEPLOY_ZIP:-1}" export LOG_FILE="${WORK_DIR}/build.log" +export HOSTNAME=${HOSTNAME:-raspberrypi} + export FIRST_USER_NAME=${FIRST_USER_NAME:-pi} export FIRST_USER_PASS=${FIRST_USER_PASS:-raspberry} export WPA_ESSID diff --git a/stage1/02-net-tweaks/00-run.sh b/stage1/02-net-tweaks/00-run.sh index a49b4b0..8637edc 100755 --- a/stage1/02-net-tweaks/00-run.sh +++ b/stage1/02-net-tweaks/00-run.sh @@ -1,5 +1,5 @@ #!/bin/bash -e -install -m 644 files/hostname "${ROOTFS_DIR}/etc/hostname" +echo "${HOSTNAME}" > "${ROOTFS_DIR}/etc/hostname" ln -sf /dev/null "${ROOTFS_DIR}/etc/systemd/network/99-default.link" diff --git a/stage1/02-net-tweaks/files/hostname b/stage1/02-net-tweaks/files/hostname deleted file mode 100644 index 41757af..0000000 --- a/stage1/02-net-tweaks/files/hostname +++ /dev/null @@ -1 +0,0 @@ -raspberrypi