aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/docs/guide/installation.md11
-rwxr-xr-xinstall.sh91
2 files changed, 95 insertions, 7 deletions
diff --git a/docs/docs/guide/installation.md b/docs/docs/guide/installation.md
index aeb33518..193b9ffa 100644
--- a/docs/docs/guide/installation.md
+++ b/docs/docs/guide/installation.md
@@ -16,6 +16,17 @@ then the manual steps below offer much more flexibility.
curl --proto '=https' --tlsv1.2 -LsSf https://setup.atuin.sh | sh
```
+The install script will walk you through importing your shell history and setting
+up a sync account. To skip these interactive prompts (e.g. in CI or
+Dockerfiles), pass `--non-interactive`:
+
+```shell
+curl --proto '=https' --tlsv1.2 -LsSf https://setup.atuin.sh | sh -s -- --non-interactive
+```
+
+The script also automatically detects non-interactive environments (piped input,
+no TTY) and skips the prompts in those cases.
+
[**Set up sync** - Move on to the next step, or read on to manually install Atuin instead.](sync.md)
### On Windows
diff --git a/install.sh b/install.sh
index 2372d23f..7962f2b5 100755
--- a/install.sh
+++ b/install.sh
@@ -1,6 +1,23 @@
#! /bin/sh
set -eu
+ATUIN_NON_INTERACTIVE="no"
+
+for arg in "$@"; do
+ case "$arg" in
+ --non-interactive) ATUIN_NON_INTERACTIVE="yes" ;;
+ *) ;;
+ esac
+done
+
+if [ "$ATUIN_NON_INTERACTIVE" != "yes" ]; then
+ if [ -t 0 ] || [ -c /dev/tty ]; then
+ ATUIN_NON_INTERACTIVE="no"
+ else
+ ATUIN_NON_INTERACTIVE="yes"
+ fi
+fi
+
cat << EOF
_______ _______ __ __ ___ __ _
| _ || || | | || | | | | |
@@ -48,7 +65,7 @@ fi
# shellcheck disable=SC2016
if ! grep -q "atuin init bash" ~/.bashrc; then
- curl https://raw.githubusercontent.com/rcaloras/bash-preexec/master/bash-preexec.sh -o ~/.bash-preexec.sh
+ curl --proto '=https' --tlsv1.2 -LsSf https://raw.githubusercontent.com/rcaloras/bash-preexec/master/bash-preexec.sh -o ~/.bash-preexec.sh
printf '\n[[ -f ~/.bash-preexec.sh ]] && source ~/.bash-preexec.sh\n' >> ~/.bashrc
echo 'eval "$(atuin init bash)"' >> ~/.bashrc
fi
@@ -69,9 +86,71 @@ end/' "$HOME/.config/fish/config.fish"
fi
fi
-cat << EOF
+ATUIN_BIN="$HOME/.atuin/bin/atuin"
+
+echo ""
+echo "Atuin installed successfully!"
+echo ""
+
+if [ "$ATUIN_NON_INTERACTIVE" != "yes" ]; then
+
+ printf "Would you like to import your existing shell history into Atuin? [Y/n] "
+ read -r import_answer </dev/tty || import_answer="n"
+ import_answer="${import_answer:-y}"
+
+ case "$import_answer" in
+ [yY]*)
+ echo ""
+ if ! "$ATUIN_BIN" import auto; then
+ echo ""
+ echo "History import failed. You can retry later with 'atuin import auto'."
+ fi
+ echo ""
+ ;;
+ *)
+ echo "Skipping history import. You can always run 'atuin import auto' later."
+ echo ""
+ ;;
+ esac
+
+ cat << EOF
+Sync your history across all your machines with Atuin Cloud:
+
+ - End-to-end encrypted — only you can read your data
+ - Access your history from any device
+ - Never lose your history, even if you wipe a machine
+EOF
+
+ printf "Sign up for a sync account? [Y/n] "
+ read -r sync_answer </dev/tty || sync_answer="n"
+ sync_answer="${sync_answer:-y}"
+
+ case "$sync_answer" in
+ [yY]*)
+ echo ""
+ if ! "$ATUIN_BIN" register </dev/tty; then
+ echo ""
+ echo "Registration did not complete. You can run 'atuin register' any time to try again."
+ fi
+ ;;
+ *)
+ echo ""
+ printf "Already have an account? Log in with 'atuin login'.\n"
+ echo "You can also run 'atuin register' any time to create one."
+ ;;
+ esac
+else
+ echo "Non-interactive environment detected — skipping setup prompts."
+ echo "You can run the following commands manually after installation:"
+ echo ""
+ echo " atuin import auto Import your existing shell history"
+ echo " atuin register Sign up for a sync account"
+ echo " atuin login Log in to an existing sync account"
+fi
+
+cat << EOF
_______ __ __ _______ __ _ ___ _ __ __ _______ __ __
| || | | || _ || | | || | | | | | | || || | | |
@@ -81,17 +160,15 @@ cat << EOF
| | | _ || _ || | | || _ | | | | || |
|___| |__| |__||__| |__||_| |__||___| |_| |___| |_______||_______|
-
-
Thanks for installing Atuin! I really hope you like it.
If you have any issues, please open an issue on GitHub or visit our forum (https://forum.atuin.sh)!
If you love Atuin, please give us a star on GitHub! It really helps ⭐️ https://github.com/atuinsh/atuin
-Please run "atuin register" to set up sync, or "atuin login" if you already have an account
+===============================================================================
-Check out Atuin Desktop to build executable runbooks from your shell history - https://github.com/atuinsh/desktop
+ ⚠️ Please restart your shell or open a new terminal for Atuin to take effect!
+===============================================================================
EOF
-