Root/nanonote-files/data/qi_lb60/scripts/get-feeds-revision.sh

1#!/bin/bash
2
3cd $1
4
5FEEDS_CONF="feeds.conf.default"
6test -f "feeds.conf" && FEEDS_CONF="feeds.conf"
7
8feeds="$(cat "${FEEDS_CONF}" | grep -v -E "^#")"
9
10echo "# base :: openwrt [scm-protocol] [source] [branch] [revision]"
11repo=$(git config -l | grep remote.origin.url | cut -d "=" -f 2)
12rev=$(git log | head -n 1 | cut -b8-)
13branch=$(git branch | grep "*" | cut -b3-)
14echo "openwrt git ${repo} ${branch} ${rev}"
15
16echo "# feeds :: [feedname] [scm-protocol] [revision]"
17IFS=$'\n'
18for feed in $feeds; do
19        IFS=' ' arr=(${feed:4})
20        proto=${arr[0]}
21        dir=${arr[1]}
22
23        if [ "$proto" = "svn" ]; then
24                cd feeds/${dir} && rev=`svn info | grep -E "^Revision" | cut -d " " -f2` && cd ../../
25        fi
26        if [ "$proto" = "git" ]; then
27                cd feeds/${dir} && rev=`git log | head -n 1 | cut -d " " -f2` && cd ../../
28        fi
29        if [ "$proto" = "link" ]; then
30                rev=`date "+%Y-%m-%d"`
31        fi
32
33        echo "${dir} ${proto} ${rev}"
34done

Archive Download this file



interactive