#!/bin/sh
set -e

if [ "${1:-}" = "configure" ]; then
  SRC_DIR="/usr/share/saikyo-os/ca-certificates/saikyo"
  DST_DIR="/usr/local/share/ca-certificates/saikyo"

  if [ -d "${SRC_DIR}" ]; then
    mkdir -p "${DST_DIR}" 2>/dev/null || true
    cp -f "${SRC_DIR}"/*.crt "${DST_DIR}/" 2>/dev/null || true
  fi

  if command -v update-ca-certificates >/dev/null 2>&1; then
    update-ca-certificates >/dev/null 2>&1 || true
  fi
fi

exit 0
