mirror of
https://github.com/ddworken/hishtory.git
synced 2025-02-23 22:11:13 +01:00
Add an easy to use cross-platform install script for that classic curl | bash goodness
This commit is contained in:
parent
1528e9817e
commit
6c9236785a
11
README.md
11
README.md
@ -9,10 +9,7 @@
|
|||||||
To install `hishtory` on your first machine:
|
To install `hishtory` on your first machine:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -L -o hishtory https://api.hishtory.dev/download/hishtory-linux-amd64
|
curl https://hishtory.dev/install.py | python3 -
|
||||||
# Optional: Verify the binarie's SLSA L3 attestations from https://api.hishtory.dev/download/hishtory-linux-amd64.intoto.jsonl
|
|
||||||
chmod +x hishtory
|
|
||||||
./hishtory install
|
|
||||||
```
|
```
|
||||||
|
|
||||||
At this point, `hishtory` is already persisting your shell history. Give it a try with `hishtory query` and see below for more details on the advanced query features.
|
At this point, `hishtory` is already persisting your shell history. Give it a try with `hishtory query` and see below for more details on the advanced query features.
|
||||||
@ -20,10 +17,8 @@ At this point, `hishtory` is already persisting your shell history. Give it a tr
|
|||||||
Then to install `hishtory` on your other computers, you need your secret key. Get this by running `hishtory status`. Once you have it, you follow similar steps to install hishtory on your other computers:
|
Then to install `hishtory` on your other computers, you need your secret key. Get this by running `hishtory status`. Once you have it, you follow similar steps to install hishtory on your other computers:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -L -o hishtory https://api.hishtory.dev/download/hishtory-linux-amd64
|
curl https://hishtory.dev/install.py | python3 -
|
||||||
# Optional: Verify the binarie's SLSA L3 attestations from https://api.hishtory.dev/download/hishtory-linux-amd64.intoto.jsonl
|
hishtory init $YOUR_HISHTORY_SECRET
|
||||||
chmod +x hishtory
|
|
||||||
./hishtory install $SECRET_KEY
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Now if you run `hishtory query` on first computer, you can automatically see the commands you've run on all your other computers!
|
Now if you run `hishtory query` on first computer, you can automatically see the commands you've run on all your other computers!
|
||||||
|
@ -102,17 +102,14 @@
|
|||||||
<div class="tab-pane active" id="install-first" role="tabpanel" aria-labelledby="home-tab">
|
<div class="tab-pane active" id="install-first" role="tabpanel" aria-labelledby="home-tab">
|
||||||
<br>
|
<br>
|
||||||
To install hishtory on your first machine:<br>
|
To install hishtory on your first machine:<br>
|
||||||
<code> curl -L -o hishtory https://api.hishtory.dev/download/hishtory-linux-amd64<br>
|
<code> curl https://hishtory.dev/install | python3 -<br></code>
|
||||||
chmod +x hishtory<br>
|
|
||||||
./hishtory install</code>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane" id="install-second" role="tabpanel" aria-labelledby="profile-tab">
|
<div class="tab-pane" id="install-second" role="tabpanel" aria-labelledby="profile-tab">
|
||||||
<br>
|
<br>
|
||||||
To install hishtory on your second machine, you must first retrieve your secret key from first first machine. To do so, run
|
To install hishtory on your second machine, you must first retrieve your secret key from first first machine. To do so, run
|
||||||
<code>hishtory status</code> and copy your "Secret Key". Then to install it on your second machine:<br>
|
<code>hishtory status</code> and copy your "Secret Key". Then to install it on your second machine:<br>
|
||||||
<code> curl -L -o hishtory https://api.hishtory.dev/download/hishtory-linux-amd64<br>
|
<code> curl https://hishtory.dev/install | python3 -<br>
|
||||||
chmod +x hishtory<br>
|
hishtory init $YOUR_HISHTORY_SECRET</code>
|
||||||
./hishtory install $YOUR_HISHTORY_SECRET</code>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div><br>
|
</div><br>
|
||||||
|
33
backend/web/landing/www/install.py
Normal file
33
backend/web/landing/www/install.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
"""
|
||||||
|
A small install script to download the correct hishtory binary for the current OS/architecture.
|
||||||
|
The hishtory binary is in charge of installing itself, this just downloads the correct binary and
|
||||||
|
executes it.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import json
|
||||||
|
import urllib.request
|
||||||
|
import platform
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
with urllib.request.urlopen('https://api.hishtory.dev/api/v1/download') as response:
|
||||||
|
resp_body = response.read()
|
||||||
|
download_options = json.loads(resp_body)
|
||||||
|
|
||||||
|
if platform.system() == 'Linux':
|
||||||
|
download_url = download_options['linux_amd_64_url']
|
||||||
|
elif platform.system() == 'Darwin' and platform.machine() == 'arm64':
|
||||||
|
download_url = download_options['darwin_arm_64_url']
|
||||||
|
elif platform.system() == 'Darwin' and platform.machine() == 'x86_64':
|
||||||
|
download_url = download_options['darwin_amd_64_url']
|
||||||
|
else:
|
||||||
|
print(f"No hishtory binary for system={platform.system()}, machine={platform.machine()}!\nIf you believe this is a mistake, please open an issue here: https://github.com/ddworken/hishtory/issues")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
with urllib.request.urlopen(download_url) as response:
|
||||||
|
hishtory_binary = response.read()
|
||||||
|
with open('/tmp/hishtory-client', 'wb') as f:
|
||||||
|
f.write(hishtory_binary)
|
||||||
|
os.system('chmod +x /tmp/hishtory-client')
|
||||||
|
os.system('/tmp/hishtory-client install')
|
||||||
|
print('Succesfully installed hishtory! Try running a command and then running `hishtory query`.')
|
Loading…
Reference in New Issue
Block a user