1
0
mirror of https://github.com/TheLocehiliosan/yadm synced 2026-03-02 03:49:29 +00:00

Support DISTRO in alternates (#72)

This commit is contained in:
Tim Byrne
2019-10-06 11:04:21 -05:00
parent 4f6b0f09cd
commit 6a3199ceea
4 changed files with 60 additions and 13 deletions

13
yadm
View File

@@ -154,23 +154,30 @@ function score_file() {
score=0
return
fi
elif [[ "$label" =~ ^(d|distro)$ ]]; then
if [ "$value" = "$local_distro" ]; then
score=$((score + 2))
else
score=0
return
fi
elif [[ "$label" =~ ^(c|class)$ ]]; then
if [ "$value" = "$local_class" ]; then
score=$((score + 2))
score=$((score + 4))
else
score=0
return
fi
elif [[ "$label" =~ ^(h|hostname)$ ]]; then
if [ "$value" = "$local_host" ]; then
score=$((score + 4))
score=$((score + 8))
else
score=0
return
fi
elif [[ "$label" =~ ^(u|user)$ ]]; then
if [ "$value" = "$local_user" ]; then
score=$((score + 8))
score=$((score + 16))
else
score=0
return