Skip to content

Commit 961beba

Browse files
elliegreptile-apps[bot]
authored andcommitted
feat: update script for smoother setup (atuinsh#3230)
Many users do not seem to read the docs. So, make the install script handle most of the things that we include in the docs quickstart. Ensures that the install script still functions as expected in non-interactive environments - setup scripts, ci, etc. Offers a flag just in case this check fails, to force non-interactive setup. <!-- Thank you for making a PR! Bug fixes are always welcome, but if you're adding a new feature or changing an existing one, we'd really appreciate if you open an issue, post on the forum, or drop in on Discord --> ## Checks - [ ] I am happy for maintainers to push small adjustments to this PR, to speed up the review cycle - [ ] I have checked that there are no existing pull requests for the same thing --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
1 parent ed8bd60 commit 961beba

File tree

2 files changed

+95
-7
lines changed

2 files changed

+95
-7
lines changed

docs/docs/guide/installation.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@ then the manual steps below offer much more flexibility.
1616
curl --proto '=https' --tlsv1.2 -LsSf https://setup.atuin.sh | sh
1717
```
1818

19+
The install script will walk you through importing your shell history and setting
20+
up a sync account. To skip these interactive prompts (e.g. in CI or
21+
Dockerfiles), pass `--non-interactive`:
22+
23+
```shell
24+
curl --proto '=https' --tlsv1.2 -LsSf https://setup.atuin.sh | sh -s -- --non-interactive
25+
```
26+
27+
The script also automatically detects non-interactive environments (piped input,
28+
no TTY) and skips the prompts in those cases.
29+
1930
[**Set up sync** - Move on to the next step, or read on to manually install Atuin instead.](sync.md)
2031

2132
### On Windows

install.sh

Lines changed: 84 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
#! /bin/sh
22
set -eu
33

4+
ATUIN_NON_INTERACTIVE="no"
5+
6+
for arg in "$@"; do
7+
case "$arg" in
8+
--non-interactive) ATUIN_NON_INTERACTIVE="yes" ;;
9+
*) ;;
10+
esac
11+
done
12+
13+
if [ "$ATUIN_NON_INTERACTIVE" != "yes" ]; then
14+
if [ -t 0 ] || [ -c /dev/tty ]; then
15+
ATUIN_NON_INTERACTIVE="no"
16+
else
17+
ATUIN_NON_INTERACTIVE="yes"
18+
fi
19+
fi
20+
421
cat << EOF
522
_______ _______ __ __ ___ __ _
623
| _ || || | | || | | | | |
@@ -48,7 +65,7 @@ fi
4865
# shellcheck disable=SC2016
4966

5067
if ! grep -q "atuin init bash" ~/.bashrc; then
51-
curl https://raw.githubusercontent.com/rcaloras/bash-preexec/master/bash-preexec.sh -o ~/.bash-preexec.sh
68+
curl --proto '=https' --tlsv1.2 -LsSf https://raw.githubusercontent.com/rcaloras/bash-preexec/master/bash-preexec.sh -o ~/.bash-preexec.sh
5269
printf '\n[[ -f ~/.bash-preexec.sh ]] && source ~/.bash-preexec.sh\n' >> ~/.bashrc
5370
echo 'eval "$(atuin init bash)"' >> ~/.bashrc
5471
fi
@@ -69,9 +86,71 @@ end/' "$HOME/.config/fish/config.fish"
6986
fi
7087
fi
7188

72-
cat << EOF
89+
ATUIN_BIN="$HOME/.atuin/bin/atuin"
90+
91+
echo ""
92+
echo "Atuin installed successfully!"
93+
echo ""
94+
95+
if [ "$ATUIN_NON_INTERACTIVE" != "yes" ]; then
96+
97+
printf "Would you like to import your existing shell history into Atuin? [Y/n] "
98+
read -r import_answer </dev/tty || import_answer="n"
99+
import_answer="${import_answer:-y}"
100+
101+
case "$import_answer" in
102+
[yY]*)
103+
echo ""
104+
if ! "$ATUIN_BIN" import auto; then
105+
echo ""
106+
echo "History import failed. You can retry later with 'atuin import auto'."
107+
fi
108+
echo ""
109+
;;
110+
*)
111+
echo "Skipping history import. You can always run 'atuin import auto' later."
112+
echo ""
113+
;;
114+
esac
115+
116+
cat << EOF
117+
Sync your history across all your machines with Atuin Cloud:
118+
119+
- End-to-end encrypted — only you can read your data
120+
- Access your history from any device
121+
- Never lose your history, even if you wipe a machine
73122
123+
EOF
74124

125+
printf "Sign up for a sync account? [Y/n] "
126+
read -r sync_answer </dev/tty || sync_answer="n"
127+
sync_answer="${sync_answer:-y}"
128+
129+
case "$sync_answer" in
130+
[yY]*)
131+
echo ""
132+
if ! "$ATUIN_BIN" register </dev/tty; then
133+
echo ""
134+
echo "Registration did not complete. You can run 'atuin register' any time to try again."
135+
fi
136+
;;
137+
*)
138+
echo ""
139+
printf "Already have an account? Log in with 'atuin login'.\n"
140+
echo "You can also run 'atuin register' any time to create one."
141+
;;
142+
esac
143+
144+
else
145+
echo "Non-interactive environment detected — skipping setup prompts."
146+
echo "You can run the following commands manually after installation:"
147+
echo ""
148+
echo " atuin import auto Import your existing shell history"
149+
echo " atuin register Sign up for a sync account"
150+
echo " atuin login Log in to an existing sync account"
151+
fi
152+
153+
cat << EOF
75154
76155
_______ __ __ _______ __ _ ___ _ __ __ _______ __ __
77156
| || | | || _ || | | || | | | | | | || || | | |
@@ -81,17 +160,15 @@ cat << EOF
81160
| | | _ || _ || | | || _ | | | | || |
82161
|___| |__| |__||__| |__||_| |__||___| |_| |___| |_______||_______|
83162
84-
85-
86163
Thanks for installing Atuin! I really hope you like it.
87164
88165
If you have any issues, please open an issue on GitHub or visit our forum (https://forum.atuin.sh)!
89166
90167
If you love Atuin, please give us a star on GitHub! It really helps ⭐️ https://github.com/atuinsh/atuin
91168
92-
Please run "atuin register" to set up sync, or "atuin login" if you already have an account
169+
===============================================================================
93170
94-
Check out Atuin Desktop to build executable runbooks from your shell history - https://github.com/atuinsh/desktop
171+
⚠️ Please restart your shell or open a new terminal for Atuin to take effect!
95172
173+
===============================================================================
96174
EOF
97-

0 commit comments

Comments
 (0)