misc: Start removing useless quotes

This commit is contained in:
Dylan Araps 2019-01-09 09:44:22 +02:00
parent acc8103dde
commit fbf441ef2f

View file

@ -845,7 +845,7 @@ get_os() {
} }
get_distro() { get_distro() {
[[ "$distro" ]] && return [[ $distro ]] && return
case "$os" in case "$os" in
"Linux" | "BSD" | "MINIX") "Linux" | "BSD" | "MINIX")
@ -854,13 +854,13 @@ get_distro() {
"on" | "tiny") distro="Bedrock Linux" ;; "on" | "tiny") distro="Bedrock Linux" ;;
*) distro="$(< /bedrock/etc/bedrock-release)" *) distro="$(< /bedrock/etc/bedrock-release)"
esac esac
elif [[ -f "/etc/redstar-release" ]]; then elif [[ -f /etc/redstar-release ]]; then
case "$distro_shorthand" in case "$distro_shorthand" in
"on" | "tiny") distro="Red Star OS" ;; "on" | "tiny") distro="Red Star OS" ;;
*) distro="Red Star OS $(awk -F'[^0-9*]' '$0=$2' /etc/redstar-release)" *) distro="Red Star OS $(awk -F'[^0-9*]' '$0=$2' /etc/redstar-release)"
esac esac
elif [[ -f "/etc/siduction-version" ]]; then elif [[ -f /etc/siduction-version ]]; then
case "$distro_shorthand" in case "$distro_shorthand" in
"on" | "tiny") distro="Siduction" ;; "on" | "tiny") distro="Siduction" ;;
*) distro="Siduction ($(lsb_release -sic))" *) distro="Siduction ($(lsb_release -sic))"
@ -874,7 +874,7 @@ get_distro() {
esac esac
distro="$(lsb_release "$lsb_flags")" distro="$(lsb_release "$lsb_flags")"
elif [[ -f "/etc/GoboLinuxVersion" ]]; then elif [[ -f /etc/GoboLinuxVersion ]]; then
case "$distro_shorthand" in case "$distro_shorthand" in
"on" | "tiny") distro="GoboLinux" ;; "on" | "tiny") distro="GoboLinux" ;;
*) distro="GoboLinux $(< /etc/GoboLinuxVersion)" *) distro="GoboLinux $(< /etc/GoboLinuxVersion)"
@ -900,7 +900,7 @@ get_distro() {
type -p kpm >/dev/null; then type -p kpm >/dev/null; then
distro="KSLinux" distro="KSLinux"
elif [[ -d "/system/app/" && -d "/system/priv-app" ]]; then elif [[ -d /system/app/ && -d /system/priv-app ]]; then
distro="Android $(getprop ro.build.version.release)" distro="Android $(getprop ro.build.version.release)"
# Chrome OS doesn't conform to the /etc/*-release standard. # Chrome OS doesn't conform to the /etc/*-release standard.
@ -909,10 +909,8 @@ get_distro() {
elif [[ -f /etc/lsb-release && "$(< /etc/lsb-release)" == *CHROMEOS* ]]; then elif [[ -f /etc/lsb-release && "$(< /etc/lsb-release)" == *CHROMEOS* ]]; then
distro="$(awk -F '=' '/NAME|VERSION/ {printf $2 " "}' /etc/lsb-release)" distro="$(awk -F '=' '/NAME|VERSION/ {printf $2 " "}' /etc/lsb-release)"
elif [[ -f "/etc/os-release" || \ elif [[ -f /etc/os-release || -f /usr/lib/os-release || -f /etc/openwrt_release ]]; then
-f "/usr/lib/os-release" || \ files=(/etc/os-release /usr/lib/os-release /etc/openwrt_release)
-f "/etc/openwrt_release" ]]; then
files=("/etc/os-release" "/usr/lib/os-release" "/etc/openwrt_release")
# Source the os-release file # Source the os-release file
for file in "${files[@]}"; do for file in "${files[@]}"; do
@ -930,7 +928,7 @@ get_distro() {
distro+="$(< "$release_file")" distro+="$(< "$release_file")"
done done
if [[ -z "$distro" ]]; then if [[ -z $distro ]]; then
case "$distro_shorthand" in case "$distro_shorthand" in
"on" | "tiny") distro="$kernel_name" ;; "on" | "tiny") distro="$kernel_name" ;;
*) distro="$kernel_name $kernel_version" ;; *) distro="$kernel_name $kernel_version" ;;
@ -938,23 +936,22 @@ get_distro() {
distro="${distro/DragonFly/DragonFlyBSD}" distro="${distro/DragonFly/DragonFlyBSD}"
# Workarounds for FreeBSD based distros. # Workarounds for FreeBSD based distros.
[[ -f "/etc/pcbsd-lang" ]] && distro="PCBSD" [[ -f /etc/pcbsd-lang ]] && distro="PCBSD"
[[ -f "/etc/trueos-lang" ]] && distro="TrueOS" [[ -f /etc/trueos-lang ]] && distro="TrueOS"
# /etc/pacbsd-release is an empty file # /etc/pacbsd-release is an empty file
[[ -f "/etc/pacbsd-release" ]] && distro="PacBSD" [[ -f /etc/pacbsd-release ]] && distro="PacBSD"
fi fi
fi fi
if [[ "$(< /proc/version)" == *"Microsoft"* || if [[ "$(< /proc/version)" == *Microsoft* || $kernel_version == *Microsoft* ]]; then
"$kernel_version" == *"Microsoft"* ]]; then
case "$distro_shorthand" in case "$distro_shorthand" in
"on") distro+=" [Windows 10]" ;; "on") distro+=" [Windows 10]" ;;
"tiny") distro="Windows 10" ;; "tiny") distro="Windows 10" ;;
*) distro+=" on Windows 10" ;; *) distro+=" on Windows 10" ;;
esac esac
elif [[ "$(< /proc/version)" == *"chrome-bot"* || -f "/dev/cros_ec" ]]; then elif [[ "$(< /proc/version)" == *chrome-bot* || -f /dev/cros_ec ]]; then
case "$distro_shorthand" in case "$distro_shorthand" in
"on") distro+=" [Chrome OS]" ;; "on") distro+=" [Chrome OS]" ;;
"tiny") distro="Chrome OS" ;; "tiny") distro="Chrome OS" ;;
@ -1037,7 +1034,7 @@ get_distro() {
distro="${distro//Enterprise Server}" distro="${distro//Enterprise Server}"
[[ -z "$distro" ]] && distro="$os (Unknown)" [[ -z $distro ]] && distro="$os (Unknown)"
# Get OS architecture. # Get OS architecture.
case "$os" in case "$os" in
@ -1046,17 +1043,17 @@ get_distro() {
*) machine_arch="$kernel_machine" ;; *) machine_arch="$kernel_machine" ;;
esac esac
[[ "$os_arch" == "on" ]] && \ [[ $os_arch == on ]] && \
distro+=" $machine_arch" distro+=" $machine_arch"
[[ "${ascii_distro:-auto}" == "auto" ]] && \ [[ ${ascii_distro:-auto} == auto ]] && \
ascii_distro="$(trim "$distro")" ascii_distro="$(trim "$distro")"
} }
get_model() { get_model() {
case "$os" in case "$os" in
"Linux") "Linux")
if [[ -d "/system/app/" && -d "/system/priv-app" ]]; then if [[ -d /system/app/ && -d /system/priv-app ]]; then
model="$(getprop ro.product.brand) $(getprop ro.product.model)" model="$(getprop ro.product.brand) $(getprop ro.product.model)"
elif [[ -f /sys/devices/virtual/dmi/id/product_name || elif [[ -f /sys/devices/virtual/dmi/id/product_name ||