Skip to content

Instantly share code, notes, and snippets.

@007revad
Created March 17, 2023 01:36
Show Gist options
  • Save 007revad/26a13babbe25c722a13d569b8ade81c8 to your computer and use it in GitHub Desktop.
Save 007revad/26a13babbe25c722a13d569b8ade81c8 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Get Synology model reliably
unique=$(get_key_value /etc/synoinfo.conf unique | cut -d'_' -f3) # returns 213+
echo "unique: $unique"
model=$(cat /proc/sys/kernel/syno_hw_version) # returns DS213pv10-j
echo "model: $model"
[[ $model =~ ([0-9]{3,}) ]] && modelnum=${BASH_REMATCH[1]} # returns 213
echo "modelnum: $modelnum"
modeltype=$(printf "%s" "$model" | sed 's/[0-9].*//') # returns DS
echo "modeltype: $modeltype"
if [[ $modelnum != "$unique" ]]; then
model="$modeltype$unique"
fi
echo -e "\nNAS is a $model"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment