diff options
author | Ludovic Courtès <ludo@gnu.org> | 2022-12-27 17:50:57 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2023-01-05 14:21:19 +0100 |
commit | 2127e56bd8b3ee8ae5b6cde1b7ed5bf50cf7127b (patch) | |
tree | b422beddaf217054e1482f7cf59e4a1770d69d95 /gnu/system | |
parent | 73684dc90e013f2f0cca1097b0c944bb9aa88709 (diff) |
system, home: Factorize default '.bashrc'.
* gnu/system/shadow.scm (%default-bashrc): New variable. Source
/etc/bashrc only if it exists.
(default-skeletons): Use it.
* gnu/home/services/shells.scm (guix-bashrc): Remove.
(add-bash-configuration): Refer to '%default-bashrc' instead.
Diffstat (limited to 'gnu/system')
-rw-r--r-- | gnu/system/shadow.scm | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index 59f0a02c8b..4360a5ebd1 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2013-2020, 2022 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2016 Alex Griffin <a@ajgrf.com> ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il> @@ -63,7 +63,8 @@ user-group-id user-group-system?) - #:export (default-skeletons + #:export (%default-bashrc + default-skeletons skeleton-directory %base-groups %base-user-accounts @@ -118,14 +119,8 @@ (create-home-directory? #f) (system? #t)))) -(define (default-skeletons) - "Return the default skeleton files for /etc/skel. These files are copied by -'useradd' in the home directory of newly created user accounts." - - (let ((profile (plain-file "bash_profile" "\ -# Honor per-interactive-shell startup file -if [ -f ~/.bashrc ]; then . ~/.bashrc; fi\n")) - (bashrc (plain-file "bashrc" "\ +(define %default-bashrc + (plain-file "bashrc" "\ # Bash initialization for interactive non-login shells and # for remote shells (info \"(bash) Bash Startup Files\"). @@ -145,7 +140,7 @@ then fi # Source the system-wide file. -source /etc/bashrc +[ -f /etc/bashrc ] && source /etc/bashrc # Adjust the prompt depending on whether we're in 'guix environment'. if [ -n \"$GUIX_ENVIRONMENT\" ] @@ -157,6 +152,15 @@ fi alias ls='ls -p --color=auto' alias ll='ls -l' alias grep='grep --color=auto'\n")) + +(define (default-skeletons) + "Return the default skeleton files for /etc/skel. These files are copied by +'useradd' in the home directory of newly created user accounts." + + (let ((profile (plain-file "bash_profile" "\ +# Honor per-interactive-shell startup file +if [ -f ~/.bashrc ]; then . ~/.bashrc; fi\n")) + (bashrc %default-bashrc) (zprofile (plain-file "zprofile" "\ # Honor system-wide environment variables source /etc/profile\n")) |