Drop test station name detection via DNS
This commit is contained in:
parent
7dd35e3572
commit
49ed3c2919
3 changed files with 18 additions and 46 deletions
16
setup/linux/profile_base/airootfs/etc/skel/.setup_teststation
Executable file
16
setup/linux/profile_base/airootfs/etc/skel/.setup_teststation
Executable file
|
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/env bash
|
||||||
|
#
|
||||||
|
## Set up teststation settings if detected
|
||||||
|
|
||||||
|
# Hostname
|
||||||
|
if [[ -s "/run/archiso/bootmnt/teststation.name" ]]; then
|
||||||
|
NEW_HOSTNAME="$(head -1 "/run/archiso/bootmnt/teststation.name" \
|
||||||
|
| sed -r 's/\s//g')"
|
||||||
|
sudo hostnamectl set-hostname "${NEW_HOSTNAME}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Wallpaper
|
||||||
|
if [[ -s "/run/archiso/bootmnt/teststation.wall" ]]; then
|
||||||
|
rm "${HOME}/.wallpaper" >/dev/null 2>&1
|
||||||
|
ln -s "/run/archiso/bootmnt/teststation.wall" "${HOME}/.wallpaper"
|
||||||
|
fi
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
#!/bin/env bash
|
|
||||||
#
|
|
||||||
## Setup network and update hostname
|
|
||||||
|
|
||||||
IP=
|
|
||||||
NEW_HOSTNAME=
|
|
||||||
|
|
||||||
# Load test station details if present
|
|
||||||
if [[ -s "/run/archiso/bootmnt/teststation.name" ]]; then
|
|
||||||
NEW_HOSTNAME="$(head -1 "/run/archiso/bootmnt/teststation.name" \
|
|
||||||
| sed -r 's/\s//g')"
|
|
||||||
fi
|
|
||||||
if [[ -s "/run/archiso/bootmnt/teststation.wall" ]]; then
|
|
||||||
rm "${HOME}/.wallpaper" >/dev/null 2>&1
|
|
||||||
ln -s "/run/archiso/bootmnt/teststation.wall" "${HOME}/.wallpaper"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Wait for network connection and get IP
|
|
||||||
echo -n "Waiting for network... "
|
|
||||||
for x in {1..3}; do
|
|
||||||
sleep 1s
|
|
||||||
IP="$(ip a show scope global \
|
|
||||||
| grep inet \
|
|
||||||
| head -1 \
|
|
||||||
| sed -r 's#.*inet ([0-9]+.[0-9]+.[0-9]+.[0-9]+)/.*#\1#')"
|
|
||||||
if [[ "${IP:+x}" ]]; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo "Done"
|
|
||||||
|
|
||||||
# Set hostname
|
|
||||||
if [[ -z "${NEW_HOSTNAME:+x}" && "${IP:+x}" ]]; then
|
|
||||||
NEW_HOSTNAME="$(dig +noall +answer +short -x "$IP" \
|
|
||||||
| grep -v ';' \
|
|
||||||
| head -1 \
|
|
||||||
| sed 's/\.$//')"
|
|
||||||
fi
|
|
||||||
if [[ "${NEW_HOSTNAME:+x}" ]]; then
|
|
||||||
echo -n "Updating hostname... "
|
|
||||||
sudo hostnamectl set-hostname "${NEW_HOSTNAME}"
|
|
||||||
fi
|
|
||||||
echo "Done"
|
|
||||||
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
setterm -blank 0 -powerdown 0 2>/dev/null
|
setterm -blank 0 -powerdown 0 2>/dev/null
|
||||||
if [ "$(fgconsole 2>/dev/null)" -eq "1" ]; then
|
if [ "$(fgconsole 2>/dev/null)" -eq "1" ]; then
|
||||||
# Connect to network and update hostname
|
# Set up teststation details
|
||||||
$HOME/.update_network
|
$HOME/.setup_teststation
|
||||||
|
|
||||||
# Start HW-diags
|
# Start HW-diags
|
||||||
hw-diags --cli
|
hw-diags --cli
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue