-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup-run-crc.sh
executable file
·53 lines (40 loc) · 1.85 KB
/
setup-run-crc.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
#!/bin/bash
CRC_LOG_FILE="~/crc-start.log"
REMOTE_LOG_FILE="~/remote-config.log"
#is crc running? (crc status always returns 0)
if ! ~/bin/crc ip ; then
sudo dnf -y install curl tar xz tmux
#go get crc if it isn't downloaded
echo "downloading crc"
test -f "crc-linux-amd64.tar.xz" || curl -O -sS \
"https://mirror.openshift.com/pub/openshift-v4/clients/crc/latest/crc-linux-amd64.tar.xz"
#extract crc
echo "extracting crc"
tar -xf crc-linux-amd64.tar.xz
#get crc in to a runnable place
echo "setting crc as executable"
mkdir ~/bin || :
ln -sf ~/crc-linux-*-amd64/crc ~/bin/crc
grep 'PATH=$PATH:$HOME/bin' ~/.bashrc || \
echo "export PATH=$PATH:$HOME/bin" >> ~/.bashrc
#run crc setup if it hasn't been done
echo "running crc setup"
~/bin/crc setup
#run crc start directly (which will just say "done already" not error if running)
#crc start -p ~/pull-secret > $CRC_LOG_FILE 2>&1
#run crc start (which will just say "done already" not error if running)
echo "running crc start in the background"
tmux new-session -d -s 'crc-start' \
"~/bin/crc start -p ~/pull-secret > $CRC_LOG_FILE 2>&1"
echo "crc start is running in a tmux session in the Vagrant VM. " \
"You can check its status with 'vagrant ssh -c \"tail -f $CRC_LOG_FILE\"'"
else
echo "crc is already running on this instance."
fi
#start script to setup remote access to crc
echo "Running remote-config setup in background"
tmux new-session -d -s 'config-remote' \
"~/configure-remote.sh > $REMOTE_LOG_FILE 2>&1"
echo "Remote config shell script is running in a tmux session in the Vagrant VM." \
"You can check its status with 'vagrant ssh -c \"tail -f $REMOTE_LOG_FILE\"'"
echo "When everything is complete, please see $REMOTE_LOG_FILE for instructions on configuring your host's DNS"