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