Created
March 17, 2023 01:36
-
-
Save 007revad/26a13babbe25c722a13d569b8ade81c8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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