✨ Feat(install): add install scripts
Adds install scripts for each platform. Includes a `minimal` install option.
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get the directory where the script is located
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# Set the font source locations (relative to the script location)
|
||||
FONT_FOLDER="$SCRIPT_DIR/TTF"
|
||||
NERD_FONT_FOLDER="$SCRIPT_DIR/NerdFont"
|
||||
|
||||
# Check if the font folders exist
|
||||
if [ ! -d "$FONT_FOLDER" ]; then
|
||||
echo "Font folder not found!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$NERD_FONT_FOLDER" ]; then
|
||||
echo "Nerd Font folder not found!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Function to install fonts
|
||||
install_fonts() {
|
||||
local font_files=("$@")
|
||||
|
||||
for font_file in "${font_files[@]}"; do
|
||||
if [ -f "$FONT_FOLDER/$font_file" ]; then
|
||||
echo "Installing font - $font_file"
|
||||
cp "$FONT_FOLDER/$font_file" "$HOME/.local/share/fonts/"
|
||||
else
|
||||
echo "Font not found: $font_file" >&2
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Check for minimal option
|
||||
if [[ "$1" == "--minimal" ]]; then
|
||||
# Minimal installation
|
||||
MINIMAL_FONTS=(
|
||||
"IosevkaRootiestV2-Regular.ttf"
|
||||
"IosevkaRootiestV2-Italic.ttf"
|
||||
"IosevkaRootiestV2-Oblique.ttf"
|
||||
"IosevkaRootiestV2-ObliqueItalic.ttf"
|
||||
)
|
||||
|
||||
# Install minimal fonts
|
||||
install_fonts "${MINIMAL_FONTS[@]}"
|
||||
|
||||
# Install the Nerd Font
|
||||
NERD_FONT_FILE="IosevkaRootiestV2NerdFont-Regular.ttf"
|
||||
if [ -f "$NERD_FONT_FOLDER/$NERD_FONT_FILE" ]; then
|
||||
echo "Installing Nerd Font - $NERD_FONT_FILE"
|
||||
cp "$NERD_FONT_FOLDER/$NERD_FONT_FILE" "$HOME/.local/share/fonts/"
|
||||
else
|
||||
echo "Nerd Font not found: $NERD_FONT_FILE" >&2
|
||||
fi
|
||||
|
||||
else
|
||||
# Full installation: List all .fon, .otf, .ttc, and .ttf files from TTF folder
|
||||
find "$FONT_FOLDER" -type f \( -name "*.fon" -o -name "*.otf" -o -name "*.ttc" -o -name "*.ttf" \) | while read -r font; do
|
||||
echo "Installing font - $(basename "$font")"
|
||||
cp "$font" "$HOME/.local/share/fonts/"
|
||||
done
|
||||
|
||||
# Install all fonts from the NerdFont folder
|
||||
find "$NERD_FONT_FOLDER" -type f \( -name "*.fon" -o -name "*.otf" -o -name "*.ttc" -o -name "*.ttf" \) | while read -r nerd_font; do
|
||||
echo "Installing Nerd Font - $(basename "$nerd_font")"
|
||||
cp "$nerd_font" "$HOME/.local/share/fonts/"
|
||||
done
|
||||
fi
|
||||
|
||||
# Update font cache
|
||||
fc-cache -f -v
|
||||
@@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get the directory where the script is located
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# Set the font source locations (relative to the script location)
|
||||
FONT_FOLDER="$SCRIPT_DIR/TTF"
|
||||
NERD_FONT_FOLDER="$SCRIPT_DIR/NerdFont"
|
||||
|
||||
# Check if the font folders exist
|
||||
if [ ! -d "$FONT_FOLDER" ]; then
|
||||
echo "Font folder not found!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$NERD_FONT_FOLDER" ]; then
|
||||
echo "Nerd Font folder not found!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Function to install fonts
|
||||
install_fonts() {
|
||||
local font_files=("$@")
|
||||
|
||||
for font_file in "${font_files[@]}"; do
|
||||
if [ -f "$FONT_FOLDER/$font_file" ]; then
|
||||
echo "Installing font - $font_file"
|
||||
cp "$FONT_FOLDER/$font_file" ~/Library/Fonts/
|
||||
else
|
||||
echo "Font not found: $font_file" >&2
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Check for minimal option
|
||||
if [[ "$1" == "--minimal" ]]; then
|
||||
# Minimal installation
|
||||
MINIMAL_FONTS=(
|
||||
"IosevkaRootiestV2-Regular.ttf"
|
||||
"IosevkaRootiestV2-Italic.ttf"
|
||||
"IosevkaRootiestV2-Oblique.ttf"
|
||||
"IosevkaRootiestV2-ObliqueItalic.ttf"
|
||||
)
|
||||
|
||||
# Install minimal fonts
|
||||
install_fonts "${MINIMAL_FONTS[@]}"
|
||||
|
||||
# Install the Nerd Font
|
||||
NERD_FONT_FILE="IosevkaRootiestV2NerdFont-Regular.ttf"
|
||||
if [ -f "$NERD_FONT_FOLDER/$NERD_FONT_FILE" ]; then
|
||||
echo "Installing Nerd Font - $NERD_FONT_FILE"
|
||||
cp "$NERD_FONT_FOLDER/$NERD_FONT_FILE" ~/Library/Fonts/
|
||||
else
|
||||
echo "Nerd Font not found: $NERD_FONT_FILE" >&2
|
||||
fi
|
||||
|
||||
else
|
||||
# Full installation: List all .fon, .otf, .ttc, and .ttf files from TTF folder
|
||||
find "$FONT_FOLDER" -type f \( -name "*.fon" -o -name "*.otf" -o -name "*.ttc" -o -name "*.ttf" \) | while read -r font; do
|
||||
echo "Installing font - $(basename "$font")"
|
||||
cp "$font" ~/Library/Fonts/
|
||||
done
|
||||
|
||||
# Install all fonts from the NerdFont folder
|
||||
find "$NERD_FONT_FOLDER" -type f \( -name "*.fon" -o -name "*.otf" -o -name "*.ttc" -o -name "*.ttf" \) | while read -r nerd_font; do
|
||||
echo "Installing Nerd Font - $(basename "$nerd_font")"
|
||||
cp "$nerd_font" ~/Library/Fonts/
|
||||
done
|
||||
fi
|
||||
@@ -0,0 +1,88 @@
|
||||
|
||||
param (
|
||||
[switch]$Minimal # Add the -Minimal switch to control minimal installation
|
||||
)
|
||||
|
||||
# Get the directory where the script is located
|
||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
|
||||
# Set the font source locations (relative to the script location)
|
||||
$FontFolder = Join-Path $scriptDir "TTF"
|
||||
$NerdFontFolder = Join-Path $scriptDir "NerdFont"
|
||||
|
||||
# Check if the font folders exist
|
||||
if (-Not (Test-Path $FontFolder)) {
|
||||
Write-Host "Font folder not found!" -ForegroundColor Red
|
||||
exit
|
||||
}
|
||||
|
||||
if (-Not (Test-Path $NerdFontFolder)) {
|
||||
Write-Host "Nerd Font folder not found!" -ForegroundColor Red
|
||||
exit
|
||||
}
|
||||
|
||||
# If the -Minimal flag is provided, install only the specified minimal fonts
|
||||
if ($Minimal) {
|
||||
$MinimalFonts = @(
|
||||
"IosevkaRootiestV2-Regular.ttf",
|
||||
"IosevkaRootiestV2-Italic.ttf",
|
||||
"IosevkaRootiestV2-Oblique.ttf",
|
||||
"IosevkaRootiestV2-ObliqueItalic.ttf"
|
||||
)
|
||||
|
||||
# Install minimal fonts from the TTF folder
|
||||
foreach ($fontFile in $MinimalFonts) {
|
||||
$fontPath = Join-Path $FontFolder $fontFile
|
||||
if (Test-Path $fontPath) {
|
||||
Write-Host "Installing font -" $fontFile
|
||||
Copy-Item $fontPath "C:\Windows\Fonts"
|
||||
New-ItemProperty -Name (Get-Item $fontPath).BaseName `
|
||||
-Path "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Fonts" `
|
||||
-PropertyType string -Value $fontFile
|
||||
} else {
|
||||
Write-Host "Font not found: $fontFile" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
|
||||
# Install the nerd font from the NerdFont folder
|
||||
$nerdFontFile = "IosevkaRootiestV2NerdFont-Regular.ttf"
|
||||
$nerdFontPath = Join-Path $NerdFontFolder $nerdFontFile
|
||||
if (Test-Path $nerdFontPath) {
|
||||
Write-Host "Installing Nerd Font -" $nerdFontFile
|
||||
Copy-Item $nerdFontPath "C:\Windows\Fonts"
|
||||
New-ItemProperty -Name (Get-Item $nerdFontPath).BaseName `
|
||||
-Path "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Fonts" `
|
||||
-PropertyType string -Value $nerdFontFile
|
||||
} else {
|
||||
Write-Host "Nerd Font not found: $nerdFontFile" -ForegroundColor Red
|
||||
}
|
||||
} else {
|
||||
# Full installation: List all .fon, .otf, .ttc, and .ttf files from TTF folder
|
||||
$FontList = Get-ChildItem -Path "$FontFolder\*" `
|
||||
-Include ('*.fon', '*.otf', '*.ttc', '*.ttf') -Recurse
|
||||
|
||||
foreach ($Font in $FontList) {
|
||||
Write-Host "Installing font -" $Font.BaseName
|
||||
Copy-Item $Font "C:\Windows\Fonts"
|
||||
|
||||
# Register font for all users
|
||||
New-ItemProperty -Name $Font.BaseName `
|
||||
-Path "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Fonts" `
|
||||
-PropertyType string -Value $Font.Name
|
||||
}
|
||||
|
||||
# Install all fonts from the NerdFont folder
|
||||
$NerdFontList = Get-ChildItem -Path "$NerdFontFolder\*" `
|
||||
-Include ('*.fon', '*.otf', '*.ttc', '*.ttf') -Recurse
|
||||
|
||||
foreach ($NerdFont in $NerdFontList) {
|
||||
Write-Host "Installing Nerd Font -" $NerdFont.BaseName
|
||||
Copy-Item $NerdFont "C:\Windows\Fonts"
|
||||
|
||||
# Register nerd font for all users
|
||||
New-ItemProperty -Name $NerdFont.BaseName `
|
||||
-Path "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Fonts" `
|
||||
-PropertyType string -Value $NerdFont.Name
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user