7 Star 4 Fork 5

华科开放原子开源俱乐部/hustmirror-cli

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

hustmirror-cli

Introduction

hustmirror-cli is a CLI posix shell script to replace system repository mirror to HUST Mirror.

Supported Linux Distributions and Software

  • Alpine Linux
  • Anolis OS
  • Arch Linux
  • Black Arch
  • crates
  • Debian
  • Deepin
  • Kali
  • LinuxMint
  • openEuler
  • openKylin
  • pypi
  • Rustup
  • Ubuntu
  • Oh My Zsh

If you would to request supports of new Linux distributions or software, please submit an issue.

Usage

curl -s https://mirrors.hust.edu.cn/get | sh -s -- autodeploy

See details about hustmirror-cli usage in the USAGE.md.

Build

Use GNU make to process all files and generate them into a single executable bash.

make

The output script will be placed in ./output/hustmirror-cli

Test

make test

Contract

Styles

  • Syntax of scripts is supposed to POSIX shell compatible.
  • Use 4 character tab indent.
  • We suppose that user only install GNU coreutils or busybox. So prerequisite check is supposed to be made when use other utils like gcc or make.

Directories

  • src: scripts would packaging into output scripts.
    • src/mirrors: scripts subject to mirror script contract.
    • src/main.sh.template: template shell file.
    • src/checkfile.sh: check file.
  • scripts: store scripts used for packaging.

Template

Template file supports following directives:

  • @include file: include other files.
  • @var(shell code): get a string from build process.
  • @mirrors: include all processed mirror scripts.

Mirror script contract

All files in mirror should implement following functions.

  • check: (optional) check if target machine is satisfied to replace mirror.
  • install: install mirror.
  • is_deployed: (optional) check whether is deployed.
  • can_recover: (optional) check whether can be recovered.
  • uninstall: (optional) recover installation.
MIT License Copyright (c) 2023 Dongliang Mu <dzm91@hust.edu.cn> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

hustmirror-cli 帮助快速换源 展开 收起
Shell 等 3 种语言
MIT
取消

发行版 (3)

全部

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/hust-open-atom-club/hustmirror-cli.git
git@gitee.com:hust-open-atom-club/hustmirror-cli.git
hust-open-atom-club
hustmirror-cli
hustmirror-cli
master

搜索帮助

A270a887 8829481 3d7a4017 8829481