-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdateScript.sh
More file actions
executable file
·41 lines (32 loc) · 826 Bytes
/
updateScript.sh
File metadata and controls
executable file
·41 lines (32 loc) · 826 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
35
36
37
38
39
40
41
#!/bin/bash
self_update() {
REPO_URL="https://raw.githubusercontent.com/cstaud/bash_self-update/master"
SELF="$0"
REMOTE_SCRIPT="$REPO_URL/$SELF"
echo "Checking for self-update ..."
diff=$(diff "$SELF" <(curl -s "$REMOTE_SCRIPT"))
if [ -z "$diff" ]
then
echo "Already running on latest version, yeah!"
else
echo "Downloading latest version..."
if ! curl --output "$SELF" "$REMOTE_SCRIPT"; then
echo "Failed: Error while trying to curl new version!"
echo "File requested: REMOTE_SCRIPT"
exit 1
fi
echo "Done. Quitting deprecated version now."
exit 0
fi
}
go_fmt() {
docker run --rm -v "$ROOT_DIR":/app golang:1.14 go fmt
}
main() {
echo "Running v0"
go_fmt
}
ROOT_DIR="$(git rev-parse --show-toplevel)"
[[ -d "${ROOT_DIR}" ]] || exit 1
self_update
main