This repository has been archived by the owner on Sep 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
/
setup.sh
90 lines (75 loc) · 2.8 KB
/
setup.sh
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#! /bin/bash
# winpty base URL
babun_docker_winpty_base_url="https://github.com/rprichard/winpty/releases/download/0.4.3/"
# Specific file name, separated to allow unzipping it later
babun_docker_winpty_only_name="winpty-0.4.3-cygwin-2.8.0-ia32"
# Specific file extension
babun_docker_winpty_ext=".tar.gz"
# Complete filename
babun_docker_winpty_filename="$babun_docker_winpty_only_name$babun_docker_winpty_ext"
# babun-docker repo
babun_docker_repo='https://github.com/tiangolo/babun-docker.git'
# feedback format string
babun_docker_feedback='-- babun-docker:'
babun_docker_OLD_PWD=$(pwd)
# Set up winpty
# Where to download winpty from
babun_docker_winpty_url="$babun_docker_winpty_base_url$babun_docker_winpty_filename"
# Directory in where to put Winpty
babun_docker_winpty_dir="$HOME/.winpty"
# Create a local .winpty directory under your home
if [[ ! -d $babun_docker_winpty_dir ]] ; then
mkdir -p $babun_docker_winpty_dir ;
fi
# Enter the .winpty directory to download winpty
cd $babun_docker_winpty_dir
if [[ ! -f $babun_docker_winpty_filename ]] ; then
# Remove old files
cd ..
rm -rf $babun_docker_winpty_dir
mkdir -p $babun_docker_winpty_dir
cd $babun_docker_winpty_dir
# Download winpty
wget -q --no-check-certificate $babun_docker_winpty_url -O $babun_docker_winpty_filename
# Untar the downloaded file
tar xf $babun_docker_winpty_filename
# Move the tar contents to the current directory
mv $babun_docker_winpty_only_name/bin/* ./
# Remove untar-ed directory
rm -rf $babun_docker_winpty_only_name
# Make winpty executable
chmod 777 $babun_docker_winpty_dir/*
# Ask for update
echo "$babun_docker_feedback to finish the installation please run: babun-docker-update"
fi
export PATH="$babun_docker_winpty_dir:$PATH"
# Set up babun-docker
# Directory in where to put babun-docker
babun_docker_repo_dir="$HOME/.babun-docker"
if [[ ! -d $babun_docker_repo_dir ]] ; then
git clone $babun_docker_repo $babun_docker_repo_dir
echo "$babun_docker_feedback to finish the installation please run: babun-docker-update"
fi
cd $babun_docker_repo_dir
source ./*config.sh
source 'bin/babun-docker.sh'
# Set up setup on start for Bash
babun_docker_setup_str="source '$babun_docker_repo_dir/setup.sh'"
if [[ -z $(grep "$babun_docker_setup_str" $HOME/.bashrc) ]] ; then
echo $babun_docker_setup_str >> $HOME/.bashrc ;
fi
# Set up setup on start for Zsh
babun_docker_setup_str="source '$babun_docker_repo_dir/setup.sh'"
if [[ -z $(grep "$babun_docker_setup_str" $HOME/.zshrc) ]] ; then
echo $babun_docker_setup_str >> $HOME/.zshrc ;
fi
# Setup update
function babun-docker-update {
babun_docker_update_old_pwd=$(pwd)
echo "$babun_docker_feedback Updating babun-docker"
cd $babun_docker_repo_dir
git pull
source ./setup.sh
cd $babun_docker_update_old_pwd
}
cd $babun_docker_OLD_PWD