Add easier support for installing in offline mode

This commit is contained in:
David Dworken 2023-12-21 19:03:21 -08:00
parent 01725388a6
commit ddc73230d8
No known key found for this signature in database
2 changed files with 10 additions and 3 deletions

View File

@ -142,9 +142,13 @@ hishtory config-set filter-duplicate-commands true
<details>
<summary>Offline Install Without Syncing</summary><blockquote>
If you don't need the ability to sync your shell history, you can install hiSHtory in offline mode.
If you don't need the ability to sync your shell history, you can install hiSHtory in offline mode:
Download the latest binary from [Github Releases](https://github.com/ddworken/hishtory/releases), and then run `./hishtory-binary install --offline` to install hiSHtory in a fully offline mode. This disables syncing and it is not possible to re-enable syncing after doing this.
```
curl https://hishtory.dev/install.py | HISHTORY_OFFLINE=true python3 -
```
This disables syncing and it is not possible to re-enable syncing after doing this.
</blockquote></details>

View File

@ -38,7 +38,10 @@ if os.path.exists(tmpFilePath):
with open(tmpFilePath, 'wb') as f:
f.write(hishtory_binary)
os.system('chmod +x ' + tmpFilePath)
exitCode = os.system(tmpFilePath + ' install')
cmd = tmpFilePath + ' install'
if os.environ.get('HISHTORY_OFFLINE'):
cmd += " --offline"
exitCode = os.system(cmd)
if exitCode != 0:
raise Exception("failed to install downloaded hishtory client via `" + tmpFilePath +" install` (is that directory mounted noexec? Consider setting an alternate directory via the TMPDIR environment variable)!")
print('Succesfully installed hishtory! Open a new terminal, try running a command, and then running `hishtory query`.')