Skip to content

Commit 343e131

Browse files
committed
build: use git module
1 parent 9329e48 commit 343e131

10 files changed

+58
-54
lines changed

.gitignore

-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
sdk
2-
source
3-
feeds

.gitmodules

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[submodule "openwrt"]
2+
path = openwrt
3+
url = https://github.com/ovh/overthebox-lede
4+
branch = otb-mptcp-18.10.05
5+
[submodule "feeds/packages"]
6+
path = feeds/packages
7+
url = https://github.com/openwrt/packages
8+
branch = openwrt-18.06
9+
[submodule "feeds/routing"]
10+
path = feeds/routing
11+
url = https://github.com/openwrt-routing/packages
12+
branch = openwrt-18.06
13+
[submodule "feeds/luci"]
14+
path = feeds/luci
15+
url = https://github.com/openwrt/luci
16+
branch = for-15.05
17+
[submodule "feeds/overthebox"]
18+
path = feeds/overthebox
19+
url = ../overthebox-feeds
20+
branch = .

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,17 @@ cd overthebox
5555
```
5656

5757
The script `build.sh` accepts all `make` arguments (like `-j`).
58-
When finished, files are located in the directory `source/bin`.
58+
When finished, files are located in the directory `openwrt/bin`.
5959

6060
### Custom arch build
6161

6262
By default the build script will create the packages for the `x86_64` architecture.
63-
You can specify a custom build target by adding a `OTB_TARGET` environment variable to the build and the corresponding `config/$OTB_TARGET` file.
63+
You can specify a custom build target by adding a `OTB_ARCH` environment variable to the build and the corresponding `config/$OTB_ARCH` file.
6464

6565
To build the project for the raspberry pi 3:
6666

6767
```sh
68-
OTB_TARGET="rpi3" ./build.sh
68+
OTB_ARCH="rpi3" ./build.sh
6969
```
7070

7171
## Create a recovery key

build.sh

+27-46
Original file line numberDiff line numberDiff line change
@@ -5,83 +5,61 @@ set -e
55
umask 0022
66
unset GREP_OPTIONS SED
77

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}
2710
OTB_CONFIG=${OTB_CONFIG:-net-full nice-bb usb-full legacy}
2811
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}
2912

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
3414
if [ ! -f "config/$i" ]; then
3515
echo "Config $i not found !"
3616
exit 1
3717
fi
3818
done
3919

40-
OTB_FEED_BRANCH="openwrt-18.06@{2018-10-05 00:00:00}"
20+
# Fetch submodule
21+
git submodule update --init --recursive
4122

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)}
4626

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
5429

55-
cat >> source/files/etc/banner <<EOF
30+
cat >> openwrt/files/etc/banner <<EOF
5631
-----------------------------------------------------
57-
VERSION: $(git describe --tag --always)
32+
VERSION: $OTB_VERSION - $OTB_FEEDS_VERSION
5833
5934
BUILD REPO: $(git config --get remote.origin.url)
6035
BUILD DATE: $(date -u)
6136
-----------------------------------------------------
6237
EOF
6338

64-
cat > source/feeds.conf <<EOF
39+
cat > openwrt/feeds.conf <<EOF
6540
src-link packages $(readlink -f feeds/packages)
6641
src-link luci $(readlink -f feeds/luci)
6742
src-link routing $(readlink -f feeds/routing)
68-
src-link overthebox $(readlink -f "$OTB_FEED")
43+
src-link overthebox $(readlink -f feeds/overthebox)
6944
EOF
7045

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)
7348
CONFIG_IMAGEOPT=y
7449
CONFIG_VERSIONOPT=y
7550
CONFIG_VERSION_DIST="OverTheBox"
7651
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"
7957
$(for i in otb $OTB_PKGS; do echo "CONFIG_PACKAGE_$i=y"; done)
8058
EOF
8159

82-
echo "Building for the target $OTB_TARGET"
60+
echo "Building for arch $OTB_ARCH"
8361

84-
cd source
62+
cd openwrt
8563

8664
cp .config .config.keep
8765
scripts/feeds clean
@@ -92,4 +70,7 @@ scripts/feeds install -d y $OTB_PKGS
9270
cp .config.keep .config
9371

9472
make defconfig
95-
make "$@"
73+
if ! make "$@"; then
74+
make "$@" -j1 V=s 2>&1 | tee error.log
75+
exit 1
76+
fi

feeds/luci

Submodule luci added at 5537d68

feeds/overthebox

Submodule overthebox added at 8407fce

feeds/packages

Submodule packages added at 17ab4ed

feeds/routing

Submodule routing added at 83f515d

openwrt

Submodule openwrt added at 23a948e

sign.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
key=${1:-key-build}
44

5-
[ -d source/bin ] && [ -f "$key" ] && \
6-
find source/bin \
5+
[ -d openwrt/bin ] && [ -f "$key" ] && \
6+
find openwrt/bin \
77
\( -name '*.img.gz' -or -name 'Packages' \) \
8-
-exec source/staging_dir/host/bin/usign -S -m {} -s "$key" \;
8+
-exec openwrt/staging_dir/host/bin/usign -S -m {} -s "$key" \;

0 commit comments

Comments
 (0)