developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | MTK_FEEDS_DIR=${1} |
| 4 | |
developer | 21871ba | 2021-11-05 17:00:05 +0800 | [diff] [blame^] | 5 | if [ -f feeds.conf.default_ori ]; then |
| 6 | OPENWRT_VER=`cat ./feeds.conf.default_ori | grep "src-git packages" | awk -F ";openwrt" '{print $2}'` |
| 7 | else |
| 8 | OPENWRT_VER=`cat ./feeds.conf.default | grep "src-git packages" | awk -F ";openwrt" '{print $2}'` |
| 9 | fi |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 10 | |
| 11 | if [ -z ${1} ]; then |
| 12 | MTK_FEEDS_DIR=feeds/mtk_openwrt_feed |
| 13 | fi |
| 14 | |
| 15 | remove_patches(){ |
| 16 | echo "remove conflict patches" |
| 17 | for aa in `cat ${MTK_FEEDS_DIR}/remove.patch.list` |
| 18 | do |
| 19 | echo "rm $aa" |
| 20 | rm -rf ./$aa |
| 21 | done |
| 22 | } |
| 23 | |
| 24 | sdk_patch(){ |
| 25 | files=`find ${MTK_FEEDS_DIR}/openwrt_patches${OPENWRT_VER} -name "*.patch" | sort` |
| 26 | for file in $files |
| 27 | do |
| 28 | patch -f -p1 -i ${file} || exit 1 |
| 29 | done |
| 30 | } |
| 31 | |
| 32 | sdk_patch |
| 33 | #cp mtk target to OpenWRT |
| 34 | cp -fpR ${MTK_FEEDS_DIR}/target ./ |
| 35 | #remove patch if choose to not "keep" patch |
| 36 | if [ -z ${2} ]; then |
| 37 | remove_patches |
| 38 | fi |
| 39 | |