-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_tools.sh
More file actions
84 lines (67 loc) · 1.57 KB
/
install_tools.sh
File metadata and controls
84 lines (67 loc) · 1.57 KB
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
#!/usr/bin/env bash
# /***************************
# @Author: Xhosa-LEE
# @Contact: lixiaoxmm@163.com
# @Time: 2022/11/20
# @Desc: 用于docker镜像生成
# ***************************/
ORIGIN_DOCKER="lixiaoxmm/ubuntu22.10:original"
IMG="dockerproxy.com/${ORIGIN_DOCKER}"
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd -P )"
function show_usage () {
cat <<EOF
Usage: $(basename $0) [options] ...
DEFAULT OPTIONS:
auto_intall auto install docker
OPTIONS:
install_tools install tools.
EOF
exit 0
}
function hosts()
{
echo '
199.232.28.133 raw.githubusercontent.com
192.30.255.112 www.github.com
192.30.255.112 github.com
' >> /etc/hosts
}
function install_tools()
{
apt-get -y update
apt-get -y upgrade
#install llvm clang
apt-get -y install make vim pip sudo wget curl pkg-config unzip gnutls-bin lsb-release llvm clang
# in docker
cp -rf ${ROOT_DIR}/tools /tools
}
function start_docker () {
sudo service docker start
# pull
docker pull $IMG
docker run -ti -d --name xengine_docker_install -v $ROOT_DIR:/tmp $IMG /bin/bash
docker exec xengine_docker_install bash -c "cd /tmp/&&./install_tools.sh install_tools"
}
function main() {
local cmd="$1"
if [ "$#" -eq 0 ]; then
cmd="auto_intall"
fi
case "${cmd}" in
auto_intall)
start_docker "$@"
;;
install_tools)
# hosts
hosts
# install tools
install_tools "$@"
;;
*)
show_usage
;;
esac
docker ps -a
printf "\nxengine_docker_install done!\n usage push_images.sh push to hub.docker.\n"
}
main "$@"