forked from sh-edraft.de/sh_linux_installation_scripts
Improved write_bashrc.py
This commit is contained in:
parent
9d54650839
commit
7db81d0ee0
@ -17,7 +17,7 @@ install_git
|
|||||||
install_lsd
|
install_lsd
|
||||||
install_ncdu
|
install_ncdu
|
||||||
echo 'echo ""' | sudo tee -a /etc/bash.bashrc > /dev/null
|
echo 'echo ""' | sudo tee -a /etc/bash.bashrc > /dev/null
|
||||||
sudo python3.9 write_bashrc.py
|
sudo python3.9 write_bashrc.py /home/ /root/
|
||||||
install_neofetch
|
install_neofetch
|
||||||
install_trash_cli
|
install_trash_cli
|
||||||
|
|
||||||
|
@ -10,6 +10,13 @@ Script to comment all alias ls="ls *" to allow global bashrc alias ls="lsd"
|
|||||||
:copyright: (c) 2021 sh-edraft.de
|
:copyright: (c) 2021 sh-edraft.de
|
||||||
:license: MIT, see LICENSE for more details.
|
:license: MIT, see LICENSE for more details.
|
||||||
|
|
||||||
|
At first check for root
|
||||||
|
Then load all .bashrc files from /home/<user>/
|
||||||
|
Each folder in /home/ must contain a .bashrc file, if not it won't be created
|
||||||
|
|
||||||
|
Usage: sudo python write_bashrc.py <home-dir> <root-dir>
|
||||||
|
Example: sudo python write_bashrc.py /home/ /root/
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__title__ = 'sh_write_bashrc'
|
__title__ = 'sh_write_bashrc'
|
||||||
@ -18,9 +25,7 @@ __license__ = 'MIT'
|
|||||||
__copyright__ = 'Copyright (c) 2021 sh-edraft.de'
|
__copyright__ = 'Copyright (c) 2021 sh-edraft.de'
|
||||||
__version__ = '2021.4'
|
__version__ = '2021.4'
|
||||||
|
|
||||||
# At first check for root
|
|
||||||
# Then load all .bashrc files from /home/<user>/
|
|
||||||
# Each folder in /home/ must contain a .bashrc file, if not it won't be created
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
@ -83,8 +88,12 @@ def _edit_script(file: str):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
if len(sys.argv) < 3:
|
||||||
|
print('Usage: sudo pyhton write_bashrc.py <home-dir> <root-dir>')
|
||||||
|
exit()
|
||||||
|
|
||||||
_check_dependencies()
|
_check_dependencies()
|
||||||
files = _load_all_scripts('/home/', '/root/')
|
files = _load_all_scripts(sys.argv[1], sys.argv[2])
|
||||||
for file in files:
|
for file in files:
|
||||||
_edit_script(file)
|
_edit_script(file)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user