Unify prompt texts (#56)
* Adjust & unify prompts * Change case y|Y to [yY] * Add some missing trailing dots
This commit is contained in:
parent
288a7f69e9
commit
305bd0d225
@ -216,42 +216,41 @@ function configure {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $sensorsDetected = true ]; then
|
if [ $sensorsDetected = true ]; then
|
||||||
msg "\nSelect a unit for temperature readings..."
|
echo
|
||||||
read -p "Type C for Celsius or F for Fahrenheit and press Enter: " TEMP_UNIT
|
read -p "Do you wish to display temperature readings in degrees Celsius [C] or Fahrenheit [f]? (C/f): " TEMP_UNIT
|
||||||
|
|
||||||
case "$TEMP_UNIT" in
|
case "$TEMP_UNIT" in
|
||||||
[cC])
|
[cC] | "")
|
||||||
TEMP_UNIT="C"
|
TEMP_UNIT="C"
|
||||||
|
info "Temperatures will be presented in degrees Celsius."
|
||||||
;;
|
;;
|
||||||
[fF])
|
[fF])
|
||||||
TEMP_UNIT="F"
|
TEMP_UNIT="F"
|
||||||
;;
|
info "Temperatures will be presented in degrees Fahrenheit."
|
||||||
"")
|
|
||||||
info "No unit selected. Temperatures will be presented in degrees Celsius."
|
|
||||||
TEMP_UNIT="C"
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
warn "Invalid unit selected. Temperatures will be presented in degrees Celsius."
|
warn "Invalid unit selected. Temperatures will be displayed in degrees Celsius."
|
||||||
TEMP_UNIT="C"
|
TEMP_UNIT="C"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
echo ""
|
|
||||||
read -p "Do you wish to enable System Information. [Yn]: " ENABLE_SYS_INFO
|
echo
|
||||||
|
read -p "Do you wish to enable system information? (Y/n): " ENABLE_SYS_INFO
|
||||||
case "$ENABLE_SYS_INFO" in
|
case "$ENABLE_SYS_INFO" in
|
||||||
[yY]|"")
|
[yY] | "")
|
||||||
enableSystemInfo=true
|
enableSystemInfo=true
|
||||||
msg "Displaying System Information... yes"
|
info "System information will be displayed..."
|
||||||
;;
|
;;
|
||||||
[nN])
|
[nN])
|
||||||
enableSystemInfo=false
|
enableSystemInfo=false
|
||||||
msg "Displaying System Information... no"
|
info "System information will NOT be displayed..."
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
warn "Invalid selection. System information will be displayed."
|
warn "Invalid selection. System information will be displayed."
|
||||||
enableSystemInfo=true
|
enableSystemInfo=true
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
echo # add a new line
|
echo # add a new line
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,7 +274,7 @@ function install_mod {
|
|||||||
|
|
||||||
# Create backup of original file
|
# Create backup of original file
|
||||||
cp "$pvemanagerlibjs" "$BACKUP_DIR/pvemanagerlib.js.$timestamp"
|
cp "$pvemanagerlibjs" "$BACKUP_DIR/pvemanagerlib.js.$timestamp"
|
||||||
msg "Backup of \"$pvemanagerlibjs\" saved to \"$BACKUP_DIR/pvemanagerlib.js.$timestamp\"."
|
msg "Backup of \"$pvemanagerlibjs\" saved to \"$BACKUP_DIR/pvemanagerlib.js.$timestamp\"."
|
||||||
else
|
else
|
||||||
err "Mod is already installed. Uninstall existing before installing."
|
err "Mod is already installed. Uninstall existing before installing."
|
||||||
exit
|
exit
|
||||||
@ -288,7 +287,7 @@ function install_mod {
|
|||||||
sensorsCmd="cat \"$JSON_FILE\""
|
sensorsCmd="cat \"$JSON_FILE\""
|
||||||
else
|
else
|
||||||
# WTF: sensors -f used for Fahrenheit breaks the fan speeds :|
|
# WTF: sensors -f used for Fahrenheit breaks the fan speeds :|
|
||||||
#local sensorsCmd=$([[ "$TEMP_UNIT" = "F" ]] && echo "sensors -j -f" || echo "sensors -j")
|
#local sensorsCmd=$([[ "$TEMP_UNIT" = "F" ]] && echo "sensors -j -f" || echo "sensors -j")
|
||||||
sensorsCmd="sensors -j"
|
sensorsCmd="sensors -j"
|
||||||
fi
|
fi
|
||||||
sed -i '/my \$dinfo = df('\''\/'\'', 1);/i\'$'\t''$res->{sensorsOutput} = `'"$sensorsCmd"'`;\n\t# sanitize JSON output\n\t$res->{sensorsOutput} =~ s/ERROR:.+\\s(\\w+):\\s(.+)/\\"$1\\": 0.000,/g;\n\t$res->{sensorsOutput} =~ s/ERROR:.+\\s(\\w+)!/\\"$1\\": 0.000,/g;\n\t$res->{sensorsOutput} =~ s/,(.*[.\\n]*.+})/$1/g;\n' "$nodespm"
|
sed -i '/my \$dinfo = df('\''\/'\'', 1);/i\'$'\t''$res->{sensorsOutput} = `'"$sensorsCmd"'`;\n\t# sanitize JSON output\n\t$res->{sensorsOutput} =~ s/ERROR:.+\\s(\\w+):\\s(.+)/\\"$1\\": 0.000,/g;\n\t$res->{sensorsOutput} =~ s/ERROR:.+\\s(\\w+)!/\\"$1\\": 0.000,/g;\n\t$res->{sensorsOutput} =~ s/,(.*[.\\n]*.+})/$1/g;\n' "$nodespm"
|
||||||
@ -298,7 +297,7 @@ function install_mod {
|
|||||||
if [[ "$enableSystemInfo" == true ]]; then
|
if [[ "$enableSystemInfo" == true ]]; then
|
||||||
local systemInfoCmd=$(dmidecode -t 1 | awk -F': ' '/Manufacturer|Product Name|Serial Number/ {print $1": "$2}' | awk '{$1=$1};1' | sed 's/$/ |/' | paste -sd " " - | sed 's/ |$//')
|
local systemInfoCmd=$(dmidecode -t 1 | awk -F': ' '/Manufacturer|Product Name|Serial Number/ {print $1": "$2}' | awk '{$1=$1};1' | sed 's/$/ |/' | paste -sd " " - | sed 's/ |$//')
|
||||||
sed -i "/my \$dinfo = df('\/', 1);/i\\\t\$res->{systemInfo} = \"$(echo "$systemInfoCmd")\";\n" "$nodespm"
|
sed -i "/my \$dinfo = df('\/', 1);/i\\\t\$res->{systemInfo} = \"$(echo "$systemInfoCmd")\";\n" "$nodespm"
|
||||||
msg "System Information output added to \"$nodespm\"."
|
msg "System information output added to \"$nodespm\"."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add new item to the items array in PVE.node.StatusView
|
# Add new item to the items array in PVE.node.StatusView
|
||||||
@ -814,7 +813,7 @@ function restart_proxy {
|
|||||||
function save_sensors_data {
|
function save_sensors_data {
|
||||||
# Check if DEBUG_SAVE_PATH exists and is writable
|
# Check if DEBUG_SAVE_PATH exists and is writable
|
||||||
if [[ ! -d "$DEBUG_SAVE_PATH" || ! -w "$DEBUG_SAVE_PATH" ]]; then
|
if [[ ! -d "$DEBUG_SAVE_PATH" || ! -w "$DEBUG_SAVE_PATH" ]]; then
|
||||||
err "Directory $DEBUG_SAVE_PATH does not exist or is not writable. No file could be saved"
|
err "Directory $DEBUG_SAVE_PATH does not exist or is not writable. No file could be saved."
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -822,21 +821,21 @@ function save_sensors_data {
|
|||||||
if (command -v sensors &>/dev/null); then
|
if (command -v sensors &>/dev/null); then
|
||||||
# Save sensors output
|
# Save sensors output
|
||||||
local filepath="${DEBUG_SAVE_PATH}/${DEBUG_SAVE_FILENAME}"
|
local filepath="${DEBUG_SAVE_PATH}/${DEBUG_SAVE_FILENAME}"
|
||||||
echo "Sensors data will be saved in $filepath"
|
msg "Sensors data will be saved in $filepath"
|
||||||
|
|
||||||
# Prompt user for confirmation
|
# Prompt user for confirmation
|
||||||
read -p "Do you wish to continue? (y/n): " choice
|
read -p "Do you wish to continue? (y/n): " choice
|
||||||
case "$choice" in
|
case "$choice" in
|
||||||
y|Y )
|
[yY])
|
||||||
sensors -j > "$filepath"
|
sensors -j >"$filepath"
|
||||||
msgb "Sensors data saved in $filepath"
|
msgb "Sensors data saved in $filepath."
|
||||||
;;
|
;;
|
||||||
* )
|
*)
|
||||||
echo "Operation cancelled by user."
|
warn "Operation cancelled by user."
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
err "Sensors is not installed. No file could be saved"
|
err "Sensors is not installed. No file could be saved."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -862,7 +861,7 @@ while [[ $# -gt 0 ]]; do
|
|||||||
msgb "\nSaving current sensor readings in a file for debugging..."
|
msgb "\nSaving current sensor readings in a file for debugging..."
|
||||||
save_sensors_data
|
save_sensors_data
|
||||||
echo # add a new line
|
echo # add a new line
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user