3 git_author
="Release Management"
4 git_email
="lede-dev@lists.infradead.org"
6 base_url
="http://downloads.lede-project.org/releases"
8 [ -f "./feeds.conf.default" ] ||
{
9 echo "Please execute as ./${0##*/}" >&2
16 echo "Usage: $0 [-i] [-a <Git author>] [-e <Git email>] \\"
17 echo " [-u <Download base url>] -n <codename> -v <version>"
20 echo "Exit successfully if branch already exists"
22 echo "-a Git author [$git_author]"
23 echo "Override the author name used for automated Git commits"
25 echo "-e Git email [$git_email]"
26 echo "Override the email used for automated Git commits"
28 echo "-u Download base url [$base_url]"
29 echo "Use the given URL as base for download repositories"
35 while getopts "a:e:iu:n:v:" opt
; do
37 a
) git_author
="$OPTARG" ;;
38 e
) git_email
="$OPTARG" ;;
39 i
) ignore_existing
=1 ;;
40 u
) base_url
="${OPTARG%/}" ;;
41 n
) codename
="$OPTARG" ;;
45 version
="$(echo "$OPTARG" | cut -d. -f1-2)"
48 echo "Unexpected version format: $OPTARG" >&2
54 echo "Unexpected option: -$OPTARG" >&2
58 echo "Missing argument for option: -$OPTARG" >&2
64 [ -n "$codename" -a -n "$version" ] || usage
66 if git rev-parse
"lede-${version}^{tree}" >/dev
/null
2>/dev
/null
; then
67 if [ -z "$ignore_existing" ]; then
68 echo "Branch lede-${version} already exists!" >&2
75 revnum
="$(./scripts/getver.sh)"
76 githash
="$(git log --format=%h -1)"
78 prev_branch
="$(git symbolic-ref -q HEAD)"
80 if [ "$prev_branch" != "refs/heads/master" ]; then
81 echo "Expecting current branch name to be \"master\"," \
82 "but it is \"${prev_branch#refs/heads/}\" - aborting."
87 export GIT_AUTHOR_NAME
="$git_author"
88 export GIT_AUTHOR_EMAIL
="$git_email"
89 export GIT_COMMITTER_NAME
="$git_author"
90 export GIT_COMMITTER_EMAIL
="$git_email"
92 git checkout
-b "lede-$version"
94 while read type name url
; do
100 ref
="$(git ls-remote "$url" "lede-
$version")"
102 if [ -z "$ref" ]; then
103 echo "WARNING: Feed \"$name\" provides no" \
104 "\"lede-$version\" branch - using master!" >&2
106 url
="$url;lede-$version"
110 echo "$type $name $url"
113 echo "$type $name $url"
116 done < feeds.conf.default
> feeds.conf.branch
&& \
117 mv feeds.conf.branch feeds.conf.default
119 sed -e 's!^RELEASE:=.*!RELEASE:='"$codename"'!g' \
120 -e 's!\(VERSION_NUMBER:=\$(if .*\),[^,]*)!\1,'"$version-SNAPSHOT"')!g' \
121 -e 's!\(VERSION_REPO:=\$(if .*\),[^,]*)!\1,'"$base_url/$version-SNAPSHOT"')!g' \
122 include
/version.mk
> include
/version.branch
&& \
123 mv include
/version.branch include
/version.mk
125 sed -e 's!http://downloads.lede-project.org/[^"]*!'"$base_url/$version-SNAPSHOT"'!g' \
126 package
/base-files
/image-config.
in > package
/base-files
/image-config.branch
&& \
127 mv package
/base-files
/image-config.branch package
/base-files
/image-config.
in
129 git commit
-sm "LEDE v$version: set branch defaults" \
132 package
/base-files
/image-config.
in
134 git
--no-pager log
-p -1
135 git push origin
"refs/heads/lede-$version:refs/heads/lede-$version"
136 git checkout
"${prev_branch#refs/heads/}"