Son aktivite 2 weeks ago

Hardened interactive Ubuntu/Debian setup scripts, including CCUsage multi-device sync for Claude Code, Codex CLI, and OpenCode.

Revizyon 798beee6bbef3a7cb85c65dd84699964dee45b61

READMD.md Ham

Ubuntu Sans Nerd Font Installer

A quick, automated bash script designed specifically for Ubuntu Desktop setups. This script fetches, downloads, and installs the absolute latest release of the Ubuntu Sans Nerd Font directly from the official Nerd Fonts repository.

Perfect for developers looking to quickly configure a fresh Ubuntu installation with beautifully patched fonts for their terminal, IDE, or system UI.

🚀 Quick Install

To install the latest Ubuntu Sans Nerd Font, simply copy and paste the following one-liner into your terminal:

bash -c "$(curl -fsSL [https://opengist.rmrf.online/weehong/2de15ba0106a475fa41215159203a63b/raw/HEAD/install_font.sh](https://opengist.rmrf.online/weehong/2de15ba0106a475fa41215159203a63b/raw/HEAD/install_font.sh))"

⚙️ What It Does Under the Hood

Running curl-to-bash scripts requires trust. Here is exactly what this script automates:

  • Dynamic Versioning: Queries the GitHub API to always fetch the latest stable release of UbuntuSans.zip.
  • Safe Extraction: Creates a temporary directory (/tmp/...) to safely download and extract the archive without cluttering your system.
  • Targeted Installation: Installs only the relevant .ttf and .otf font files into your user-level font directory: ~/.local/share/fonts/UbuntuSans.
  • Zero sudo Required: Installs locally for the current user, avoiding the need for root privileges.
  • Instant Activation: Automatically runs fc-cache to rebuild the system's font cache, making the fonts instantly accessible to your applications.
  • Automatic Cleanup: Deletes all temporary download and extraction folders once finished.

📋 Prerequisites

Your system will need a couple of basic utilities to run the script. Most Ubuntu Desktops come with these pre-installed:

  • curl (to fetch the script and the font zip)
  • unzip (to extract the font archive)

Note: If unzip is missing from your system, the script will gracefully exit and remind you to run sudo apt install unzip.

install_font.sh Ham
1#!/bin/bash
2
3# Exit immediately if a command exits with a non-zero status
4set -e
5
6FONT_NAME="UbuntuSans"
7FONT_ZIP="${FONT_NAME}.zip"
8# Simplified directory: removed the "NerdFonts" subfolder
9FONT_DIR="$HOME/.local/share/fonts/${FONT_NAME}"
10TMP_DIR=$(mktemp -d)
11
12echo "Searching for the latest release of $FONT_NAME Nerd Font..."
13
14# Use GitHub API to find the latest release download URL for UbuntuSans.zip
15DOWNLOAD_URL=$(curl -s https://api.github.com/repos/ryanoasis/nerd-fonts/releases/latest \
16 | grep "browser_download_url.*${FONT_ZIP}" \
17 | cut -d '"' -f 4)
18
19if [ -z "$DOWNLOAD_URL" ]; then
20 echo "Error: Could not find the download URL for $FONT_NAME. Check your internet connection or GitHub API limits."
21 rm -rf "$TMP_DIR"
22 exit 1
23fi
24
25echo "Latest version found!"
26echo "Downloading from: $DOWNLOAD_URL"
27
28# Download the zip file to the temporary directory
29curl -L -q "$DOWNLOAD_URL" -o "$TMP_DIR/$FONT_ZIP"
30
31echo "Extracting fonts..."
32# Ensure unzip is installed (will fail gracefully if not)
33if ! command -v unzip &> /dev/null; then
34 echo "Error: 'unzip' is not installed. Please install it using 'sudo apt install unzip' and try again."
35 rm -rf "$TMP_DIR"
36 exit 1
37fi
38
39unzip -q -o "$TMP_DIR/$FONT_ZIP" -d "$TMP_DIR/extracted"
40
41echo "Installing fonts to $FONT_DIR..."
42# Create the simplified font directory if it doesn't exist
43mkdir -p "$FONT_DIR"
44
45# Move only the TrueType (.ttf) or OpenType (.otf) files to the fonts directory
46find "$TMP_DIR/extracted" -name '*.[ot]tf' -type f -exec cp {} "$FONT_DIR/" \;
47
48echo "Updating the system font cache..."
49fc-cache -f "$FONT_DIR"
50
51echo "Cleaning up temporary files..."
52rm -rf "$TMP_DIR"
53
54echo "Done! $FONT_NAME Nerd Font has been successfully installed."