summaryrefslogtreecommitdiff
path: root/files
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2020-11-24 13:25:25 +0100
committerKarel Kočí <cynerd@email.cz>2020-11-24 13:27:04 +0100
commit449b271d9e8365fb53101c346cdd3e825cfaaec5 (patch)
treee14181180264ac2f8e64df544e147b7f6860b45d /files
parent6185cbd7e5ccd7fa77516d3383932b423670640a (diff)
downloadlaminar-cnf-449b271d9e8365fb53101c346cdd3e825cfaaec5.tar.gz
laminar-cnf-449b271d9e8365fb53101c346cdd3e825cfaaec5.tar.bz2
laminar-cnf-449b271d9e8365fb53101c346cdd3e825cfaaec5.zip
turris: fix how we checkout repository
We can checkout HEAD and just use checkout_repo_branch.sh.
Diffstat (limited to 'files')
-rwxr-xr-xfiles/turris_checkout_repo_branch.sh102
1 files changed, 0 insertions, 102 deletions
diff --git a/files/turris_checkout_repo_branch.sh b/files/turris_checkout_repo_branch.sh
deleted file mode 100755
index ae88656..0000000
--- a/files/turris_checkout_repo_branch.sh
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/bin/bash
-set -o errexit -o nounset
-
-print_usage() {
- cat >&2 <<-EOF
- Usage: ${0##*/} [-h] BRANCH [BOARD]
- EOF
-}
-
-print_help() {
- print_usage
- cat >&2 <<-EOF
- Use this script to checkout turris-build repository relative to branch on
- repo.turris.cz. It not only checkouts exact commit in turris-build
- repository, but it also modifies feeds.conf file so exactly same feeds are
- used as they were used to build files on server.
-
- BRANCH argument is required and is target publish branch (Do not mix this
- with git branch of same name).
- BOARD is optional argument used to specify different board. In default
- 'omnia' is used. This is available because sometimes versions for boards
- are not in sync and can differ. It should be in most cases safe to use
- default but if you encounter problems you can try setting appropriate
- board.
-
- Options:
- -h, --help Print this help text
- EOF
-}
-
-target=""
-board=""
-
-declare -A long2short=( ["help"]="h" )
-dashdash="n"
-while [ "$OPTIND" -le "$#" ]; do
- argument="${!OPTIND}"
- if [ "$dashdash" = "n" ] && getopts ":h" opt; then
- if [ "${argument:0:2}" = "--" ]; then
- longopt="${argument:2}"
- if [ -v long2short["$longopt"] ]; then
- opt="${long2short[$longopt]}"
- else
- OPTARG="$argument"
- fi
- fi
- case "$opt" in
- h)
- print_help
- exit 0
- ;;
- \?)
- echo "Illegal option: $OPTARG"
- exit 1
- ;;
- esac
- continue
- elif [ "$argument" == "--" -a "$dashdash" = "n" ]; then
- dashdash="y"
- continue
- elif [ -z "$target" ]; then
- target="$argument"
- elif [ -z "$board" ]; then
- board="$argument"
- else
- echo "Unexpected argument: $argument"
- exit 1
- fi
- ((OPTIND = OPTIND + 1))
-done
-
-[ -z "$target" ] && {
- print_usage
- exit 1
-}
-[ -z "$board" ] && board="omnia"
-
-[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" != "true" ] && {
- echo "Current working directory is not in git repository"
- exit 1
-}
-
-toplevel="$(git rev-parse --show-toplevel)"
-
-hashes="$(curl "https://repo.turris.cz/$target/$board/packages/git-hash" | \
- tail -n +2 | grep -v '^$' | sed 's/^ \* //;s/: /:/')"
-
-get_hash() {
- awk -F: -vname="$1" '$1 == name { print $2 }' <<<"$hashes"
-}
-
-# Initaly checkout turris-build
-git checkout "$(get_hash turris-build)"
-
-# And secondly modify feeds so we are modifying appropriate version
-while read -r tp name url vars; do
- [ "$tp" = "#" ] && fullname="$name" || fullname="feeds/$name"
- githash="$(get_hash "$fullname")"
- [ -n "$githash" ] && url="$(sed "s/[;^].*$//;s/$/\^$githash/" <<<"$url")"
- echo "$tp" "$name" "$url" "$vars"
-done < "$toplevel/feeds.conf" >feeds.conf.new
-mv feeds.conf.new feeds.conf