Skip to content

Commit

Permalink
add aarch64 starship and zoxid (#45)
Browse files Browse the repository at this point in the history
* add aarch64 starship and zoxid
  • Loading branch information
BrightXiaoHan authored Dec 14, 2023
1 parent 2cc51b1 commit d92ac71
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions homecli/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,41 @@ def install_docker_compose(overwrite=True):
os.chmod(os.path.join(CACHE_DIR, "bin", "docker-compose"), 0o755)


def install_zoxide(overwrite=True):
latest_version = get_latest_release("ajeetdsouza", "zoxide")
if ARCHITECTURE in ("x86_64", "amd64"):
# url = f"https://github.com/ajeetdsouza/zoxide/releases/download/{latest_version}/zoxide-{latest_version}-x86_64-unknown-linux-musl.tar.gz"
return
else:
url = f"https://github.com/ajeetdsouza/zoxide/releases/download/{latest_version}/zoxide-{latest_version[1:]}-aarch64-unknown-linux-musl.tar.gz"

logging.info("Installing zoxide...")
if not os.path.exists(os.path.join(CACHE_DIR, "bin", "zoxide")) or overwrite:
with tempfile.NamedTemporaryFile() as tmp:
download_with_progress(url, tmp.name, "zoxide")
with tarfile.open(tmp.name) as tar:
# extract zoxide
tar.extract("zoxide", path=os.path.join(CACHE_DIR, "bin"))
os.chmod(os.path.join(CACHE_DIR, "bin", "zoxide"), 0o755)


def install_starship(overwrite=True):
latest_version = get_latest_release("starship", "starship")
if ARCHITECTURE in ("x86_64", "amd64"):
# url = f"https://github.com/starship/starship/releases/download/{latest_version}/starship-x86_64-unknown-linux-musl.tar.gz"
return
else:
url = f"https://github.com/starship/starship/releases/download/{latest_version}/starship-aarch64-unknown-linux-musl.tar.gz"

logging.info("Installing starship...")
if not os.path.exists(os.path.join(CACHE_DIR, "bin", "starship")) or overwrite:
with tempfile.NamedTemporaryFile() as tmp:
download_with_progress(url, tmp.name, "starship")
with tarfile.open(tmp.name) as tar:
tar.extractall(path=os.path.join(CACHE_DIR, "bin"))
os.chmod(os.path.join(CACHE_DIR, "bin", "starship"), 0o755)


def main():
parser = argparse.ArgumentParser()
parser.add_argument(
Expand All @@ -342,6 +377,8 @@ def main():
"docker_compose",
"aliyunpan",
"mamba",
"starship",
"zoxide",
"conda",
"neovim",
"trzsz",
Expand All @@ -351,6 +388,8 @@ def main():
"docker_compose",
"aliyunpan",
"mamba",
"starship",
"zoxide",
"neovim",
"trzsz",
]
Expand Down

0 comments on commit d92ac71

Please sign in to comment.