Devbox, Zsh (Fedora)

Install Zsh, Fonts, Browsers, vscode, sublime text, Devbox#

Install Fonts#

#!/usr/bin/env bash
set -euo pipefail

# Fedora용 폰트 설치 스크립트
# - MesloLGS NF Regular/Bold
# - D2Coding

FONT_DIR="$HOME/.local/share/fonts"
D2CODING_ZIP_URL="https://github.com/naver/d2codingfont/releases/download/VER1.3.2/D2Coding-Ver1.3.2-20180524.zip"

cleanup() {
    if [ -n "${TEMP_DIR:-}" ] && [ -d "$TEMP_DIR" ]; then
        rm -rf "$TEMP_DIR"
    fi
}
trap cleanup EXIT

echo "🔄 Fedora 패키지 업데이트 및 폰트 설치에 필요한 패키지 설치 중..."
sudo dnf upgrade --refresh -y
sudo dnf install -y curl unzip fontconfig

echo "📂 폰트 디렉터리 준비 중: $FONT_DIR"
mkdir -p "$FONT_DIR"

echo "📂 MesloLGS NF 폰트 설치 중..."
urls=(
    "https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf"
    "https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf"
)

for url in "${urls[@]}"; do
    file="$(basename "$url" | sed 's/%20/ /g')"
    target="$FONT_DIR/$file"

    if [ -f "$target" ]; then
        echo "✅ 이미 설치됨: $file"
    else
        echo "⬇️  다운로드 중: $file"
        curl -fL "$url" -o "$target"
    fi
done

echo "📂 D2Coding 폰트 설치 중..."
D2CODING_FILE="$FONT_DIR/D2Coding-Ver1.3.2-20180524-all.ttc"

if [ -f "$D2CODING_FILE" ]; then
    echo "✅ 이미 설치됨: $(basename "$D2CODING_FILE")"
else
    TEMP_DIR="$(mktemp -d)"
    curl -fL "$D2CODING_ZIP_URL" -o "$TEMP_DIR/d2coding.zip"
    unzip -q "$TEMP_DIR/d2coding.zip" -d "$TEMP_DIR"

    D2CODING_SOURCE="$(find "$TEMP_DIR" -type f -name 'D2Coding-Ver1.3.2-20180524-all.ttc' -print -quit)"

    if [ -z "$D2CODING_SOURCE" ]; then
        echo "❌ D2Coding 폰트 파일을 찾지 못했습니다. zip 파일 구조가 변경되었을 수 있습니다." >&2
        echo "압축 해제 위치: $TEMP_DIR" >&2
        exit 1
    fi

    cp "$D2CODING_SOURCE" "$FONT_DIR/"
fi

echo "🔄 폰트 캐시 갱신 중..."
fc-cache -fv "$FONT_DIR"

echo "-------------------------------------------------------"
echo "✅ 폰트 설치 완료!"
echo "추천 폰트: D2Coding 또는 MesloLGS NF"
echo "터미널/Konsole 설정에서 원하는 폰트로 변경하세요."
echo "-------------------------------------------------------"

Install Zsh#

#!/usr/bin/env bash
set -euo pipefail

# Fedora용 Zsh + Oh My Zsh + Powerlevel10k 설치 스크립트

ZSH_BIN="$(command -v zsh || true)"

echo "🔄 Fedora 패키지 업데이트 및 Zsh 설치에 필요한 패키지 설치 중..."
sudo dnf upgrade --refresh -y
sudo dnf install -y git curl zsh util-linux-user

ZSH_BIN="$(command -v zsh)"

if [ ! -d "$HOME/.oh-my-zsh" ]; then
    echo "📦 Oh My Zsh 설치 중..."
    RUNZSH=no CHSH=no sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
else
    echo "✅ Oh My Zsh가 이미 설치되어 있습니다."
fi

if [ ! -f "$HOME/.zshrc" ]; then
    echo "📝 .zshrc 초기 파일 생성 중..."
    cp "$HOME/.oh-my-zsh/templates/zshrc.zsh-template" "$HOME/.zshrc"
fi

ZSH_CUSTOM="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}"
mkdir -p "$ZSH_CUSTOM/themes" "$ZSH_CUSTOM/plugins"

echo "📂 Powerlevel10k 테마 및 Zsh 플러그인 설치 중..."

if [ ! -d "$ZSH_CUSTOM/themes/powerlevel10k" ]; then
    git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "$ZSH_CUSTOM/themes/powerlevel10k"
else
    echo "✅ Powerlevel10k가 이미 설치되어 있습니다."
fi

if [ ! -d "$ZSH_CUSTOM/plugins/zsh-autosuggestions" ]; then
    git clone https://github.com/zsh-users/zsh-autosuggestions "$ZSH_CUSTOM/plugins/zsh-autosuggestions"
else
    echo "✅ zsh-autosuggestions가 이미 설치되어 있습니다."
fi

if [ ! -d "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting" ]; then
    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting"
else
    echo "✅ zsh-syntax-highlighting이 이미 설치되어 있습니다."
fi

echo "📝 .zshrc 설정 업데이트 중..."

if grep -q '^ZSH_THEME=' "$HOME/.zshrc"; then
    sed -i 's|^ZSH_THEME=.*|ZSH_THEME="powerlevel10k/powerlevel10k"|' "$HOME/.zshrc"
else
    echo 'ZSH_THEME="powerlevel10k/powerlevel10k"' >> "$HOME/.zshrc"
fi

if grep -q '^plugins=' "$HOME/.zshrc"; then
    sed -i 's|^plugins=.*|plugins=(git zsh-autosuggestions zsh-syntax-highlighting)|' "$HOME/.zshrc"
else
    echo 'plugins=(git zsh-autosuggestions zsh-syntax-highlighting)' >> "$HOME/.zshrc"
fi

if [ "${SHELL:-}" != "$ZSH_BIN" ]; then
    echo "🐚 기본 쉘을 Zsh로 변경합니다: $ZSH_BIN"
    sudo chsh -s "$ZSH_BIN" "$USER"
else
    echo "✅ 기본 쉘이 이미 Zsh입니다."
fi

echo "-------------------------------------------------------"
echo "✅ Zsh 설치 완료!"
echo "터미널을 재시작하거나 아래 명령어를 실행하세요:"
echo "exec zsh -l"
echo "-------------------------------------------------------"

Install Edge, Chrome, VSCode, Sublime Text#

#!/usr/bin/env bash
# Fedora: Google Chrome, Microsoft Edge Stable, Sublime Text 설치 스크립트
# 실행: chmod +x install_my_tools.sh && ./install_my_tools.sh
set -Eeuo pipefail

if [[ $EUID -eq 0 ]]; then
  echo '이 스크립트는 일반 사용자로 실행하세요. 필요한 명령에서만 sudo를 요청합니다.' >&2
  exit 1
fi

if [[ -r /etc/os-release ]]; then
  . /etc/os-release
fi
if [[ ${ID:-} != fedora ]]; then
  echo "경고: Fedora에서 작성된 스크립트입니다. 현재 ID=${ID:-unknown}" >&2
  read -r -p '그래도 계속할까요? [y/N] ' answer
  [[ $answer =~ ^[Yy]$ ]] || exit 0
fi

arch=$(rpm -E '%_arch')
if [[ $arch != x86_64 ]]; then
  echo "지원하지 않는 아키텍처입니다: $arch (현재 스크립트는 x86_64용 Chrome/Edge RPM을 사용합니다.)" >&2
  exit 1
fi

need_cmd() { command -v "$1" >/dev/null 2>&1 || { echo "필수 명령이 없습니다: $1" >&2; exit 1; }; }
need_cmd dnf
need_cmd rpm
need_cmd curl

cleanup() {
  [[ -n ${tmpdir:-} && -d ${tmpdir:-} ]] && rm -rf "$tmpdir"
}
trap cleanup EXIT

tmpdir=$(mktemp -d)

echo '==> DNF 플러그인 및 메타데이터 준비'
sudo dnf install -y dnf-plugins-core
sudo dnf makecache --refresh

echo '==> Google Chrome Stable 설치'
sudo dnf install -y https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm

echo '==> Microsoft Edge Stable 저장소 등록 및 설치'
curl --fail --location --silent --show-error \
  https://packages.microsoft.com/yumrepos/edge/config.repo \
  -o "$tmpdir/microsoft-edge.repo"
sudo install -m 0644 "$tmpdir/microsoft-edge.repo" /etc/yum.repos.d/microsoft-edge.repo
sudo dnf install -y microsoft-edge-stable

echo '==> Visual Studio Code 저장소 등록 및 설치'
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
curl --fail --location --silent --show-error \
  https://packages.microsoft.com/yumrepos/vscode/config.repo \
  -o "$tmpdir/vscode.repo"
sudo install -m 0644 "$tmpdir/vscode.repo" /etc/yum.repos.d/vscode.repo
sudo dnf install -y code

echo '==> Sublime Text Stable 저장소 등록 및 설치'
sudo rpm --import https://download.sublimetext.com/sublimehq-rpm-pub.gpg
curl --fail --location --silent --show-error \
  https://download.sublimetext.com/rpm/stable/x86_64/sublime-text.repo \
  -o "$tmpdir/sublime-text.repo"
sudo install -m 0644 "$tmpdir/sublime-text.repo" /etc/yum.repos.d/sublime-text.repo
sudo dnf install -y sublime-text

echo
echo '설치 완료:'
rpm -q google-chrome-stable microsoft-edge-stable code sublime-text
cat <<'MSG'

실행 명령:
  google-chrome-stable
  microsoft-edge
  code
  subl

이후 업데이트:
  sudo dnf upgrade --refresh
MSG

Install Devbox#

#!/usr/bin/env bash
set -euo pipefail

# Fedora용 Devbox + direnv 설치 스크립트

# 1. 쉘 감지 로직
# 스크립트 자체는 bash로 실행되므로 BASH_VERSION/ZSH_VERSION은 사용하지 않습니다.
# zsh 프롬프트에서 실행한 경우 부모 프로세스가 zsh이므로 부모 쉘을 우선 확인합니다.
PARENT_SHELL="$(ps -p "${PPID:-$$}" -o comm= | sed 's/^-//')"
LOGIN_SHELL="$(basename "${SHELL:-}")"
DETECTED_SHELL="${PARENT_SHELL:-$LOGIN_SHELL}"

case "$DETECTED_SHELL" in
    zsh)
        CURRENT_SHELL="zsh"
        CONF_FILE="$HOME/.zshrc"
        ;;
    bash)
        CURRENT_SHELL="bash"
        CONF_FILE="$HOME/.bashrc"
        ;;
    *)
        case "$LOGIN_SHELL" in
            zsh)
                CURRENT_SHELL="zsh"
                CONF_FILE="$HOME/.zshrc"
                ;;
            bash)
                CURRENT_SHELL="bash"
                CONF_FILE="$HOME/.bashrc"
                ;;
            *)
                echo "⚠️ 지원 여부를 알 수 없는 쉘입니다: ${DETECTED_SHELL:-$LOGIN_SHELL}"
                echo "bash 설정 파일을 사용합니다: $HOME/.bashrc"
                CURRENT_SHELL="bash"
                CONF_FILE="$HOME/.bashrc"
                ;;
        esac
        ;;
esac

echo "🔍 감지된 쉘: $CURRENT_SHELL (설정 파일: $CONF_FILE)"

# 2. 필수 시스템 패키지 업데이트 및 direnv 설치
echo "📦 Fedora 패키지 업데이트 및 direnv 설치 중..."
sudo dnf upgrade --refresh -y
sudo dnf install -y direnv curl git

# 3. Devbox 설치
if ! command -v devbox >/dev/null 2>&1; then
    echo "📦 Devbox 설치를 시작합니다..."
    curl -fsSL https://get.jetpack.io/devbox | bash
else
    echo "✅ Devbox가 이미 설치되어 있습니다."
fi

# 4. 쉘 설정 파일(.zshrc 또는 .bashrc) 업데이트
touch "$CONF_FILE"

echo "📝 $CONF_FILE 설정 업데이트 중..."

# Devbox global shellenv 추가 (중복 체크)
if ! grep -q 'devbox global shellenv' "$CONF_FILE"; then
    {
        echo ''
        echo '# Devbox configuration'
        echo 'eval "$(devbox global shellenv)"'
    } >> "$CONF_FILE"
    echo "✅ Devbox 환경 변수 설정 완료"
else
    echo "✅ Devbox 환경 변수 설정이 이미 존재합니다."
fi

# direnv hook 추가 (중복 체크)
if ! grep -q "direnv hook $CURRENT_SHELL" "$CONF_FILE"; then
    {
        echo ''
        echo '# Direnv configuration'
        echo "eval \"\$(direnv hook $CURRENT_SHELL)\""
    } >> "$CONF_FILE"
    echo "✅ direnv hook 설정 완료"
else
    echo "✅ direnv hook 설정이 이미 존재합니다."
fi

echo "------------------------------------------------"
echo "✨ Devbox 및 direnv 설치와 설정이 완료되었습니다!"
echo "터미널을 재시작하거나 아래 명령어를 입력하세요:"
echo "source $CONF_FILE"
echo "------------------------------------------------"

Scripts#

zsh-fonts-browsers-vscode-sublime.zip