alpha
Login
or
Join now
j3s.sh
/
dotfiles
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
my dotz
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
Auto push remotes & symlink chtf
author
Jes Olson
date
3 years ago
(Jul 17, 2022, 11:25 AM -0500)
commit
2e30b8cb
2e30b8cbd1ea0e208277ec2068e4087d3ee6dbd9
parent
378854c5
378854c5d26900e5d7154e0c19ed99ced7d4ab9a
+3
-40
2 changed files
Expand all
Collapse all
Unified
Split
.config
git
config
bin
chtf
+2
.config/git/config
Reviewed
···
38
38
email = j3s@c3f.net
39
39
[pull]
40
40
ff = only
41
41
+
[push]
42
42
+
autoSetupRemote = true
41
43
[pager]
42
44
status = true
43
45
[init]
+1
-40
bin/chtf
Reviewed
···
1
1
-
#!/bin/sh
2
2
-
#
3
3
-
# list installed tf versions +
4
4
-
# switch terraform versions +
5
5
-
# + download tf if not found
6
6
-
7
7
-
tf_version="$1"
8
8
-
tf_install_dir="${HOME}/.local/share/chtf"
9
9
-
tf_link_name="${HOME}/bin/terraform"
10
10
-
11
11
-
# make some os assumptions
12
12
-
if [ "$(uname)" = "Linux" ]; then
13
13
-
os="linux"
14
14
-
else
15
15
-
os="darwin"
16
16
-
fi
17
17
-
18
18
-
mkdir -p "$tf_install_dir"
19
19
-
20
20
-
if [ -z "$tf_version" ]; then
21
21
-
# if no arguments, list versions of tf plus list symlink pointer.
22
22
-
printf "available:\n"
23
23
-
ls "$tf_install_dir"
24
24
-
printf "active:\n"
25
25
-
if [ -e "$tf_link_name" ]; then
26
26
-
readlink "$tf_link_name" | xargs basename
27
27
-
fi
28
28
-
else
29
29
-
if [ ! -f "${tf_install_dir}/${tf_version}" ]; then
30
30
-
# download tf version if not found
31
31
-
printf "terraform version not found. downloading...\n"
32
32
-
dl="https://releases.hashicorp.com/terraform/${tf_version}/terraform_${tf_version}_${os}_amd64.zip"
33
33
-
printf "downloading %s\n" "$dl"
34
34
-
curl -L --output /tmp/tf.zip "$dl"
35
35
-
unzip /tmp/tf.zip -d /tmp
36
36
-
mv /tmp/terraform "${tf_install_dir}/${tf_version}"
37
37
-
rm /tmp/tf.zip
38
38
-
fi
39
39
-
ln -sf "${tf_install_dir}/${tf_version}" "$tf_link_name"
40
40
-
fi
1
1
+
/home/j3s/code/chtf/chtf