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}'` |
developer | f0dc8bc | 2022-08-29 17:24:20 +0800 | [diff] [blame] | 7 | |
| 8 | if [ -z ${OPENWRT_VER} ]; then |
| 9 | OPENWRT_VER=`cat ./feeds.conf.default_ori | grep "src-git-full packages" | awk -F ";openwrt" '{print $2}'` |
| 10 | fi |
developer | 21871ba | 2021-11-05 17:00:05 +0800 | [diff] [blame] | 11 | else |
| 12 | OPENWRT_VER=`cat ./feeds.conf.default | grep "src-git packages" | awk -F ";openwrt" '{print $2}'` |
developer | f0dc8bc | 2022-08-29 17:24:20 +0800 | [diff] [blame] | 13 | |
| 14 | if [ -z ${OPENWRT_VER} ]; then |
| 15 | OPENWRT_VER=`cat ./feeds.conf.default | grep "src-git-full packages" | awk -F ";openwrt" '{print $2}'` |
| 16 | fi |
developer | 21871ba | 2021-11-05 17:00:05 +0800 | [diff] [blame] | 17 | fi |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 18 | |
| 19 | if [ -z ${1} ]; then |
| 20 | MTK_FEEDS_DIR=feeds/mtk_openwrt_feed |
| 21 | fi |
| 22 | |
| 23 | remove_patches(){ |
| 24 | echo "remove conflict patches" |
| 25 | for aa in `cat ${MTK_FEEDS_DIR}/remove.patch.list` |
| 26 | do |
| 27 | echo "rm $aa" |
| 28 | rm -rf ./$aa |
| 29 | done |
| 30 | } |
| 31 | |
| 32 | sdk_patch(){ |
| 33 | files=`find ${MTK_FEEDS_DIR}/openwrt_patches${OPENWRT_VER} -name "*.patch" | sort` |
| 34 | for file in $files |
| 35 | do |
| 36 | patch -f -p1 -i ${file} || exit 1 |
| 37 | done |
| 38 | } |
| 39 | |
| 40 | sdk_patch |
| 41 | #cp mtk target to OpenWRT |
| 42 | cp -fpR ${MTK_FEEDS_DIR}/target ./ |
developer | f076904 | 2022-04-27 09:16:54 +0800 | [diff] [blame] | 43 | cp -fpR ${MTK_FEEDS_DIR}/package${OPENWRT_VER}/* ./package |
developer | 78a2901 | 2022-02-10 17:24:44 +0800 | [diff] [blame] | 44 | cp -fpR ${MTK_FEEDS_DIR}/tools ./ |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 45 | #remove patch if choose to not "keep" patch |
| 46 | if [ -z ${2} ]; then |
| 47 | remove_patches |
| 48 | fi |
| 49 | |