install.sh: replace Unicode chars with ASCII (fixes ambiguous character warning)

This commit is contained in:
Claus Lohmar 2026-04-23 20:08:58 +00:00
parent 01a58156a1
commit 6a6177c8fe

View file

@ -10,7 +10,7 @@
#
set -euo pipefail
# ─── Configuration ───────────────────────────────────────────────────────────
# --- Configuration -----------------------------------------------------------
INSTALL_DIR="/opt/inboxer"
SERVICE_USER="inboxer"
SERVICE_GROUP="inboxer"
@ -29,7 +29,7 @@ else
REPO_DIR="${SCRIPT_DIR}"
fi
# ─── Terminal colours ────────────────────────────────────────────────────────
# --- Terminal colours --------------------------------------------------------
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
@ -39,7 +39,7 @@ info() { echo -e "${GREEN}[INFO]${NC} $*"; }
warn() { echo -e "${YELLOW}[WARN]${NC} $*"; }
error() { echo -e "${RED}[ERROR]${NC} $*" >&2; }
# ─── Pre-flight checks ───────────────────────────────────────────────────────
# --- Pre-flight checks -------------------------------------------------------
if [[ $EUID -ne 0 ]]; then
error "This script must be run as root (use sudo)."
exit 1
@ -63,7 +63,7 @@ for f in "${REQUIRED_FILES[@]}"; do
fi
done
# ─── OS Detection (informational) ───────────────────────────────────────────
# --- OS Detection (informational) -------------------------------------------
if [[ -f /etc/os-release ]]; then
# shellcheck source=/dev/null
. /etc/os-release
@ -72,7 +72,7 @@ else
info "Could not detect OS version (no /etc/os-release)."
fi
# ─── Create system user & group ──────────────────────────────────────────────
# --- Create system user & group ----------------------------------------------
info "Creating system user '${SERVICE_USER}'..."
if getent group "${SERVICE_GROUP}" &>/dev/null; then
@ -94,11 +94,11 @@ else
info "User '${SERVICE_USER}' created."
fi
# ─── Create directory structure ──────────────────────────────────────────────
# --- Create directory structure ----------------------------------------------
info "Creating directories under ${INSTALL_DIR}..."
mkdir -p "${BIN_DIR}" "${DATA_DIR}" "${LOGS_DIR}"
# ─── Install binary & config files ───────────────────────────────────────────
# --- Install binary & config files -------------------------------------------
info "Installing binary..."
install -m 755 "${REPO_DIR}/bin/inboxer" "${BIN_DIR}/inboxer"
@ -113,11 +113,11 @@ sed -i 's|file: "bin/inboxer.log"|file: "'"${LOGS_DIR}"'/inboxer.log"|' "${BIN_D
# prompt_file: "bin/prompt.txt" works as-is relative to the working directory,
# since WorkingDirectory=/opt/inboxer resolves it to /opt/inboxer/bin/prompt.txt
# ─── Create systemd service unit ─────────────────────────────────────────────
# --- Create systemd service unit ---------------------------------------------
info "Creating systemd service unit at ${SERVICE_FILE} ..."
cat > "${SERVICE_FILE}" << UNITEOF
[Unit]
Description=inBOXER AI-Powered Email Classifier
Description=inBOXER - AI-Powered Email Classifier
Documentation=https://github.com/cclohmar/inboxer
After=network-online.target
Wants=network-online.target
@ -145,7 +145,7 @@ PrivateTmp=true
WantedBy=multi-user.target
UNITEOF
# ─── Set file permissions ────────────────────────────────────────────────────
# --- Set file permissions ----------------------------------------------------
info "Setting file ownership and permissions..."
chown -R "${SERVICE_USER}:${SERVICE_GROUP}" "${INSTALL_DIR}"
@ -157,7 +157,7 @@ chmod 750 "${LOGS_DIR}"
# config.yaml contains secrets so restrict access
chmod 640 "${BIN_DIR}/config.yaml"
# ─── Register & start service ───────────────────────────────────────────────
# --- Register & start service -----------------------------------------------
info "Reloading systemd daemon..."
systemctl daemon-reload
@ -170,7 +170,7 @@ systemctl start "${SERVICE_NAME}"
# Brief pause so the service can initialise
sleep 2
# ─── Verify ──────────────────────────────────────────────────────────────────
# --- Verify ------------------------------------------------------------------
if systemctl is-active --quiet "${SERVICE_NAME}"; then
info "Service '${SERVICE_NAME}' is running."
systemctl status "${SERVICE_NAME}" --no-pager
@ -180,11 +180,11 @@ else
systemctl status "${SERVICE_NAME}" --no-pager || true
fi
# ─── Summary ─────────────────────────────────────────────────────────────────
# --- Summary -----------------------------------------------------------------
echo ""
info "═════════════════════════════════════════════════"
info "================================================="
info " inBOXER Installation Complete"
info "═════════════════════════════════════════════════"
info "================================================="
echo ""
info " Install directory: ${INSTALL_DIR}"
info " Binary: ${BIN_DIR}/inboxer"
@ -193,7 +193,7 @@ info " Prompt file: ${BIN_DIR}/prompt.txt"
info " Data (SQLite): ${DATA_DIR}/"
info " Logs: ${LOGS_DIR}/"
echo ""
info " Edit config.yaml with your credentials before first start:"
info " * Edit config.yaml with your credentials before first start:"
info " sudo nano ${BIN_DIR}/config.yaml"
info ""
info " Required settings:"
@ -204,7 +204,7 @@ info " - smtp.password (SMTP password)"
info " - server.session_secret (change from the default)"
echo ""
if grep -q "your_deepseek_api_key_here\|your.smtp.host\|change-me-in-production" "${BIN_DIR}/config.yaml" 2>/dev/null; then
warn " config.yaml still contains placeholder values!"
warn " ! config.yaml still contains placeholder values!"
warn " Edit ${BIN_DIR}/config.yaml before the service will function."
echo ""
fi
@ -215,5 +215,5 @@ info " sudo systemctl stop ${SERVICE_NAME}"
info " sudo journalctl -u ${SERVICE_NAME} -f"
echo ""
info " Web interface: http://$(hostname -s 2>/dev/null || echo "localhost"):8080"
info "═════════════════════════════════════════════════"
info "================================================="
echo ""