From 5f0d1fc048364315784526e59da3a9a8e4e3cb3d Mon Sep 17 00:00:00 2001 From: memdmp Date: Fri, 3 Jan 2025 03:56:17 +0100 Subject: feat: fallback to github if git.estrogen.zone is having a cgit moment --- install.zsh | 15 ++++++++++----- 1 file 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 + < "$TARGET/setup.zsh" #!/usr/bin/env zsh if [[ -f "\$HOME/.zshrc" ]]; then -- cgit v1.2.3