forked from inpyjama/c-ninja-listings
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·32 lines (21 loc) · 1017 Bytes
/
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
#
# Copyright © 2023 inpyjama.com. All Rights Reserved.
# Author: Piyush Itankar <[email protected]>
#
set -e
echo "#1: Flushing docker cache"
docker builder prune
echo "#2: Build a linux base image"
docker build -t c-ninja-linux_base .
echo "#3: Mapping current host directory to guest's ~/Documents/ directory"
docker run -h "c-ninja-linux" -t -d -P -v `realpath .`:/home/c-ninja/Documents/ --name c-ninja-linux c-ninja-linux_base
echo "#4: Setting zsh as the default terminal on guest"
docker exec -it c-ninja-linux /bin/bash -c 'echo "c" | sudo -S usermod -s /usr/bin/zsh c-ninja'
USER_SHELL=bash
echo "#5: Populating the .bashrc file of the host with c-ninja alias"
echo "alias c-ninja=\"docker start c-ninja-linux; docker exec -it c-ninja-linux /bin/zsh -c 'cd /home/c-ninja/Documents/; zsh -i'\"" >> ~/.${USER_SHELL}rc
echo "#6: Sourcing local .bashrc file"
source ~/.${USER_SHELL}rc
echo "Setup Complete! Use the following two commands to login to the guest machine!"
echo "bash"
echo "c-ninja"