]> git.sur5r.net Git - kconfig-frontends/blob - ksync.sh
c8a2dc1aac4cb464a2bedb2255a7009415999d20
[kconfig-frontends] / ksync.sh
1 #!/bin/sh
2
3 my_name="${0##*/}"
4
5 # If an argument is given, it's the location
6 # of the Linux kernel source tree
7 k_dir="${1}"
8 if [ -n "${k_dir}" -a -d "${k_dir}/kernel" ]; then
9     # Get the version
10     eval $( head -n 5 "${k_dir}/Makefile"                       \
11             |sed -r -e 's/^/K_/; s/"//g; s/ = ?/="/; s/$/"/;'   \
12           )
13     printf "Found Linux kernel %d.%d.%d%s '%s'\n"           \
14           "${K_VERSION}" "${K_PATCHLEVEL}" "${K_SUBLEVEL}"  \
15           "${K_EXTRAVERSION}" "${K_NAME}"
16 else
17     if [ -n "${k_dir}" ]; then
18         printf "%s: \`%s': not a Linux kernel source tree\n"    \
19                "${my_name}" "${k_dir}"
20     else
21         printf "Usage: %s /path/to/kernel/dir\n" "${my_name}"
22     fi
23     exit 1
24 fi
25
26 exec <misc/kernel2kfrontends.list
27
28 while read k_file trash kf_file; do
29     cp -v "${k_dir}/${k_file}" "${kf_file}"
30     if [ -f "${kf_file}.patch" ]; then
31         patch --no-backup-if-mismatch -g0 -F1 -p1 -f <"${kf_file}.patch"
32     fi
33 done