]> xn--ix-yja.es Git - alex.git/commitdiff
Add setup_bash
authoralex <alex@pdp7.net>
Tue, 21 May 2024 11:25:01 +0000 (13:25 +0200)
committeralex <alex@pdp7.net>
Tue, 21 May 2024 11:25:01 +0000 (13:25 +0200)
scripts/p7s/bash.py [new file with mode: 0644]
scripts/pyproject.toml

diff --git a/scripts/p7s/bash.py b/scripts/p7s/bash.py
new file mode 100644 (file)
index 0000000..b5c503d
--- /dev/null
@@ -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()))
index 225ab824e28787791bc5be53b580c9c43f53575a..c2a674c7b058db52138953c7c518242ca3df38f3 100644 (file)
@@ -24,6 +24,7 @@ db-update = 'p7s.distrobox:update'
 nextcloud_setup = 'p7s.nextcloud:setup_nextcloud'
 soju_setup = 'p7s.soju:setup_soju'
 bitlbee_setup = 'p7s.bitlbee:setup_bitlbee'
+setup_bash = 'p7s.bash:setup_bash'
 setup_emacs = 'p7s.emacs:setup_emacs'
 setup_ubpkg = 'p7s.ubpkg:setup_ubpkg'
 update_zfs = 'p7s.zfs:update_zfs'