feat(install): pin nerd font release to v3.3.0 with SHA256 verification and add ref cloning support

swadhinbiswas committed 2 months ago
41c3a00
1 parent 6cdb216
commit 41c3a00
2 files changed
+27 -6
Showing 2 changed files+27-6
▼README.md
+4-0
136
136
Downloads, compiles with binary optimizations (`-ldflags="-s -w"`), installs to `~/.local/bin/veet`, and configures shell autocompletions:
137
137
138
138
```bash
139
+# Install latest release
139
140
curl -sSL https://raw.githubusercontent.com/swadhinbiswas/veet/main/install.sh | bash
141
+
142
+# Or install a specific pinned release tag (e.g. v1.1.0)
143
+curl -sSL https://raw.githubusercontent.com/swadhinbiswas/veet/v1.1.0/install.sh | VEET_VERSION=v1.1.0 bash
140
144
```
141
145
142
146
*Or from a local clone:*
143
147
▼install.sh
+23-6
55
55
SRC_DIR="$SCRIPT_DIR"
56
56
printf "${GREEN}✓${NC} Installing from local source: ${BOLD}%s${NC}\n" "$SRC_DIR"
57
57
else
58
- printf "${YELLOW}•${NC} Fetching latest VEET repository...\n"
58
+ VEET_REF="${VEET_VERSION:-main}"
59
+ printf "${YELLOW}•${NC} Fetching VEET repository (${CYAN}%s${NC})...\n" "$VEET_REF"
59
60
TMP_BUILD=$(mktemp -d)
60
- git clone --depth 1 https://github.com/swadhinbiswas/veet.git "$TMP_BUILD"
61
+ if [ "$VEET_REF" = "main" ]; then
62
+ git clone --depth 1 https://github.com/swadhinbiswas/veet.git "$TMP_BUILD"
63
+ else
64
+ git clone --depth 1 --branch "$VEET_REF" https://github.com/swadhinbiswas/veet.git "$TMP_BUILD"
65
+ fi
61
66
SRC_DIR="$TMP_BUILD"
62
67
fi
63
68
119
124
120
125
if [ ! -f "$FONT_FILE" ] || [ ! -f "$FONT_MONO" ]; then
121
126
printf "${YELLOW}•${NC} Downloading official Nerd Font Symbols into ${BOLD}%s${NC}...\n" "$FONT_DIR"
122
- FONT_URL="https://github.com/ryanoasis/nerd-fonts/raw/HEAD/patched-fonts/NerdFontsSymbolsOnly/SymbolsNerdFont-Regular.ttf"
123
- FONT_MONO_URL="https://github.com/ryanoasis/nerd-fonts/raw/HEAD/patched-fonts/NerdFontsSymbolsOnly/SymbolsNerdFontMono-Regular.ttf"
127
+ FONT_URL="https://github.com/ryanoasis/nerd-fonts/raw/v3.3.0/patched-fonts/NerdFontsSymbolsOnly/SymbolsNerdFont-Regular.ttf"
128
+ FONT_MONO_URL="https://github.com/ryanoasis/nerd-fonts/raw/v3.3.0/patched-fonts/NerdFontsSymbolsOnly/SymbolsNerdFontMono-Regular.ttf"
129
+ FONT_HASH="d7cda3a97797a3764b80a8df8b54f2bd7229a12cbc75c9c74f31496866c6eee9"
130
+ FONT_MONO_HASH="7f14415832a929155c3d6d1c7d404fae00dfbfe4f1b29940e3736e6e790e3312"
124
131
125
132
FONT_FILE_TMP="${FONT_FILE}.tmp.$$"
126
133
FONT_MONO_TMP="${FONT_MONO}.tmp.$$"
136
143
fi
137
144
fi
138
145
139
- if [ "$DOWNLOADED" = true ] && [ -s "$FONT_FILE_TMP" ] && [ -s "$FONT_MONO_TMP" ]; then
146
+ # Verify SHA256 checksums if sha256sum utility is available
147
+ VALID_CHECKSUM=true
148
+ if [ "$DOWNLOADED" = true ] && command -v sha256sum >/dev/null 2>&1; then
149
+ CALC_HASH=$(sha256sum "$FONT_FILE_TMP" | awk '{print $1}')
150
+ CALC_MONO_HASH=$(sha256sum "$FONT_MONO_TMP" | awk '{print $1}')
151
+ if [ "$CALC_HASH" != "$FONT_HASH" ] || [ "$CALC_MONO_HASH" != "$FONT_MONO_HASH" ]; then
152
+ VALID_CHECKSUM=false
153
+ fi
154
+ fi
155
+
156
+ if [ "$DOWNLOADED" = true ] && [ "$VALID_CHECKSUM" = true ] && [ -s "$FONT_FILE_TMP" ] && [ -s "$FONT_MONO_TMP" ]; then
140
157
mv -f "$FONT_FILE_TMP" "$FONT_FILE"
141
158
mv -f "$FONT_MONO_TMP" "$FONT_MONO"
142
159
if command -v fc-cache >/dev/null 2>&1; then
143
160
fc-cache -f "$FONT_DIR" 2>/dev/null || true
144
161
fi
145
- printf "${GREEN}✓${NC} Installed Nerd Font Symbols fallback font.\n"
162
+ printf "${GREEN}✓${NC} Installed Nerd Font Symbols fallback font (v3.3.0).\n"
146
163
else
147
164
rm -f "$FONT_FILE_TMP" "$FONT_MONO_TMP"
148
165
printf "${YELLOW}• Note:${NC} Could not auto-download font. VEET will use universal Unicode fallback (${CYAN}icons: auto${NC}).\n"
149
166