]> gitweb.fluxo.info Git - puppet-nodo.git/commitdiff
Keep managing /etc/bash.bashrc
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 9 Mar 2015 15:24:33 +0000 (12:24 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 9 Mar 2015 15:24:33 +0000 (12:24 -0300)
files/etc/bash.bashrc
files/etc/profile
files/etc/profile.d/prompt.sh [moved from files/bin/prompt.sh with 100% similarity]
manifests/subsystem/profile.pp

index 5e594b7690dbf9b6813ba61e836c51896199bf89..8faf82049414dd2ce53bb5826cac390208f70469 100644 (file)
@@ -11,7 +11,7 @@
 shopt -s checkwinsize
 
 # set variable identifying the chroot you work in (used in the prompt below)
-if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
+if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
     debian_chroot=$(cat /etc/debian_chroot)
 fi
 
@@ -19,7 +19,7 @@ fi
 #PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
 
 # set a fancy prompt
-. /usr/local/bin/prompt.sh
+. /etc/profile.d/prompt.sh
 
 # Commented out, don't overwrite xterm -T "title" -n "icontitle" by default.
 # If this is an xterm set the title to user@host:dir
@@ -32,18 +32,26 @@ fi
 #esac
 
 # enable bash completion in interactive shells
-if [ -f /etc/bash_completion ]; then
-    . /etc/bash_completion
-fi
+#if ! shopt -oq posix; then
+#  if [ -f /usr/share/bash-completion/bash_completion ]; then
+#    . /usr/share/bash-completion/bash_completion
+#  elif [ -f /etc/bash_completion ]; then
+#    . /etc/bash_completion
+#  fi
+#fi
 
 # if the command-not-found package is installed, use it
-if [ -x /usr/lib/command-not-found ]; then
+if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then
        function command_not_found_handle {
                # check because c-n-f could've been removed in the meantime
                 if [ -x /usr/lib/command-not-found ]; then
-                  /usr/bin/python /usr/lib/command-not-found -- $1
+                  /usr/lib/command-not-found -- "$1"
+                   return $?
+                elif [ -x /usr/share/command-not-found/command-not-found ]; then
+                  /usr/share/command-not-found/command-not-found -- "$1"
                    return $?
                else
+                  printf "%s: command not found\n" "$1" >&2
                   return 127
                fi
        }
index 5a89ea51782e1fb3807d152d09389503163689f7..51d043020989b12b7acc6a3fb13cf8c383bd0c13 100644 (file)
@@ -9,7 +9,7 @@ fi
 export PATH
 
 if [ "$PS1" ]; then
-  if [ "$BASH" ]; then
+  if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
     # The file bash.bashrc already sets the default PS1.
     # PS1='\h:\w\$ '
     if [ -f /etc/bash.bashrc ]; then
@@ -24,9 +24,6 @@ if [ "$PS1" ]; then
   fi
 fi
 
-# The default umask is now handled by pam_umask.
-# See pam_umask(8) and /etc/login.defs.
-
 if [ -d /etc/profile.d ]; then
   for i in /etc/profile.d/*.sh; do
     if [ -r $i ]; then
index 56190eb890d70040cb090630a848beed84e3e495..884865b7c4f27daf455186259ea638d6fe701c02 100644 (file)
@@ -6,13 +6,23 @@ class nodo::subsystem::profile {
   }
 
   file { "/etc/profile.d/prompt.sh":
-    source  => "puppet:///modules/nodo/bin/prompt.sh",
+    source  => "puppet:///modules/nodo/etc/profile.d/prompt.sh",
     owner   => "root",
     group   => "root",
     mode    => 0644,
     ensure  => present,
   }
 
+  # Ideally we should not manage this file, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=675008
+  file { "/etc/bash.bashrc":
+    source  => "puppet:///modules/nodo/etc/bash.bashrc",
+    owner   => "root",
+    group   => "root",
+    mode    => 0644,
+    ensure  => present,
+    require => File['/etc/profile.d/prompt.sh'],
+  }
+
   # See http://linuxforcynics.com/how-to/using-rxvt-unicode-with-screen
   #     https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=630976
   #     https://bbs.archlinux.org/viewtopic.php?id=50647