diff options
author | 2025-01-03 03:56:17 +0100 | |
---|---|---|
committer | 2025-01-03 03:56:17 +0100 | |
commit | 5f0d1fc048364315784526e59da3a9a8e4e3cb3d (patch) | |
tree | 99c40ab454bafc1a21968d20d83a94b3c617a148 /install.zsh | |
parent | 269541006d97bda7bb0f30f8b59678f5ca452340 (diff) | |
download | zuwu-5f0d1fc048364315784526e59da3a9a8e4e3cb3d.tar.gz zuwu-5f0d1fc048364315784526e59da3a9a8e4e3cb3d.tar.bz2 zuwu-5f0d1fc048364315784526e59da3a9a8e4e3cb3d.tar.lz zuwu-5f0d1fc048364315784526e59da3a9a8e4e3cb3d.zip |
feat: fallback to github if git.estrogen.zone is having a cgit moment
Diffstat (limited to 'install.zsh')
-rwxr-xr-x | install.zsh | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/install.zsh b/install.zsh index a34da8d..be47900 100755 --- a/install.zsh +++ b/install.zsh @@ -16,11 +16,16 @@ else fi mkdir -p "$TARGET" -if [[ "$(basename "$__filename")" == "zsh" ]]; then - curl -fsSLo "$TARGET/zuwu.zsh" https://git.estrogen.zone/zuwu.git/plain/zuwu.zsh -else - cp -r "$__dirname/zuwu.zsh" "$TARGET/zuwu.zsh" -fi +installFile() { + mkdir -p "$(dirname "$TARGET/$1")" + if [[ "$(basename "$__filename")" == "zsh" ]]; then + (curl -fsSLo "$TARGET/$1" https://git.estrogen.zone/zuwu.git/plain/$1 && ! grep 'Repository seems to be empty' "$TARGET/$1") || curl -fsSLo "$TARGET/$1" "https://raw.githubusercontent.com/dmpmem/zuwu/refs/heads/master/$1" + else + cp -r "$__dirname/$1" "$TARGET/$1" + fi +} +installFile zuwu.zsh + <<EOF_SETUPSCRIPT > "$TARGET/setup.zsh" #!/usr/bin/env zsh if [[ -f "\$HOME/.zshrc" ]]; then |