diff --git a/debian/docker b/debian/docker index 63541e3..523a13f 100644 --- a/debian/docker +++ b/debian/docker @@ -1 +1 @@ -deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://host/docker-ce/linux/debian version stable +deb [signed-by=/etc/apt/keyrings/docker.gpg] https://host/docker-ce/linux/debian version stable diff --git a/host.mirrors b/host.mirrors index 8c8aab0..ab27207 100644 --- a/host.mirrors +++ b/host.mirrors @@ -1,8 +1,8 @@ -tencent|mirrors.cloud.tencent.com|腾讯软件源|https://mirrors.cloud.tencent.com|ubuntu,debian,docker,centos,maven,pypi -163|mirrors.163.com|网易开源镜像站|https://mirrors.163.com|ubuntu,debian,centos,docker,maven,pypi +tencent|mirrors.cloud.tencent.com|腾讯软件源|https://mirrors.cloud.tencent.com|ubuntu,debian,centos,maven,pypi +tsinghua|mirrors.tuna.tsinghua.edu.cn|清华大学开源软件镜像站|https://mirrors.tuna.tsinghua.edu.cn|ubuntu,debian,docker,centos-stream ustc|mirrors.ustc.edu.cn|中国科学技术大学开源软件镜像|https://mirrors.ustc.edu.cn|ubuntu,debian,docker,centos-stream +163|mirrors.163.com|网易开源镜像站|https://mirrors.163.com|ubuntu,debian,centos,docker,maven,pypi aliyun|mirrors.aliyun.com|阿里云镜像站|https://mirrors.aliyun.com|ubuntu,debian,docker,centos,centos-stream,maven,pypi -tsinghua|mirrors.tuna.tsinghua.edu.cn|清华大学开源软件镜像站|https://mirrors.tuna.tsinghua.edu.cn|ubuntu,debian,docker,centos-stream nju|mirror.nju.edu.cn|南京大学开源镜像站|https://mirror.nju.edu.cn|ubuntu,debian sjtu|mirror.sjtu.edu.cn|上海交通大学开源镜像站|https://mirror.sjtu.edu.cn|ubuntu,debian,docker lzu|mirror.lzu.edu.cn|兰州大学开源镜像站|https://mirror.lzu.edu.cn|ubuntu,debian \ No newline at end of file diff --git a/install.sh b/install.sh index aa53a61..9763ddf 100755 --- a/install.sh +++ b/install.sh @@ -1,7 +1,9 @@ #!/usr/bin/env bash -curl -s -o tiny-shell.sh https://tiny-shell.chaobei.xyz/tiny-shell.sh +BUCKET="https://tiny-shell.chaobei.xyz" +curl -s -o tiny-shell.sh ${BUCKET}/tiny-shell.sh +sed 's/file:${pwd}/https:\/\/tiny-shell.chaobei.xyz/g' tiny-shell.sh chmod +x tiny-shell.sh ./tiny-shell.sh \ No newline at end of file diff --git a/tiny-shell.sh b/tiny-shell.sh index 4624992..eec9a39 100755 --- a/tiny-shell.sh +++ b/tiny-shell.sh @@ -5,11 +5,10 @@ green='\033[0;32m' yellow='\033[0;33m' plain='\033[0m' -BUCKET="https://tiny-shell.chaobei.xyz" +pwd=$(pwd) +BUCKET="file:${pwd}" WORKDIR=".tiny-shell" -mkdir -p ${WORKDIR} - info() { date=$(date +"%Y-%m-%d %H:%M:%S") echo -e "${date} INFO ${1}" @@ -67,32 +66,41 @@ elif [[ -f /etc/redhat-release ]]; then elif cat /etc/issue | grep -Eqi "debian"; then release="debian" version=$(cat /etc/os-release | grep "VERSION_CODENAME" | cut -d '=' -f 2) + architecture=$(dpkg --print-architecture) elif cat /etc/issue | grep -Eqi "ubuntu"; then release="ubuntu" version=$(cat /etc/os-release | grep "VERSION_CODENAME" | cut -d '=' -f 2) + architecture=$(dpkg --print-architecture) elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then release="centos" version=$(cat /etc/os-release | grep "VERSION_ID" | grep -Eo "[0-9]") elif cat /proc/version | grep -Eqi "debian"; then release="debian" version=$(cat /etc/os-release | grep "VERSION_CODENAME" | cut -d '=' -f 2) + architecture=$(dpkg --print-architecture) elif cat /proc/version | grep -Eqi "ubuntu"; then release="ubuntu" version=$(cat /etc/os-release | grep "VERSION_CODENAME" | cut -d '=' -f 2) + architecture=$(dpkg --print-architecture) elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then release="centos" else error "The script does't support your system. Please commit your request! \n" && exit 1 fi -yum(){ - echo "" -} -apt(){ - host="\/\/mirrors.tencent.com\/" - sed -E "s/\/\/[a-zA-Z.0-9]+\//${host}/g" /etc/apt/sources.list -} +# init. +if [[ ! -e ${WORKDIR} ]]; then + + info "init package." + if [[ ${release} = "ubuntu" ]];then + apt-get -y install apt-transport-https ca-certificates curl wget gnupg > /dev/null + fi + +fi + +mkdir -p ${WORKDIR} + mirrors_check(){ @@ -193,8 +201,27 @@ system(){ } -docker(){ +infomation() { + + clear + echo -e "" + echo -e "${green}tiny-shell ${plain}System Infomations" + echo -e ${line} + echo -e "" + + info "OS - ${release}" + info "Version - ${version}" + info "Bucket - ${BUCKET}" + info "arch - ${architecture}" +} + +dockerce(){ + if command -v docker > /dev/null ; then + warn "You have installed Docker. Script exit." + return + fi + clear echo -e "" echo -e "${green}tiny-shell ${plain}Docker-ce Install" @@ -231,18 +258,20 @@ docker(){ cat "${WORKDIR}/.target" > ${destination} - # download grp + # download grp + # /etc/apt/keyrings/docker.asc mkdir -p /etc/apt/keyrings + curl -fsSL "http://${host}/docker-ce/linux/${release}/gpg" | gpg --dearmor --yes -o /etc/apt/keyrings/docker.gpg - wget -q -O .docker.gpg "http://${host}/docker-ce/linux/${release}/gpg" - gpg --dearmor -o /etc/apt/keyrings/docker.gpg .docker.gpg - sed -i "s/host/${host}/g" "${WORKDIR}/.target" sed -i "s/version/${version}/g" "${WORKDIR}/.target" cat "${WORKDIR}/.target" > ${destination} print_info + + apt-get update > /dev/null && apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin > /dev/null + docker run hello-world } @@ -254,6 +283,7 @@ menu(){ echo -e "" echo -e "./tiny-shell - Help" echo -e "./tiny-shell system - Check System Mirrors" + echo -e "./tiny-shell info - Check Your System Infomations." echo -e "./tiny-shell docker - Install Docker Environment" echo -e "./tiny-shell pypi - Configuating Python Package Manager's Mirrors" echo -e "./tiny-shell maven - Maven's Mirrors Check" @@ -266,11 +296,14 @@ if [[ $# > 0 ]]; then root_check && system ;; "docker") - root_check && docker + root_check && dockerce ;; + "info") + infomation + ;; "pypi") pypi - ;; + ;; "maven") maven ;; diff --git a/ubuntu/docker b/ubuntu/docker index 5e68314..419e6e3 100644 --- a/ubuntu/docker +++ b/ubuntu/docker @@ -1 +1 @@ -deb [signed-by=/etc/apt/keyring/docker.gpg] http://host/docker-ce/linux/ubuntu version stable +deb [signed-by=/etc/apt/keyrings/docker.gpg] http://host/docker-ce/linux/ubuntu version stable