From: alex Date: Tue, 21 May 2024 11:25:01 +0000 (+0200) Subject: Add setup_bash X-Git-Tag: 20241020-emacs~180 X-Git-Url: https://xn--ix-yja.es/gitweb/?a=commitdiff_plain;h=7430c48609941b02b556bd65685fbc7ca0442a90;p=alex.git Add setup_bash --- diff --git a/scripts/p7s/bash.py b/scripts/p7s/bash.py new file mode 100644 index 0000000..b5c503d --- /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 225ab82..c2a674c 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'