fix: Linux/Ubuntu compatibility for shell configs and dotfiles manager

00_env.sh:
  - yaml2json: use python3 (python3 first, python fallback) — Ubuntu 20+ has no 'python'
  - pyenv init: moved out of Darwin-only block; now runs everywhere if pyenv installed
  - xterm ls alias: split by OS — Linux gets 'ls --color=auto', macOS gets 'ls -G'

10_aliases.sh:
  - psg: guard with 'command -v pstree' (not installed by default on Ubuntu)
  - ps-m: Linux-only (--sort flag is GNU ps, not available on macOS)
  - gitresetpw: OS-conditional — osxkeychain on Darwin, store on Linux

dotfiles_manager.sh:
  - Replace both hardcoded 'brew install gnupg' die messages with _require_gpg()
    helper that gives apt-get hint on Linux and brew hint on macOS
This commit is contained in:
Kenji Morishige
2026-02-23 13:33:28 -06:00
parent 32be384c0e
commit 522b004632
3 changed files with 40 additions and 15 deletions

View File

@@ -129,6 +129,15 @@ _authed_url() {
fi
}
# Check gpg is installed with OS-appropriate install hint
_require_gpg() {
command -v gpg &>/dev/null && return 0
case "$(uname -s)" in
Darwin*) die "gpg not installed. Install with: brew install gnupg" ;;
*) die "gpg not installed. Install with: sudo apt-get install gnupg" ;;
esac
}
# -----------------------------------------------------------------------
# COMMAND: init
# -----------------------------------------------------------------------
@@ -692,7 +701,7 @@ SSH_CONFIG
# -----------------------------------------------------------------------
cmd_ssh_export() {
bold "=== Export SSH Private Keys (GPG-encrypted) ==="
command -v gpg &>/dev/null || die "gpg not installed. Install with: brew install gnupg"
_require_gpg
local dotfiles_ssh="$DOTFILES_DIR/.ssh/keys"
mkdir -p "$dotfiles_ssh"
@@ -752,7 +761,7 @@ cmd_ssh_export() {
# -----------------------------------------------------------------------
cmd_ssh_import() {
bold "=== Import SSH Private Keys (GPG decrypt) ==="
command -v gpg &>/dev/null || die "gpg not installed. Install with: brew install gnupg"
_require_gpg
local dotfiles_ssh="$DOTFILES_DIR/.ssh/keys"
local gpg_keys=()