-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added possibility via config add other products to check BIOS version…
…s aswell + fixed url with required language
- Loading branch information
Showing
12 changed files
with
135 additions
and
55 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "bashdb", | ||
"request": "launch", | ||
"name": "Bash-Debug (simplest configuration)", | ||
"program": "${file}", | ||
"env": { | ||
"BIOS_IS_UPTODATE_SCRIPT_FILE_PATH":"/usr/share/asus-bios-updates-notifier/bios_is_uptodate_script.sh", | ||
"BIOS_IS_UPGRADABLE_SCRIPT_FILE_PATH":"/usr/share/asus-bios-updates-notifier/bios_is_upgradable_script.sh", | ||
"CONFIG_DIR_PATH": "/usr/share/asus-bios-updates-notifier/" | ||
} | ||
} | ||
] | ||
} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
notify-send "BIOS v$BIOS_VERSION is upgradable to v$BIOS_VERSION_LATEST ($BIOS_VERSION_LATEST_RELEASED_DATE)" | ||
notify-send "BIOS v$BIOS_VERSION of product $BIOS_PRODUCT_NAME is upgradable to v$BIOS_VERSION_LATEST ($BIOS_VERSION_LATEST_RELEASED_DATE)" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
notify-send "BIOS v$BIOS_VERSION ($BIOS_VERSION_LATEST_RELEASED_DATE) is up-to-date" | ||
notify-send "BIOS v$BIOS_VERSION ($BIOS_VERSION_LATEST_RELEASED_DATE) of product $BIOS_PRODUCT_NAME is up-to-date" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"RT-AX53U"="3.0.0.4.386_69086" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"RT-AX53U"="3.0.0.4.386_69086" |
This file contains 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
This file contains 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,56 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [ -z "$BIOS" ]; then | ||
BIOS=$(cat /sys/class/dmi/id/bios_version) | ||
fi | ||
|
||
echo | ||
|
||
# last cut command for the situation when the command above returns: UN5401QAB_UN5401QA.308 | ||
BIOS_PRODUCT_NAME=$(echo $BIOS | cut -d '.' -f 1 | cut -d '_' -f 1) | ||
BIOS_VERSION=$(echo $BIOS | cut -d '.' -f 2) | ||
|
||
echo "Detected laptop: $BIOS_PRODUCT_NAME" | ||
echo "Detected BIOS version: $BIOS_VERSION" | ||
function check_bios_update() { | ||
local BIOS_PRODUCT_NAME="$1" | ||
local BIOS_VERSION="$2" | ||
|
||
echo | ||
echo "Product: $BIOS_PRODUCT_NAME" | ||
echo "BIOS version: $BIOS_VERSION" | ||
|
||
USER_AGENT="user-agent-name-here" | ||
BIOS_PRODUCT_NAME_LOWER=$(echo "$BIOS_PRODUCT_NAME" | tr '[:upper:]' '[:lower:]') | ||
CURL_LAPTOP_SUPPORT_PAGE_URL="https://www.asus.com/us/supportonly/$BIOS_PRODUCT_NAME_LOWER/helpdesk_bios/" | ||
LAPTOP_SUPPORT_PAGE_CURL=$(curl -s --user-agent "$USER_AGENT" "$CURL_LAPTOP_SUPPORT_PAGE_URL") | ||
|
||
BIOS_VERSION_LATEST=$(echo "$LAPTOP_SUPPORT_PAGE_CURL" | xmllint --html --xpath "(//div[contains(@class, 'ProductSupportDriverBIOS__fileInfo')])[1]/div[1]/text()" - 2>/dev/null | cut -d ' ' -f 2) | ||
BIOS_VERSION_LATEST_RELEASED_DATE=$(echo "$LAPTOP_SUPPORT_PAGE_CURL" | xmllint --html --xpath "(//div[contains(@class, 'ProductSupportDriverBIOS__fileInfo')])[1]/div[3]/text()" - 2>/dev/null) | ||
BIOS_VERSION_LATEST_RELEASED_DATE=$(echo "$BIOS_VERSION_LATEST_RELEASED_DATE" | xargs) | ||
|
||
if [[ "$BIOS_VERSION_LATEST" == "$BIOS_VERSION" ]]; then | ||
echo "BIOS $BIOS_VERSION is up-to-date" | ||
|
||
if [ "$BIOS_IS_UPTODATE_SCRIPT_FILE_PATH" ]; then | ||
source "$BIOS_IS_UPTODATE_SCRIPT_FILE_PATH" | ||
fi | ||
else | ||
echo "BIOS is upgradable to: $BIOS_VERSION_LATEST" | ||
echo "Download link: $CURL_LAPTOP_SUPPORT_PAGE_URL" | ||
|
||
if [ "$BIOS_IS_UPGRADABLE_SCRIPT_FILE_PATH" ]; then | ||
source "$BIOS_IS_UPGRADABLE_SCRIPT_FILE_PATH" | ||
fi | ||
fi | ||
} | ||
|
||
USER_AGENT="user-agent-name-here" | ||
BIOS_PRODUCT_NAME_LOWER=$(echo $BIOS_PRODUCT_NAME | tr '[:upper:]' '[:lower:]') | ||
CURL_LAPTOP_SUPPORT_PAGE_URL="https://www.asus.com/supportonly/$BIOS_PRODUCT_NAME_LOWER/helpdesk_bios/" | ||
# check current laptop bios | ||
CURRENT_LAPTOP_BIOS=$(cat /sys/class/dmi/id/bios_version) | ||
CURRENT_LAPTOP_BIOS_PRODUCT_NAME=$(echo "$CURRENT_LAPTOP_BIOS" | cut -d '.' -f 1 | cut -d '_' -f 1) | ||
CURRENT_LAPTOP_BIOS_VERSION=$(echo "$CURRENT_LAPTOP_BIOS" | cut -d '.' -f 2) | ||
|
||
LAPTOP_SUPPORT_PAGE_CURL=$(curl -s --user-agent "$USER_AGENT" "$CURL_LAPTOP_SUPPORT_PAGE_URL" ) | ||
check_bios_update "$CURRENT_LAPTOP_BIOS_PRODUCT_NAME" "$CURRENT_LAPTOP_BIOS_VERSION" | ||
|
||
BIOS_VERSION_LATEST=$(echo $LAPTOP_SUPPORT_PAGE_CURL | xmllint --html --xpath "(//div[contains(@class, 'ProductSupportDriverBIOS__fileInfo')])[1]/div[1]/text()" - 2>/dev/null | cut -d ' ' -f 2) | ||
BIOS_VERSION_LATEST_RELEASED_DATE=$(echo $LAPTOP_SUPPORT_PAGE_CURL | xmllint --html --xpath "(//div[contains(@class, 'ProductSupportDriverBIOS__fileInfo')])[1]/div[3]/text()" - 2>/dev/null) | ||
# check bios for each product in the config | ||
if [ -f "$CONFIG_DIR_PATH/config.ini" ]; then | ||
|
||
echo | ||
# Loop through each line in the config file | ||
while IFS='=' read -r BIOS_PRODUCT_NAME BIOS_VERSION; do | ||
|
||
if [[ "$BIOS_VERSION_LATEST" != "$BIOS_VERSION" ]]; then | ||
echo "BIOS is upgradable to $BIOS_VERSION_LATEST" | ||
echo "Download link: $CURL_LAPTOP_SUPPORT_PAGE_URL" | ||
BIOS_PRODUCT_NAME=$(echo "$BIOS_PRODUCT_NAME" | xargs | tr -d '"' | tr -d '\r') | ||
BIOS_VERSION=$(echo "$BIOS_VERSION" | xargs | tr -d '"' | tr -d '\r') | ||
|
||
if [ "$BIOS_IS_UPGRADABLE_SCRIPT_FILE_PATH" ]; then | ||
source $BIOS_IS_UPGRADABLE_SCRIPT_FILE_PATH | ||
fi | ||
check_bios_update "$BIOS_PRODUCT_NAME" "$BIOS_VERSION" | ||
done < "$CONFIG_DIR_PATH/config.ini" | ||
else | ||
echo "BIOS $BIOS_VERSION is up-to-date" | ||
|
||
if [ "$BIOS_IS_UPTODATE_SCRIPT_FILE_PATH" ]; then | ||
source $BIOS_IS_UPTODATE_SCRIPT_FILE_PATH | ||
fi | ||
echo "not found $CONFIG_DIR_PATH/config.ini" | ||
fi |
This file contains 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