-
Notifications
You must be signed in to change notification settings - Fork 2
/
make.sh
executable file
·50 lines (36 loc) · 1.5 KB
/
make.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
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh
#default config
BOARD=CR9531
VERSION_NAME=soft_version
CONFIG_NAME=CR9531.config
CONFIG_PATH="./build_config"
CONFIG_SUFFIX=".config"
if [ ! -z "$1" ];then
BOARD=$1
fi
CONFIG_NAME=${BOARD}${CONFIG_SUFFIX}
if [ ! -e "${CONFIG_PATH}/${CONFIG_NAME}" ];then
echo "Warning:${CONFIG_PATH}/${CONFIG_NAME} isn't exist."
exit
fi
echo "Info:will build package for $BOARD ..."
cp ${CONFIG_PATH}/${CONFIG_NAME} .config
SOFT_VERSION=`cat ${CONFIG_PATH}/${VERSION_NAME}`
if [ -z ${SOFT_VERSION} ];then
echo "Warning:${CONFIG_PATH}/${VERSION_NAME} isn't exist, using default version 1.0."
SOFT_VERSION="V1.0"
fi
DIST=$BOARD
sed -i "s/option hostname.*$/option hostname $DIST/" ./package/base-files/files/etc/config/system
sed -i "s/CONFIG_VERSION_DIST=\".*\"/CONFIG_VERSION_DIST=\"$DIST\"/" ./.config
sed -i "s/CONFIG_VERSION_NUMBER=\".*\"/CONFIG_VERSION_NUMBER=\"`date +%Y%m%d%H%M`\"/" ./.config
sed -i "s/CONFIG_VERSION_NICK=\".*\"/CONFIG_VERSION_NICK=\"${SOFT_VERSION}\"/" ./.config
touch ./package/base-files/files/etc/openwrt_release
make V=s
test $? -eq 0 || exit 1
DIST=`cat .config | grep CONFIG_VERSION_DIST | awk -F\" '{print $2}'`
BUILD_VERSION=`cat .config | grep CONFIG_VERSION_NUMBER | awk -F\" '{print $2}'`
ls bin/ar71xx/*.bin | grep -v squashfs-sysupgrade | xargs rm >/dev/null 2>&1
mkdir -p bin/ar71xx/pkg
echo mv bin/ar71xx/*squashfs-sysupgrade*bin bin/ar71xx/pkg/${DIST}-${SOFT_VERSION}-${BUILD_VERSION}
mv bin/ar71xx/*squashfs-sysupgrade*bin bin/ar71xx/pkg/${DIST}-${SOFT_VERSION}-${BUILD_VERSION}