Skip to content

Commit

Permalink
fix: Add hostname reset to bazzite-hardware-setup if the hostname is …
Browse files Browse the repository at this point in the history
…too long for distrobox to reliably function
  • Loading branch information
KyleGospo committed Oct 4, 2023
1 parent 1ea8a5f commit 3fa0d5d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions system_files/desktop/shared/usr/bin/bazzite-hardware-setup
Expand Up @@ -180,6 +180,14 @@ else
echo "No fstab param adjustments needed"
fi

# HOSTNAME FIX
# If the hostname is too long Distrobox will fail during setup
# Additonally, Anaconda likes to set the hostname to be the ipv6 address
# Let's check the length and reset it to something sensible if that happens.
if hostname | wc -m > 15; then
hostnamectl set-hostname bazzite
fi

echo $HWS_VER > $HWS_VER_FILE
echo $IMAGE_NAME > $KNOWN_IMAGE_NAME_FILE
echo $IMAGE_FLAVOR > $KNOWN_IMAGE_FLAVOR_FILE

1 comment on commit 3fa0d5d

@szescxz
Copy link

@szescxz szescxz commented on 3fa0d5d Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KyleGospo Condition seems problematic as the hostnamectl command will always get executed. Hostname of my device always gets reverted due to this.

Perhaps

if (( $(hostname | wc -m) > 15 )); then

?
Note that the newline character outputted by hostname is still counted by wc (So hostname bazzite will be counted as 8 characters).

Please sign in to comment.