6 ## We live in a unicode world now
11 # The wrappers directory must be the first entry in the PATH, and
12 # /tools/bin should be last.
14 # Once you are no longer needing or using the tools dir you can remove
16 #PATH=/usr/lib/pkgusr:/usr/bin:/usr/X11R6/bin:/opt/qt/bin:/tools/bin
17 PATH=/usr/lib/pkgusr:/usr/bin:/usr/X11R6/bin:/opt/qt/bin
19 ## A couple things to make less(1) nicer.
20 LESS='-FgiMrswX --use-color'
22 LESSOPEN='|lesspipe.sh %s'
24 ## Timezone -- set to your local zone
25 TZ='Australia/Brisbane'
34 _XORG=/usr/X11R6/lib/pkgconfig:/usr/X11R6/share/pkgconfig
35 _KDE=/opt/kde/lib/pkgconfig
36 _QT=${QTDIR}/lib/pkgconfig
37 _PKGCFG=$(pkg-config --variable pc_path pkg-config)
38 PKG_CONFIG_PATH=${_PKGCFG}:${_XORG}:${_KDE}:${_QT}
41 unset _XORG _KDE _QT _PKGCFG
43 ## Locale directory suppression.
44 # If this is set to `1' (one) then the install and mkdir wrappers
45 # won't put anything in /usr/share/locale. Technically, the mkdir
46 # wrapper still creates the dir, but it is removed afterward. If
47 # you want to override this behaviour globally, set this to `0'
48 # (zero) here, or you can override an individual package by adding
49 # `SUPPRESSLOCALEDIR=0' to that pkgusr's ~/.pkgusrrc.
51 # See the comments in the install wrapper for more detail and
55 ## Build script update checks
56 # If this is set to `1' (one) a check is done to see if there is a
57 # newer build script available that the pkgusr could update to. If an
58 # update is available a message is printed to stdout with instructions
61 # Override this in ~/.pkgusrrc.
64 ## Slackware PKG local repo
65 # Having a shortcut to a local Slackware PKG repo is very useful.
66 # Pat Volkerding and his team are of a minority who actually know
67 # what they are doing. I always check Slackware for patches.
69 # I get the Slack source via rsync.
70 # See https://mirrors.slackware.com/mirrorlist/
72 SLACKPKG=/home/steve/download/Slackware/slackware64-current/source
73 # Obviously edit to suit your situation
76 export LANG LC_CTYPE PATH LESS LESSCHARSET LESSOPEN TZ PKG_CONFIG_PATH QTDIR
77 export SUPPRESSLOCALEDIR CHECKUPDATES SLACKPKG
80 # Shell prompts are not just eye-candy they should show what you need
81 # to know most and they should do it in such a way that you don't
82 # even notice. This sets up a two-line prompt that reminds you that
83 # you're currently logged in as a pkgusr, which pkgusr, which group
84 # if that pkgusr has multiple groups and you've newgrp'd, if you're
85 # inside a git repo display the branch and other pertinent info, if
86 # the previous command had a non-zero exit display the code, display
87 # the current time, and current working directory (truncated to
88 # prevent "prompt-creep"), and set the Xterm title. Colourised so
89 # that often you won't even need to read it to take in the info.
91 # Colours (doesn't include black (30))
92 CO="\[\e[0m\]" # Colour Off
93 RED="\[\e[0;31m\]" # Red
94 GRN="\[\e[0;32m\]" # Green
95 YEL="\[\e[0;33m\]" # Yellow
96 BLU="\[\e[0;34m\]" # Blue
97 MAG="\[\e[0;35m\]" # Magenta
98 CYN="\[\e[0;36m\]" # Cyan
99 WTE="\[\e[0;37m\]" # White
101 BRED="\[\e[1;31m\]" # Bold Red
102 BGRN="\[\e[1;32m\]" # Bold Green
103 BYEL="\[\e[1;33m\]" # Bold Yellow
104 BBLU="\[\e[1;34m\]" # Bold Blue
105 BMAG="\[\e[1;35m\]" # Bold Magenta
106 BCYN="\[\e[1;36m\]" # Bold Cyan
107 BWTE="\[\e[1;37m\]" # Bold White
109 # Some pkgusrs may use extra groups so the prompt should reflect that.
110 # This function adds the group name to the prompt if necessary.
113 [[ $(id -gn) != $(id -un) ]] && echo "$WTE:$CYN$(id -gn)"
116 # Set the Xterm title
119 [[ "$TERM" = "xterm" ]] && echo "\[\e]2;PKG(\u)\a\]"
122 # Draw a horizontal line from the end of the top line of the prompt to
123 # the right hand edge of the terminal.
126 # 11 is the number of chars taken up by "-(HH:MM)-()"
127 TRIM=$((${#PWD} + 11))
129 # If there was a non-zero return there will be an extra 4 + length
131 [[ $rc -gt 0 ]] && TRIM=$(($TRIM + ${#rc} + 4))
133 # Allow for $HOME being displayed as ~
134 [[ $HOME == ${PWD::${#HOME}} ]] && TRIM=$(($TRIM - ${#HOME} + 1))
136 a=($(seq -s ' ' 1 $(($COLUMNS - $TRIM))))
137 printf '%s' ${a[@]/*/-}
140 # This function, called from $PROMPT_COMMAND, puts all the pieces of
141 # the prompt together.
144 rc=$? # Return code from previous cmd
146 # Normally you'd define your local vars at the top of the function,
147 # well I normally do, but in this case it will overwrite the value
148 # of '$?' so we need to preserve it first.
149 local gitp p prc sg title hline
151 # Previous cmd's return code, but only if it was non-zero
152 [[ $rc -gt 0 ]] && prc="$BWTE--[$BRED$rc$BWTE]" || prc=
158 [[ -f /etc/pkgusr/git-prompt ]] && gitp=$(__git_ps1) || gitp=
169 PS1="$BWTE-($BYEL\A$BWTE)-($BMAG\w$BWTE)$prc" # -(TIME)-(CWD)--[rc]
171 PS1+="$BWTE[$YEL$p $BWTE($CYN\u$sg$BWTE)" # [pkgusr (usr:grp)
172 PS1+="$CO" # reset to not mess up git prompt
173 PS1+="$gitp" # (gitstuff)
174 PS1+="$BWTE]>$CO " # ]>
175 PS1+="$title" # Xterm title
179 [[ -f /etc/pkgusr/git-prompt ]] && source /etc/pkgusr/git-prompt
180 GIT_PS1_SHOWDIRTYSTATE=true
181 GIT_PS1_SHOWSTASHSTATE=true
182 GIT_PS1_SHOWUNTRACKEDFILES=true
183 GIT_PS1_SHOWUPSTREAM=auto
184 GIT_PS1_DESCRIBE_STYLE=branch
185 GIT_PS1_SHOWCOLORHINTS=true
187 # Set this so the prompt doesn't fly off the right-hand edge of the
188 # screen when you're down a long directory tree.
191 # Finally, make the prompt happen!
192 PROMPT_COMMAND=make_prompt
195 ## Pretty colours for ls
197 alias ls='ls --color=always -Fb'
199 ## Suck in some handy shell functions
200 . /etc/pkgusr/handy_funcs
202 ## Go to the home directory whenever we su to a package user.
205 ## Setup the git config if needed
206 if [[ ! -d ${HOME}/.config/git && -f ${HOME}/.gitconfig ]]; then
211 if [ -f /usr/share/bash-completion/bash_completion ]; then
212 . /usr/share/bash-completion/bash_completion
216 # Called last so that defaults can be overridden.
217 [[ -f ${HOME}/.pkgusrrc ]] && . ${HOME}/.pkgusrrc
219 ###===============================================================###
220 # Don't put anything below here unless it relies on something being #
221 # set in ~/.pkgusrrc #
222 ###===============================================================###
224 # Maybe check if the build script can be updated, but not on dumb
225 # terms so that TRAMP still works.
226 if [ ${CHECKUPDATES} -eq 1 -a "$TERM" != "dumb" ]; then