instalador-firma-digital/03-set_version.sh
2024-05-03 23:22:58 -06:00

33 lines
1.4 KiB
Bash

#!/bin/sh
set_version() {
# Linux
for os in /etc/os-release /usr/lib/os-release; do
[ -f $os ] && . $os && break
done
[ "$ID" = "debian" ] && ID="$(printf '%s %s' "$ID" "$VERSION_ID" | awk '{if ($2 >= 10) print $1}')"
[ "$ID" = "ubuntu" ] && ID="$(printf '%s %s' "$ID" "$VERSION_ID" | awk '{if ($2 >= 18.04) print $1}')"
[ "$ID" = "fedora" ] && ID="$(printf '%s %s' "$ID" "$VERSION_ID" | awk '{if ($2 >= 34) print $1}')"
[ "$ID" = "centos" ] && ID="$(printf '%s %s' "$ID" "$VERSION_ID" | awk '{if ($2 = 7) print $1}')"
[ "$ID" = "centos" ] && ID="$(printf '%s %s' "$ID" "$VERSION_ID" | awk '{if ($2 = 9) print "fedora"}')"
# MacOS
if v=/System/Library/CoreServices/SystemVersion.plist; [ -f "$v" ]; then
temp=
while read -r line; do
case $line in
*ProductVersion*) temp=.;;
*)
[ "$temp" ] || continue
VERSION_ID=${line#*>}
break
esac
done < "$v"
ID="$(printf '%s' "$VERSION_ID" | awk '{if ($1 >= 10.14) print "macos"}')"
fi
[ "$ID" = "debian" -o "$ID" = "ubuntu" ] && FILE="ClientesLinux_DEB64_Rev25.zip"
[ "$ID" = "fedora" ] && FILE="ClientesLinux_RPM64_Rev24.zip"
[ "$ID" = "centos" ] && FILE="ClientesLinux_CentOS7_Rev6.zip"
[ "$ID" = "macos" ] && FILE="ClientesMac_rev34.zip"
}