Documentation
¶
Index ¶
- Variables
- func CloneRepoViaHTTP(path string, url string, repo string) error
- func DownloadFile(url string, outputFile string) error
- func FileVerification(checksumFile, filePath string) (bool, error)
- func GetTomlConfig(filePath string) (*toml.Tree, error)
- func InstallFile(sourceFile, targetFile string, perm os.FileMode) error
- func WriteTomlConfig(filePath string) (int64, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // chezmoi 的依赖项 ChezmoiDependencies = "/usr/bin/chezmoi" ChezmoiConfig = fmt.Sprintf(chezmoiConfigFormat, chezmoiSourceDir, sep, chezmoiAutoCommit, sep, chezmoiAutoPush) ChezmoiConfigFile = filepath.Join(home, ".config", "chezmoi", "chezmoi.toml") // cobra 的依赖项 CobraDependencies = filepath.Join(goGOBIN, "cobra-cli") CobraConfig = fmt.Sprintf(cobraConfigFormat, cobraAuthor, email, cobraLicense, cobraUseViper) CobraConfigFile = filepath.Join(home, ".cobra.yaml") // docker service 和 mirrors 的依赖项 DockerDependencies = "/usr/bin/dockerd" DockerServiceConfig = fmt.Sprintf(dockerServiceConfigFormat, dockerServiceExecStart, dockerServiceDataRoot) DockerServiceConfigFile = "/etc/systemd/system/docker.service.d/override.conf" DockerMirrorsConfig = fmt.Sprintf(dockerMirrorsConfigFormat, sep, dockerMirrorsRegistryMirrors) DockerMirrorsConfigFile = "/etc/docker/daemon.json" // frpc 的依赖项 FrpcDependencies = "/usr/bin/frpc" FrpcConfig = fmt.Sprintf(frpcConfigFormat, frpcRestart) FrpcConfigFile = "/etc/systemd/system/frpc.service.d/override.conf" // git 的依赖项 GitDependencies = "/usr/bin/git" GitConfig = fmt.Sprintf(gitConfigFormat, sep, hostname, sep, email, sep, gitCoreEditor, sep, gitCoreAutoCRLF, sep, gitMergeTool, sep, gitColorUI, sep, gitPullRebase, sep, gitFilterLfsClean, sep, gitFilterLfsSmudge, sep, gitFilterLfsProcess, sep, gitFilterLfsRequired) GitConfigFile = filepath.Join(home, ".gitconfig") // go 的依赖项 GoDependencies = "/usr/bin/go" GoConfig = fmt.Sprintf(goConfigFormat, goGO111MODULE, goGOBIN, goGOPATH, goGOCACHE, goGOMODCACHE) GoConfigFile = filepath.Join(home, ".config", "go", "env") // npm 的依赖项 NpmDependencies = "/usr/bin/npm" NpmConfig = fmt.Sprintf(npmConfigFormat, npmRegistry) NpmConfigFile = filepath.Join(home, ".npmrc") // pip 的依赖项 PipDependencies = "/usr/bin/pip" PipConfig = fmt.Sprintf(pipConfigFormat, pipIndexUrl, pipTrustedHost) PipConfigFile = filepath.Join(home, ".config", "pip", "pip.conf") // system-checkupdates timer 和 service 的依赖项 SystemCheckupdatesDependencies = "/usr/local/bin/system-checkupdates" // >= 3.0.0-20230313.1 SystemCheckupdatesTimerConfig = fmt.Sprintf(systemCheckupdatesTimerConfigFormat, systemcheckupdatesTimerDescription, systemcheckupdatesTimerOnBootSec, systemcheckupdatesTimerOnUnitInactiveSec, systemcheckupdatesTimerAccuracySec, systemcheckupdatesTimerPersistent, systemcheckupdatesTimerWantedBy) SystemCheckupdatesTimerConfigFile = "/etc/systemd/system/system-checkupdates.timer" SystemCheckupdatesServiceConfig = fmt.Sprintf(systemCheckupdatesServiceConfigFormat, systemcheckupdatesServiceDescription, systemcheckupdatesServiceAfter, systemcheckupdatesServiceWants, systemcheckupdatesServiceType, systemcheckupdatesServiceExecStart) SystemCheckupdatesServiceConfigFile = "/etc/systemd/system/system-checkupdates.service" )
Functions ¶
func CloneRepoViaHTTP ¶
CloneRepoViaHTTP 通过 HTTP 协议克隆仓库
参数:
- path: 本地仓库存储路径
- url: 远程仓库地址(不包括仓库名,https://github.com/{UserName})
- repo: 仓库名
返回:
- 错误信息
func FileVerification ¶ added in v1.0.4
FileVerification 使用校验和文件校验文件的完整性
参数:
- checksumFile: 校验和文件
- filePath: 待校验文件
返回:
- 校验结果
- 错误信息
func InstallFile ¶
InstallFile 安装文件,覆盖已存在的同名文件
参数:
- sourceFile: 源文件路径
- targetFile: 目标文件路径
- perm: 目标文件权限
返回:
- 错误信息
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.