forked from Kwan-young-hoo/ToPC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·36 lines (29 loc) · 890 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#! /bin/sh
MTK_IMAGE_NAME=mtk-openwrt-4.0.1.0/bin/targets/mediatek/mt7622-glibc/lede-mediatek-mt7622-MTK-AC2600-RFB1-squashfs-sysupgrade.bin
VERSION_FILE=mtk-openwrt-4.0.1.0/files/etc/openwrt_release
#Change /tmp directory owner during openwrt compile.
#'root' user cannot build openwrt, but some packages have to make a directory in /tmp.
change_tmp_owner()
{
# echo $1
sudo chown $1:$1 /tmp
}
case $1 in
openwrt)
echo "Compile openwrt"
change_tmp_owner $(whoami)
cd mtk-openwrt-4.0.1.0
make V=s -j 12
change_tmp_owner root
;;
bootloader)
echo "Compile bootloader"
;;
openwrt-release)
grep DISTRIB_RELEASE ${VERSION_FILE} | awk -F"'" '{print $2}' > .mtk_version
#suffix='_$(date +%m%d)'
suffix=''
version=$(cat .mtk_version)
sudo cp ${MTK_IMAGE_NAME} /tftpboot/mtk4010_mt7622_AC2600_${version}${suffix}.bin
;;
esac