• Reorganized the scripts into different categories
• Refactored the graphical boot screens to have separate boot and shutdown images • Changed the reboot and shutdown code to force the display of the splash images. • Added 'Team Onefinity.ngc' to the installer files
This commit is contained in:
26
installer/scripts/sethostname
Normal file
26
installer/scripts/sethostname
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
HOSTNAME="$(echo "$1" | tr '[:upper:]' '[:lower:]')"
|
||||
|
||||
if [ "$HOSTNAME" == "" ]; then
|
||||
echo "Usage: $0 <hostname>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$HOSTNAME" == "localhost" ]; then
|
||||
echo "Cannot set hostname to 'localhost'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$HOSTNAME" =~ ^.*\.local$ ]; then
|
||||
echo "Hostname cannot end with '.local'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! "$HOSTNAME" =~ ^[a-zA-Z][a-zA-Z0-9-]{0,62}$ ]]; then
|
||||
echo "Invalid hostname '$HOSTNAME'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sed -i "s/^127.0.1.1\([[:space:]]*\).*$/127.0.1.1\1$HOSTNAME/" /etc/hosts
|
||||
echo "$HOSTNAME" > /etc/hostname
|
||||
Reference in New Issue
Block a user