74 lines
1.6 KiB
Bash
74 lines
1.6 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
set -Eeuo pipefail
|
|
|
|
readonly INSTALLER_URL="https://openclaw.ai/install.sh"
|
|
readonly SCRIPT_NAME="$(basename "$0")"
|
|
|
|
show_help() {
|
|
cat <<EOF
|
|
Uso: $SCRIPT_NAME [--onboard]
|
|
|
|
Instala OpenClaw usando el instalador oficial.
|
|
|
|
Opciones:
|
|
--onboard Ejecuta el asistente inicial después de instalar.
|
|
-h, --help Muestra esta ayuda.
|
|
EOF
|
|
}
|
|
|
|
onboard=false
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--onboard)
|
|
onboard=true
|
|
shift
|
|
;;
|
|
-h|--help)
|
|
show_help
|
|
exit 0
|
|
;;
|
|
*)
|
|
printf 'Error: opción desconocida: %s\n\n' "$1" >&2
|
|
show_help >&2
|
|
exit 2
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [[ "$(uname -s)" != "Linux" ]]; then
|
|
printf 'Error: este script está pensado para Linux/WSL2.\n' >&2
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v curl >/dev/null 2>&1; then
|
|
printf 'Error: curl es obligatorio. Instálalo con: sudo apt-get update && sudo apt-get install -y curl\n' >&2
|
|
exit 1
|
|
fi
|
|
|
|
installer_file="$(mktemp)"
|
|
cleanup() {
|
|
rm -f "$installer_file"
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
printf 'Descargando el instalador oficial de OpenClaw...\n'
|
|
curl --fail --silent --show-error --location \
|
|
--proto '=https' --tlsv1.2 \
|
|
"$INSTALLER_URL" -o "$installer_file"
|
|
|
|
if [[ "$onboard" == true ]]; then
|
|
bash "$installer_file"
|
|
else
|
|
bash "$installer_file" --no-onboard
|
|
fi
|
|
|
|
printf '\nOpenClaw se ha instalado. Comprueba la instalación con:\n'
|
|
printf ' openclaw --version\n'
|
|
printf ' openclaw doctor\n'
|
|
|
|
if [[ "$onboard" == false ]]; then
|
|
printf '\nPara configurar OpenClaw más adelante, ejecuta:\n'
|
|
printf ' openclaw onboard --install-daemon\n'
|
|
fi |