Skip to content

Commit

Permalink
shell init script 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
inspire12 committed Oct 11, 2023
1 parent 2c0181a commit 8ed1852
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 0 deletions.
99 changes: 99 additions & 0 deletions script/init/init_ubuntu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#!/bin/zsh

help()
{
echo "how to run: zsh init_ubuntu.sh -b 'zsh'"
}

while getopts b:a:f: flag
do
case "${flag}" in
b) b=${OPTARG};;
esac
done

if [ "shell" = "$b" ];
then
shellrc=$HOME/.bashrc
elif [ "zsh" = "$b" ];
then
echo "zsh"
shellrc=$HOME/.zshrc
fi

echo "shell: $b";
echo "shellrc: $shellrc";

source $shellrc


print_env()
{
echo "python version:" | python -V
}


get_resource_info() {
echo "# info"
env | grep SHELL
echo $HOSTNAME
ifconfig |grep inet
apt-get update -y
apt-get upgrade -y
}

# echo "# zsh setting"
set_java() {
echo "# java setting"

}

set_python() {
echo "# python setting"
echo "alias python=python3" | tee -a $shellrc
echo "alias pip=pip3" | tee -a $shellrc
sudo apt-get install python3-pip
sudo apt-get install libffi-dev python-dev python3-dev
python -m pip install --upgrade pip
python -V
}

set_directory() {
echo "# directory setting"
mkdir -p workspace
mkdir -p workspace/privatespace
mkdir -p workspace/publicspace
mkdir -p Tools
}

set_docker() {
echo "# docker setting"
sudo apt-get update -y
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get install docker-ce docker-ce-cli containerd.io -y

sudo usermod -aG docker $USER
newgrp docker
}

set_git() {
echo "# git setting"
}

set_k8s() {
echo "# k8s setting"
echo "alias k="kubectl"" | tee -a ~/.shellrc
}


# get_resource_info
# set_java
# set_python
# set_directory
# set_k8s
print_env

echo "# finish"
4 changes: 4 additions & 0 deletions script/init/init_ubuntu_optional.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
echo '# docker remote setting'
docker login
hello world

0 comments on commit 8ed1852

Please sign in to comment.