Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperManito committed Nov 14, 2024
1 parent f6b2f6c commit 01c6afa
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 7 deletions.
16 changes: 13 additions & 3 deletions ChangeMirrors.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
## Author: SuperManito
## Modified: 2024-11-08
## Modified: 2024-11-14
## License: MIT
## GitHub: https://github.com/SuperManito/LinuxMirrors
## Website: https://linuxmirrors.cn
Expand Down Expand Up @@ -973,7 +973,7 @@ function choose_mirrors() {
local system_name="${SYSTEM_PRETTY_NAME:-"${SYSTEM_NAME} ${SYSTEM_VERSION_NUMBER}"}"
local arch="${DEVICE_ARCH}"
local date_time time_zone
date_time="$(date "+%Y-%m-%d %H:%M:%S")"
date_time="$(date "+%Y-%m-%d %H:%M")"
time_zone="$(timedatectl status 2>/dev/null | grep "Time zone" | awk -F ':' '{print$2}' | awk -F ' ' '{print$1}')"
echo -e ''
Expand Down Expand Up @@ -1376,7 +1376,7 @@ function remove_original_mirrors() {
[ -d $Dir_YumRepos ] && rm -rf $Dir_YumRepos/AnolisOS*
;;
"${SYSTEM_OPENSUSE}")
[ -d $Dir_openSUSERepos ] && ls $Dir_openSUSERepos/ | grep -E "^repo-" | grep -Ev "openh264" | xargs rm -rf
[ -d $Dir_openSUSERepos ] && rm -rf $Dir_YumRepos/repo-*
;;
"${SYSTEM_ARCH}")
[ -f $File_ArchLinuxMirrorList ] && sed -i '1,$d' $File_ArchLinuxMirrorList
Expand Down Expand Up @@ -2083,6 +2083,7 @@ function change_mirrors_openSUSE() {
repo-debug-update-non-oss.repo \
repo-debug-update.repo \
repo-non-oss.repo \
repo-openh264.repo \
repo-oss.repo \
repo-sle-debug-update.repo \
repo-sle-update.repo \
Expand Down Expand Up @@ -5301,6 +5302,15 @@ autorefresh=1
baseurl=http://download.opensuse.org/distribution/leap/$releasever/repo/non-oss/
type=rpm-md
keeppackages=0
EOF
cat <<'EOF' >$Dir_openSUSERepos/repo-openh264.repo
[repo-openh264]
name=Open H.264 Codec (openSUSE Leap)
enabled=1
autorefresh=1
baseurl=http://codecs.opensuse.org/openh264/openSUSE_Leap/
type=rpm-md
keeppackages=0
EOF
cat <<'EOF' >$Dir_openSUSERepos/repo-oss.repo
[repo-oss]
Expand Down
7 changes: 4 additions & 3 deletions DockerInstallation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -441,12 +441,13 @@ function choose_mirrors() {
function print_title() {
local system_name="${SYSTEM_PRETTY_NAME:-"${SYSTEM_NAME} ${SYSTEM_VERSION_NUMBER}"}"
local arch=""${DEVICE_ARCH}""
local date="$(date "+%Y-%m-%d %H:%M:%S")"
local timezone="$(timedatectl status 2>/dev/null | grep "Time zone" | awk -F ':' '{print$2}' | awk -F ' ' '{print$1}')"
local date_time time_zone
date_time="$(date "+%Y-%m-%d %H:%M")"
timezone="$(timedatectl status 2>/dev/null | grep "Time zone" | awk -F ':' '{print$2}' | awk -F ' ' '{print$1}')"
echo -e ''
echo -e " 运行环境 ${BLUE}${system_name} ${arch}${PLAIN}"
echo -e " 系统时间 ${BLUE}${date} ${timezone}${PLAIN}"
echo -e " 系统时间 ${BLUE}${date_time} ${timezone}${PLAIN}"
}
print_title
Expand Down
44 changes: 43 additions & 1 deletion docs/other/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ hide:
apt-get remove -y docker* containerd.io runc && apt-get autoremove
```

> `Debian` &nbsp; `Ubuntu` &nbsp; `Kali` &nbsp; `Linux Mint` &nbsp; `Deepin` &nbsp; `Armbian` &nbsp; `Proxmox`
> `Debian` &nbsp; `Ubuntu` &nbsp; `Kali` &nbsp; `Linux Mint` &nbsp; `Deepin` &nbsp; `Zorin OS` &nbsp; `Armbian` &nbsp; `Proxmox`

=== "RedHat 系 / OpenCloudOS / openEuler / Anolis OS"

Expand All @@ -109,3 +109,45 @@ hide:
> `Red Hat Enterprise Linux` &nbsp; `CentOS` &nbsp; `Rocky Linux` &nbsp; `AlmaLinux` &nbsp; `Fedora` &nbsp; `OpenCloudOS` &nbsp; `openEuler` &nbsp; `Anolis OS`

卸载完成后重新执行脚本安装即可

## 其它

提供一些常见服务的一键换源命令,用于备忘

### NPM

适用于 `npm` `yarn` `pnpm`

=== "淘宝源"

``` bash
npm config set registry https://registry.npmmirror.com/
```

=== "腾讯云"

``` bash
npm config set registry https://mirrors.tencent.com/npm/
```

### PYPI

适用于 `pip` `pip3`

=== "阿里云"

``` bash
pip3 config set global.index-url https://mirrors.aliyun.com/pypi/simple/
```

=== "腾讯云"

``` bash
pip3 config set global.index-url https://mirrors.tencent.com/pypi/simple/
```

=== "中科大"

``` bash
pip3 config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple/
```

0 comments on commit 01c6afa

Please sign in to comment.