Skip to content

Commit

Permalink
fix: fix error in udev-fix.sh (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
KwadFan authored May 26, 2023
1 parent 267db84 commit 332109a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions patches/udev-fix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ set -eo pipefail
### Variables
DEBIAN_FRONTEND="noninteractive"
TITLE="\e[31mMainsailOS Patcher\e[0m - udev rule fix"
UDEV_PKG_VERSION="$(dpkg-query -s udev | grep "Version" | sed 's/Version\: //')"
UDEV_FIX_RAW_RULE_FILE="https://raw.githubusercontent.com/systemd/systemd/main/rules.d/60-serial.rules"
UDEV_FIX_TMP_FILE="/tmp/60-serial.rules"
UDEV_FIX_OUTPUT_FILE="/etc/udev/rules.d/60-serial.rules"
Expand Down Expand Up @@ -74,14 +73,17 @@ print_footer(){
# Patch Funcs

patch_udev(){
if [[ -n "${UDEV_PKG_VERSION}" ]] && [[ "${UDEV_PKG_VERSION}" =~ "deb11u2" ]]; then
echo_red "'udev' version: ${UDEV_PKG_VERSION}, is affected by bug ..."
local udev_pkg_version
udev_pkg_version="$(dpkg-query -s udev | grep "Version" | sed 's/Version\: //')"

if [[ -n "${udev_pkg_version}" ]] && [[ "${udev_pkg_version}" =~ "deb11u2" ]]; then
echo_red "'udev' version: ${udev_pkg_version}, is affected by bug ..."
echo_green "Install patched udev rule from systemd git repository ..."
curl -sSL "${UDEV_FIX_RAW_RULE_FILE}" > "${UDEV_FIX_TMP_FILE}"
sudo cp "${UDEV_FIX_TMP_FILE}" "${UDEV_FIX_OUTPUT_FILE}"
rm -f "${UDEV_FIX_TMP_FILE}"
else
echo_green "'udev' version: ${UDEV_PKG_VERSION}, is NOT affected by bug ... [SKIPPED]"
echo_green "'udev' version: ${udev_pkg_version}, is NOT affected by bug ... [SKIPPED]"
fi
}

Expand Down

0 comments on commit 332109a

Please sign in to comment.