mirror of
https://github.com/nchevsky/systemrescue-zfs.git
synced 2026-04-18 04:33:41 +00:00
Merge branch 'bash_history' into 'main'
support configuring the content of the bash_history in the YAML config See merge request systemrescue/systemrescue-sources!250
This commit is contained in:
commit
f84d4aa6a1
3 changed files with 25 additions and 1 deletions
|
|
@ -364,6 +364,27 @@ if 'sysconfig' in config and 'authorized_keys' in config['sysconfig'] and \
|
|||
print(e)
|
||||
errcnt+=1
|
||||
|
||||
# ==============================================================================
|
||||
# configure bash_history
|
||||
# do this after late-loading SRMs because we want to add to what is contained in a SRM
|
||||
# ==============================================================================
|
||||
|
||||
if 'sysconfig' in config and 'bash_history' in config['sysconfig'] and \
|
||||
config['sysconfig']['bash_history'] and isinstance(config['sysconfig']['bash_history'], dict):
|
||||
print(f"====> Configuring bash_history ...")
|
||||
|
||||
try:
|
||||
# append all our entries in case the file already exists
|
||||
with open("/root/.bash_history", "a") as historyfile:
|
||||
# iterate reverse sorted, the first key is written last and will appear first when pressing the up key
|
||||
for key, command in sorted(config['sysconfig']['bash_history'].items(),reverse=True):
|
||||
historyfile.write(f"{command}\n")
|
||||
historyfile.close()
|
||||
|
||||
except Exception as e:
|
||||
print(e)
|
||||
errcnt+=1
|
||||
|
||||
# ==============================================================================
|
||||
# autoterminal: programs that take over a virtual terminal for user interaction
|
||||
# ==============================================================================
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
setkmap
|
||||
|
|
@ -15,3 +15,7 @@ autorun:
|
|||
ar_attempts: 1
|
||||
ar_ignorefail: false
|
||||
ar_suffixes: "0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F"
|
||||
|
||||
sysconfig:
|
||||
bash_history:
|
||||
100: "setkmap"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue