Commit hnyman's changes
[lede.git] / hnscripts / newBuildroot.sh
1 #!/bin/sh
2 #
3 # newBuildroot.sh
4 #
5 # Creates the build environment with the current directory as the root
6 # To avoid problems with long paths, something like /Openwrt is preferable
7 #
8 # Script creates subdir for trunk or the release branch, and dl for downloads
9 # Creates main source repository and luci, packages & routing feeds
10
11 ### Target definitions
12 TARGET=lede1701
13 GITREPO="-b lede-17.01 --single-branch https://git.lede-project.org/source.git"
14
15 ## Current version
16 FILESTAMP=R7800-lede1701-r3389-379155dc0f-20170518-1219
17
18 ### Prerequisites for buildroot
19 sudo apt-get install build-essential subversion libncurses5-dev zlib1g-dev
20 sudo apt-get install gawk gcc-multilib flex git-core gettext libssl-dev
21
22 ### Prerequisites for being able to send patches to openwrt-devel
23 sudo apt-get install git-email
24
25 ### Newly patched Ubuntu may not yet have the correct kernel headers.
26 # sudo apt-get install linux-headers-$(uname -r)
27
28 ### set the preferred umask (LEDE allows 0000-0022)
29 umask 0022
30
31 ### download directory (outside main directory to protect from make distclean)
32 mkdir -p dl
33
34 ### main directory
35 mkdir -p $TARGET
36
37 ### checkout/clone and change to directory
38 git clone $GITREPO $TARGET
39 cd $TARGET
40
41 ### create symlink to dl (after git clone)
42 ln -s ../dl dl
43
44 ### patch main source first to set feeds correctly
45 ### update the feeds, apply patches to feeds
46 ### re-create index to find new packages, finally install
47 patch -p1 -i ../$FILESTAMP-main.patch
48 scripts/feeds update -a
49 (cd feeds/luci;     patch -p1 -i ../../../$FILESTAMP-luci.patch)
50 (cd feeds/packages; patch -p1 -i ../../../$FILESTAMP-packages.patch)
51 (cd feeds/routing;  patch -p1 -i ../../../$FILESTAMP-routing.patch)
52 scripts/feeds update -i
53 scripts/feeds install -a
54
55 ### chmod known script files executable
56 chmod -f 755 files/etc/*.sh
57 chmod -f 755 files/etc/rc.button/*
58
59 ### chmod buildscripts executable
60 chmod -f 755 hnscripts/*.sh
61
62 ### add created/modified files in main repo to version control
63 git add -f files
64 git add -A
65
66 ### add created/modified files in feeds to version control
67 (cd feeds/luci;     git add -A)
68 (cd feeds/packages; git add -A)
69 (cd feeds/routing;  git add -A)
70
71 ### initialise .config
72 cp .config.init .config
73