5
5
umask 0022
6
6
unset GREP_OPTIONS SED
7
7
8
- _get_repo () (
9
- mkdir -p " $1 "
10
- cd " $1 "
11
- [ -d .git ] || git init
12
- if git remote get-url origin > /dev/null 2> /dev/null; then
13
- git remote set-url origin " $2 "
14
- else
15
- git remote add origin " $2 "
16
- fi
17
- git fetch origin
18
- git fetch origin --tags
19
- git checkout " origin/$3 " -B " build" 2> /dev/null || git checkout " $3 " -B " build"
20
- )
21
-
22
- OTB_HOST=${OTB_HOST:- $(curl -sS ipaddr.ovh)}
23
- OTB_PORT=${OTB_PORT:- 8000}
24
- OTB_REPO=${OTB_REPO:- http:// $OTB_HOST : $OTB_PORT / $OTB_PATH }
25
-
26
- OTB_TARGET=${OTB_TARGET:- x86_64}
8
+ OTB_REPO=${OTB_REPO:- LOCAL}
9
+ OTB_ARCH=${OTB_ARCH:- x86_64}
27
10
OTB_CONFIG=${OTB_CONFIG:- net-full nice-bb usb-full legacy}
28
11
OTB_PKGS=${OTB_PKGS:- vim-full netcat htop iputils-ping bmon bwm-ng screen mtr ss strace tcpdump-mini ethtool sysstat pciutils mini_snmpd dmesg}
29
12
30
- OTB_FEED_URL=" ${OTB_FEED_URL:- https:// github.com/ ovh/ overthebox-feeds} "
31
- OTB_FEED_SRC=" ${OTB_FEED_SRC:- v0.6} "
32
-
33
- for i in $OTB_TARGET $OTB_CONFIG ; do
13
+ for i in $OTB_ARCH $OTB_CONFIG ; do
34
14
if [ ! -f " config/$i " ]; then
35
15
echo " Config $i not found !"
36
16
exit 1
37
17
fi
38
18
done
39
19
40
- OTB_FEED_BRANCH=" openwrt-18.06@{2018-10-05 00:00:00}"
20
+ # Fetch submodule
21
+ git submodule update --init --recursive
41
22
42
- _get_repo source https://github.com/ovh/overthebox-lede " otb-mptcp-18.10.05"
43
- _get_repo feeds/packages https://github.com/openwrt/packages " $OTB_FEED_BRANCH "
44
- _get_repo feeds/luci https://github.com/openwrt/luci " for-15.05"
45
- _get_repo feeds/routing https://github.com/openwrt-routing/packages " $OTB_FEED_BRANCH "
23
+ # Get Version
24
+ OTB_VERSION=${OTB_VERSION:= $(git describe --tag --always)}
25
+ OTB_FEEDS_VERSION=${OTB_FEEDS_VERSION:= $(git -C feeds/ overthebox describe --tag --always)}
46
26
47
- if [ -z " $OTB_FEED " ]; then
48
- OTB_FEED=feeds/overthebox
49
- _get_repo " $OTB_FEED " " $OTB_FEED_URL " " $OTB_FEED_SRC "
50
- fi
51
-
52
- rm -rf source/bin source/files source/tmp
53
- cp -rf root source/files
27
+ rm -rf openwrt/bin openwrt/files openwrt/tmp
28
+ cp -rf root openwrt/files
54
29
55
- cat >> source /files/etc/banner << EOF
30
+ cat >> openwrt /files/etc/banner << EOF
56
31
-----------------------------------------------------
57
- VERSION: $( git describe --tag --always )
32
+ VERSION: $OTB_VERSION - $OTB_FEEDS_VERSION
58
33
59
34
BUILD REPO: $( git config --get remote.origin.url)
60
35
BUILD DATE: $( date -u)
61
36
-----------------------------------------------------
62
37
EOF
63
38
64
- cat > source /feeds.conf << EOF
39
+ cat > openwrt /feeds.conf << EOF
65
40
src-link packages $( readlink -f feeds/packages)
66
41
src-link luci $( readlink -f feeds/luci)
67
42
src-link routing $( readlink -f feeds/routing)
68
- src-link overthebox $( readlink -f " $OTB_FEED " )
43
+ src-link overthebox $( readlink -f feeds/overthebox )
69
44
EOF
70
45
71
- cat > source /.config << EOF
72
- $( for i in $OTB_TARGET $OTB_CONFIG ; do cat " config/$i " ; done)
46
+ cat > openwrt /.config << EOF
47
+ $( for i in $OTB_ARCH $OTB_CONFIG ; do cat " config/$i " ; done)
73
48
CONFIG_IMAGEOPT=y
74
49
CONFIG_VERSIONOPT=y
75
50
CONFIG_VERSION_DIST="OverTheBox"
76
51
CONFIG_VERSION_REPO="$OTB_REPO "
77
- CONFIG_VERSION_NUMBER="$( git describe --tag --always) "
78
- CONFIG_VERSION_CODE="$( git -C " $OTB_FEED " describe --tag --always) "
52
+ CONFIG_VERSION_NUMBER="$OTB_VERSION "
53
+ CONFIG_VERSION_CODE="$OTB_FEEDS_VERSION "
54
+ CONFIG_VERSION_HOME_URL="https://github.com/ovh/overthebox"
55
+ CONFIG_VERSION_BUG_URL="https://github.com/ovh/overthebox/issues"
56
+ CONFIG_VERSION_SUPPORT_URL="https://community.ovh.com/c/telecom/overthebox"
79
57
$( for i in otb $OTB_PKGS ; do echo " CONFIG_PACKAGE_$i =y" ; done)
80
58
EOF
81
59
82
- echo " Building for the target $OTB_TARGET "
60
+ echo " Building for arch $OTB_ARCH "
83
61
84
- cd source
62
+ cd openwrt
85
63
86
64
cp .config .config.keep
87
65
scripts/feeds clean
@@ -92,4 +70,7 @@ scripts/feeds install -d y $OTB_PKGS
92
70
cp .config.keep .config
93
71
94
72
make defconfig
95
- make " $@ "
73
+ if ! make " $@ " ; then
74
+ make " $@ " -j1 V=s 2>&1 | tee error.log
75
+ exit 1
76
+ fi
0 commit comments