7 Star 4 Fork 5

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

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
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.

About

hustmirror-cli 帮助快速换源 expand collapse
Shell and 3 more languages
MIT
Cancel

Releases (3)

All

Contributors

All

Activities

Load More
can not load any more
马建仓 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

Search

344bd9b3 5694891 D2dac590 5694891