[+] 历史版本兼容
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 14s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 22m24s

This commit is contained in:
Martin 2025-01-13 21:12:49 +08:00
parent b1688d45a8
commit 9eda3ac981
8 changed files with 58 additions and 17 deletions

View File

@ -63,8 +63,11 @@ docker compose run ubuntu bash
#### APT 镜像源配置测试
```bash
docker compose run debian ./init-apt.sh
docker compose run debian ./init-all.sh
```
```bash
docker compose run ubuntu ./init-apt.sh
docker compose run ubuntu ./init-all.sh
```
```bash
docker compose run ubuntu-2204 ./init-all.sh
```

View File

@ -13,4 +13,8 @@ services:
ubuntu:
<<: *app-config
image: docker.martin98.com/library/ubuntu:latest
image: docker.martin98.com/library/ubuntu:latest
ubuntu-2204:
<<: *app-config
image: docker.martin98.com/library/ubuntu:22.04

View File

@ -1,12 +1,28 @@
#!/bin/bash
download_and_run() {
local filename="$1"
local url="https://git.martin98.com/MartinFarm/init/raw/branch/main/$1"
if [ ! -f "$filename" ]; then
echo "文件 $filename 不存在,正在下载..."
curl -sSL "$url" -o "$filename"
if [ $? -ne 0 ]; then
echo "下载失败请检查网络连接或URL是否正确。"
exit 1
fi
fi
bash "$filename"
}
# apt + ntp
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-apt.sh | bash
download_and_run "init-apt.sh"
# docker-ce
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-docker.sh | bash
download_and_run "init-docker.sh"
# npm
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-npm.sh | bash
download_and_run "init-npm.sh"
# pip
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-pip.sh | bash
download_and_run "init-pip.sh"
# git
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-git.sh | bash
download_and_run "init-git.sh"

View File

@ -1,5 +1,7 @@
#!/bin/bash
APT_OPTIONS="-o Acquire::https::mirrors.martin98.com::Verify-Peer=false -o Acquire::https::mirrors.martin98.com::Verify-Host=false"
type=$(cat /etc/*release | grep ^ID= | cut -d= -f2)
release=$(cat /etc/*release | grep VERSION_CODENAME | cut -d= -f2)
components=$([ "${type}" = "debian" ] && echo "main contrib non-free non-free-firmware" || ([ "${type}" = "ubuntu" ] && echo "main restricted universe multiverse"))
@ -31,9 +33,9 @@ else
exit 1
fi
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
# 更新证书
APT_OPTIONS="-o Acquire::https::mirrors.martin98.com::Verify-Peer=false -o Acquire::https::mirrors.martin98.com::Verify-Host=false"
apt update $APT_OPTIONS && apt install $APT_OPTIONS -y ca-certificates && update-ca-certificates
apt update $APT_OPTIONS && apt install $APT_OPTIONS -y ca-certificates curl && update-ca-certificates
apt update && apt upgrade -y

View File

@ -3,10 +3,19 @@
command_exists() {
command -v "$@" > /dev/null 2>&1
}
is_wsl() {
case "$(uname -r)" in
*microsoft* ) true ;; # WSL 2
*Microsoft* ) true ;; # WSL 1
* ) false;;
esac
}
if command_exists docker; then
echo "docker 已安装.... 跳过"
( set -x; sleep 5 )
if is_wsl; then
echo "检测到 WSL 环境,建议使用 Docker Desktop."
exit 0
elif command_exists docker; then
echo "Docker 已安装.... 跳过安装"
else
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/docker-install.sh | sh
fi

View File

@ -1,8 +1,10 @@
#!/bin/bash
# 检查 git 是否安装
if command -v pip &> /dev/null; then
if command -v git > /dev/null 2>&1; then
echo "git 已安装,正在配置镜像源..."
git config --global url."https://git-proxy.hk.martin98.com/".insteadOf "https://"
echo "镜像源配置完成。"
fi
else
echo "git 不存在,跳过..."
fi

View File

@ -1,8 +1,11 @@
#!/bin/bash
# 检查 npm 是否安装
if command -v npm &> /dev/null; then
if command -v npm > /dev/null 2>&1; then
echo "npm 已安装,正在配置镜像源..."
npm config set registry https://mirrors.martin98.com/repository/npm-group/
echo "镜像源配置完成。"
else
echo "npm 不存在,跳过..."
fi

View File

@ -1,8 +1,10 @@
#!/bin/bash
# 检查 pip 是否安装
if command -v pip &> /dev/null; then
if command -v pip > /dev/null 2>&1; then
echo "pip 已安装,正在配置镜像源..."
pip config set global.index-url https://mirrors.martin98.com/repository/pypi-group/simple
echo "镜像源配置完成。"
else
echo "pip 不存在,跳过..."
fi