-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·34 lines (30 loc) · 916 Bytes
/
install.sh
File metadata and controls
executable file
·34 lines (30 loc) · 916 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
VERSION=v0.17.0
CUR_VERSION=$(git trunk 2>/dev/null)
DEST=trunk-flow
upgrade() {
DEST=$1
ARCHIVE_BIN_PATH="git-trunk-flow-$(echo ${VERSION} | sed 's/^v//g')/bin/"
curl https://codeload.github.com/Byte-Code/git-trunk-flow/tar.gz/${VERSION} | tar -xvf - -C ./${DEST} --strip-components=2 ${ARCHIVE_BIN_PATH}
}
install() {
DEST=$1
mkdir ${DEST}
upgrade ${DEST}
INCLUDE=$(cat << EOF
[include]
path = "../${DEST}/root"
EOF)
echo "${INCLUDE}" >> .git/config
echo "${DEST}/" >> .git/info/exclude
}
if [ ! ${CUR_VERSION} ] || [ ${CUR_VERSION} != ${VERSION} ]; then
if [ ! ${CUR_VERSION} ] || [ ${CUR_VERSION} == 'v0.0.0' ]; then
echo "git-trunk-flow: installing ${VERSION}"
install ${DEST}
else
echo "git-trunk-flow: upgrading from ${CUR_VERSION} to ${VERSION}"
upgrade ${DEST}
fi
else
echo "git-trunk-flow: Already up to date."
fi