Directly call the function "get_linux_version()" to get the integer kernel version number. Signed-off-by: Shiji Yang <yangshiji66@outlook.com> Link: https://github.com/openwrt/openwrt/pull/19172 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
37 lines
No EOL
858 B
Bash
37 lines
No EOL
858 B
Bash
#!/bin/sh
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
# This script migrates GPIO switch pin numbers
|
|
# from kernel versions prior to 6.6
|
|
# See https://lists.openwrt.org/pipermail/openwrt-devel/2024-March/042448.html
|
|
|
|
. /lib/functions.sh
|
|
. /lib/functions/system.sh
|
|
|
|
ten64_update_gpioswitch_num() {
|
|
local section="$1"
|
|
config_get gpio_pin "${section}" gpio_pin
|
|
config_get gpio_name "${section}" name
|
|
if [ -z "${gpio_pin}" ]; then
|
|
return
|
|
fi
|
|
local this_pin_name=$(uci get "system.${section}.name")
|
|
if [ "${gpio_pin}" -lt 640 ]; then
|
|
new_pin_value=$(( $gpio_pin + 272 ))
|
|
uci set "system.${section}.gpio_pin=${new_pin_value}"
|
|
fi
|
|
}
|
|
|
|
board=$(board_name)
|
|
if [ "${board}" != "traverse,ten64" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
if [ "$(get_linux_version)" -lt "60600" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
config_load system
|
|
config_foreach ten64_update_gpioswitch_num gpio_switch
|
|
|
|
exit 0 |