-
Notifications
You must be signed in to change notification settings - Fork 1
Sinewalker dotfiles changes
Here I describe my changes to the dotfiles
script. My intention here is to keep dotfiles
itself as generic as possible, so that suitable Pull Requests could be made to Cowboy's original. That is: only mechanism enhancements are made, not policy.
There are two exceptions:
- when cloning dotfiles for the first time, I have updated the fall-back GitHub user name to be sinewalker instead of cowboy:
git clone --recursive git://github.com/${github_user:-sinewalker}/dotfiles.git $DOTFILES
- I have updated the banner at the very start of
dotfiles
, that prints with a link to Ben Alman's web site if we are running without the "source
" option. It retains this and his copyright notice, and add's my own
-
added
lssrc
function to list the files in${DOTFILES}/source/
which are picked up by the existingsrc
functionThe
src
function has an optional parameter to specify a file to source, and mylssrc
just lists what you can source, using the same globbing pattern thatsrc
does (so it only picks up${DOTFILES}/source/*.sh
; any other files in there will be skipped). It lists them without the.sh
extension to be clear about how you specify it tosrc
. -
added bash completion function for
src
which picks validsource/*.sh
files formatted so thatsrc
can source them -
before actually calling
src
to source the files, test whether Bash is running in POSIX mode. If so then don't bother to source the files:- There are many Bash-isms in the code which fail when running in POSIX because they are not compatible with the standard
- If bash has been started in POSIX mode, it's likely because it was started as
/bin/sh
in a sub-shell, so the system's not interactive anyway
Dotfiles links files within link/
to their home-directory locations.
It also now correctly links files in config/
to the system application configuration directory (usually ~/.config
, or whichever is specified by the $XDG_CONFIG
variable on free-desktop systems like KDE. You can override this by setting $CONFIG
near the start of bin/dotfiles
but it should pick the correct location no matter which operating system is running.
In addition to these, I also link library files within $HOME/lib
. That's a Policy descision. You can change where it goes by altering the value of $LIB
near the start of bin/dotfiles
.
- added
is_
distribution functions for detecting Unix flavours that this project supports
That is: is_suse
, is_redhat6
, is_redhat7
and so on.
Also I updated is_ubuntu
to use lsb_release -i
for detecting "buntu" in the Linux distribution, rather than rely on the content of /etc/issue
which could be changed. This also matches all the *buntu Ubuntu flavours, ubuntu, kubuntu, edubuntu and so on.
-
expanded
get_os
to use the additionalis_
os functions -
is_exe
is not used bydotfiles
directly, but it /is/ used by initialisation modules. It tests that it's argument can be run as a command.
Moved functions that are purely to do with bootstrapping Dotfiles and initialising environments, to after the point where the code bails for the source
mode.
All functions in dotfiles
were updated to move their comment lines into $FUNCDESC
document strings, so that whence funcname
and describe funcname
show descriptive details. All non-trivial, interactive functions in the entire project will adopt this $FUNCDESC
pattern. See Self-documenting functions.
All functions that are implementation helpers were renamed to start with two underscores, e.g. the prompt helpers prompt_thing
have been renamed to __prompt_thing
to indicate they are not meant for interactive use. They also may not have $FUNCDESC
if they're trivial.