Files
coredesktop/claude.sh
T
davidandClaude Opus 5.5 d9da8208dd Add shellcheck lint and bats tests
make lint runs shellcheck on every tracked bash script, make test runs
the bats suite in tests/, and make check runs both. The tests cover the
update orchestrator (hook isolation, failure reporting, pull and
free-space handling) and utils.sh (migrations, package install and
removal, services, initramfs build check), using stub commands so they
never touch the real system.

Fixes from the first lint run: 20-aur.sh stops if a cd fails rather
than building or deleting in the wrong directory, and
80-gnome-extensions.sh refuses to rm -rf with an empty path. The rest
are false positives, silenced in .shellcheckrc or per line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 16:15:12 -06:00

62 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
#
# Purpose : Install Claude Code using the official native installer
set -euo pipefail
# Check if Claude Code is already installed
if command -v claude &>/dev/null; then
echo "Claude Code is already installed: $(claude --version)"
else
echo "Installing Claude Code..."
curl -fsSL https://claude.ai/install.sh | bash
fi
# The native installer places the binary in ~/.local/bin
LINE='export PATH="$HOME/.local/bin:$PATH"'
if grep -qF "$LINE" ~/.bashrc; then
echo "\~/.local/bin already on PATH in .bashrc"
else
echo "$LINE" >> ~/.bashrc
echo "\~/.local/bin added to PATH in .bashrc"
fi
# Desktop notifications via notify-send (libnotify)
SETTINGS_FILE="$HOME/.claude/settings.json"
if [ -f "$SETTINGS_FILE" ]; then
echo "Claude Code settings already exist at $SETTINGS_FILE"
else
echo "Writing Claude Code settings to $SETTINGS_FILE..."
mkdir -p "$(dirname "$SETTINGS_FILE")"
cat > "$SETTINGS_FILE" <<'EOF'
{
"hooks": {
"Notification": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "notify-send 'Claude Code' 'Needs your input'"
}
]
}
],
"Stop": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "notify-send 'Claude Code' 'Task completed'"
}
]
}
]
}
}
EOF
fi
echo "Done. Run 'claude' to log in and get started."