summaryrefslogtreecommitdiff
path: root/home/scripts/system_name.sh
blob: 262529350004c95baa0c510072ea2f6afa891b08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh

PLATFORM="${PLATFORM:-`platform.sh`}"

MACHINE="$HOST"
if [ "$PLATFORM" = "osx" ]; then
	MACHINE="$(scutil --get ComputerName)"
elif [ "$PLATFORM" = "linux" ]; then
	MACHINE="$(cat /proc/sys/kernel/hostname)"
fi

echo $MACHINE | awk -F\. '{print $1}' \
	| tr '[:upper:]' '[:lower:]' \
	| tr ' ' '-'