From 7430c48609941b02b556bd65685fbc7ca0442a90 Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 21 May 2024 13:25:01 +0200 Subject: Add setup_bash --- scripts/p7s/bash.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 scripts/p7s/bash.py (limited to 'scripts/p7s/bash.py') diff --git a/scripts/p7s/bash.py b/scripts/p7s/bash.py new file mode 100644 index 00000000..b5c503d0 --- /dev/null +++ b/scripts/p7s/bash.py @@ -0,0 +1,24 @@ +import pathlib +import platform +import textwrap + + +def is_ubuntu_2204(): + return platform.freedesktop_os_release().get("VERSION_CODENAME") == "jammy" + + +def setup_bash(): + if is_ubuntu_2204(): + # clone the handy ~/.bashrc.d from Fedora + bash_aliases = pathlib.Path.home() / ".bash_aliases" + bash_aliases.write_text(textwrap.dedent(""" + # User specific aliases and functions + if [ -d ~/.bashrc.d ]; then + for rc in ~/.bashrc.d/*; do + if [ -f "$rc" ]; then + . "$rc" + fi + done + fi + unset rc + """.lstrip())) -- cgit v1.2.3