aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authoralex <alex@pdp7.net>2024-05-21 13:25:01 +0200
committeralex <alex@pdp7.net>2024-05-21 13:25:01 +0200
commit7430c48609941b02b556bd65685fbc7ca0442a90 (patch)
treecfda127f1d8e31b6b7643a70e282b3a98709c37e /scripts
parentde30ba3fc6c6d68399ecb84b4115c253aacd4ed7 (diff)
Add setup_bash
Diffstat (limited to 'scripts')
-rw-r--r--scripts/p7s/bash.py24
-rw-r--r--scripts/pyproject.toml1
2 files changed, 25 insertions, 0 deletions
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()))
diff --git a/scripts/pyproject.toml b/scripts/pyproject.toml
index 225ab824..c2a674c7 100644
--- a/scripts/pyproject.toml
+++ b/scripts/pyproject.toml
@@ -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'