2021-03-31 08:54:40 +03:00
|
|
|
#!/bin/zsh
|
|
|
|
|
|
|
|
kconf-set() {
|
2024-01-27 00:10:58 +03:00
|
|
|
[ -n "${1:?}" ] || return 1
|
2022-07-19 02:41:45 +03:00
|
|
|
|
2024-01-27 00:10:58 +03:00
|
|
|
local n=$1 v=$2
|
|
|
|
shift 2
|
|
|
|
|
|
|
|
[ $# -gt 0 ] || return 2
|
|
|
|
|
|
|
|
command grep -ElZ "^((CONFIG_)?$n=|# (CONFIG_)?$n is not set)" "$@" \
|
2021-03-31 08:54:40 +03:00
|
|
|
| xargs -0 -r sed -i -E -e "s/^(((CONFIG_)?$n)=.+|# ((CONFIG_)?$n) is not set)\$/\\2\\4=$v/"
|
|
|
|
}
|
|
|
|
|
|
|
|
kconf-unset() {
|
2024-01-27 00:10:58 +03:00
|
|
|
[ -n "${1:?}" ] || return 1
|
|
|
|
|
|
|
|
local n=$1
|
|
|
|
shift
|
|
|
|
|
|
|
|
[ $# -gt 0 ] || return 2
|
2022-07-19 02:41:45 +03:00
|
|
|
|
2024-01-27 00:10:58 +03:00
|
|
|
command grep -ElZ "^(CONFIG_)?$n=" "$@" \
|
2021-03-31 08:54:40 +03:00
|
|
|
| xargs -0 -r sed -i -E -e "s/^((CONFIG_)?$n)=.+\$/# \\1 is not set/"
|
|
|
|
}
|