summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlliver Schinagl <oliver@schinagl.nl>2024-03-18 13:10:31 +0100
committerRobert Marko <robimarko@gmail.com>2024-04-12 18:20:52 +0200
commit9e6c4392f85f9123fda8ef8690c2a36599fe334c (patch)
tree0b27724cb2165727102eb7542622b698bde56a80
parent9f0cc3eb11074773f683ccd570991a0c74b17d72 (diff)
downloadopenwrt-9e6c4392f85f9123fda8ef8690c2a36599fe334c.tar.gz
openwrt-9e6c4392f85f9123fda8ef8690c2a36599fe334c.tar.bz2
openwrt-9e6c4392f85f9123fda8ef8690c2a36599fe334c.zip
scripts/kernel_bump: Allow for migrating only configuration files
In some cases, we want to only migrate configuration files, e.g. if the kernel was bumped already. Lets add a flag for this case to offer flexibility. By default we will migrate configuration flags as before. Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
-rwxr-xr-xscripts/kernel_bump.sh40
1 files changed, 23 insertions, 17 deletions
diff --git a/scripts/kernel_bump.sh b/scripts/kernel_bump.sh
index 69045946e9..069f53bb77 100755
--- a/scripts/kernel_bump.sh
+++ b/scripts/kernel_bump.sh
@@ -54,6 +54,7 @@ usage()
{
echo "Usage: ${0}"
echo 'Helper script to bump the target kernel version, whilst keeping history.'
+ echo ' -c Migrate config files (e.g. subtargets) only.'
echo " -p Optional Platform name (e.g. 'ath79' [PLATFORM_NAME]"
echo " -s Source version of kernel (e.g. 'v6.1' [SOURCE_VERSION])"
echo " -t Target version of kernel (e.g. 'v6.6' [TARGET_VERSION]')"
@@ -113,22 +114,24 @@ bump_kernel()
git switch --force-create '__openwrt_kernel_files_mover'
- for _path in "${_target_dir}/"*; do
- if [ ! -s "${_path}" ] || \
- [ "${_path}" = "${_path%%"-${source_version}"}" ]; then
- continue
- fi
-
- _target_path="${_path%%"-${source_version}"}-${target_version}"
- if [ -s "${_target_path}" ]; then
- e_err "Target '${_target_path}' already exists!"
- exit 1
- fi
-
- git mv \
- "${_path}" \
- "${_target_path}"
- done
+ if [ "${config_only:-false}" != 'true' ]; then
+ for _path in "${_target_dir}/"*; do
+ if [ ! -e "${_path}" ] || \
+ [ "${_path}" = "${_path%%"-${source_version}"}" ]; then
+ continue
+ fi
+
+ _target_path="${_path%%"-${source_version}"}-${target_version}"
+ if [ -e "${_target_path}" ]; then
+ e_err "Target '${_target_path}' already exists!"
+ exit 1
+ fi
+
+ git mv \
+ "${_path}" \
+ "${_target_path}"
+ done
+ fi
find "${_target_dir}" -iname "config-${source_version}" | while read -r _config; do
_path="${_config%%"/config-${source_version}"}"
@@ -182,8 +185,11 @@ check_requirements()
main()
{
- while getopts 'hp:s:t:' _options; do
+ while getopts 'chp:s:t:' _options; do
case "${_options}" in
+ 'c')
+ config_only='true'
+ ;;
'h')
usage
exit 0