1
0
mirror of https://github.com/kremalicious/dotfiles.git synced 2024-12-22 01:03:24 +01:00

renaming & refactor

This commit is contained in:
Matthias Kretschmann 2017-09-10 14:40:28 +02:00
parent 6a5f3c8093
commit 1faaa176b7
Signed by: m
GPG Key ID: 606EEEF3C479A91F
6 changed files with 37 additions and 45 deletions

View File

@ -9,15 +9,16 @@
# https://github.com/rtomayko/dotfiles
########################################################################
# shellcheck source=/dev/null
# ----------------------------------------------------------------------
# Load ~/.private, ~/.bash_prompt
# ----------------------------------------------------------------------
for file in ~/.{exports,private,bash_paths,bash_prompt,aliases,inputrc}; do
[ -r "$file" ] && [ -f "$file" ] && source "$file"
for FILE in ~/.{bash_exports,bash_paths,bash_prompt,bash_aliases,private,inputrc}; do
[ -r "$FILE" ] && [ -f "$FILE" ] && source "$FILE"
done;
unset file;
unset FILE;
# ----------------------------------------------------------------------
# SHELL OPTIONS

1
bashrc
View File

@ -1,3 +1,4 @@
#!/usr/bin/env bash
# shellcheck source=/dev/null
[ -n "$PS1" ] && source ~/.bash_profile;

View File

@ -9,15 +9,8 @@
set e
# ----------------------------------------------------------------------
# Variables
# ----------------------------------------------------------------------
# dotfiles directory
cd ../ || exit
# list of files/folders to symlink in homedir
files="aliases bashrc bash_profile bash_paths bash_prompt exports gemrc gitconfig gitignore hushlogin inputrc private npmrc bin tmux.conf"
FILES="bash_aliases bashrc bash_profile bash_paths bash_prompt bash_exports gemrc gitconfig gitignore hushlogin inputrc private npmrc bin tmux.conf"
# ----------------------------------------------------------------------
# create the private file first, will be symlinked but ignored by git
@ -27,19 +20,29 @@ touch private
# ----------------------------------------------------------------------
# create symlinks from the homedir to any files in the dotfiles directory
# specified in $files
# specified in $FILES
# ----------------------------------------------------------------------
for file in $files; do
ln -s "$file" ~/."$file"
echo "$(tput setaf 64)$(tput sgr0) Created symlink to $(tput setaf 37)$file$(tput sgr0)"
for FILE in $FILES; do
# remove old symlinks if present
if [ -h "$HOME/.$FILE" ]; then
rm "$HOME/.$FILE"
echo "$(tput setaf 64)$(tput sgr0) Removed old symlink to $(tput setaf 37)$FILE$(tput sgr0)"
fi
# symlink files
ln -s "$PWD/$FILE" "$HOME/.$FILE"
echo "$(tput setaf 64)$(tput sgr0) Created new symlink to $(tput setaf 37)$FILE$(tput sgr0)"
done
# ----------------------------------------------------------------------
# source what we just created
# ----------------------------------------------------------------------
source ~/.bash_profile
# shellcheck source=/dev/null
source "$HOME/.bash_profile"
# ----------------------------------------------------------------------
# Homebrew
@ -49,7 +52,7 @@ echo "$(tput setaf 136) Brewing all the things. "
echo "=============================================$(tput sgr0)"
"" # reset
bin/install-brew.sh
./bin/install-brew.sh
echo "$(tput setaf 64)---------------------------------------------"
echo " ✓ done$(tput sgr0)"
@ -60,7 +63,7 @@ echo " ✓ done$(tput sgr0)"
echo "$(tput setaf 136) npm all the things. "
echo "=============================================$(tput sgr0)"
bin/install-npm.sh
./bin/install-npm.sh
echo "$(tput setaf 64)---------------------------------------------"
echo " ✓ done$(tput sgr0)"
@ -72,7 +75,7 @@ echo " ✓ done$(tput sgr0)"
echo "$(tput setaf 136) Ruby all the things. "
echo "=============================================$(tput sgr0)"
bin/install-ruby.sh
./bin/install-ruby.sh
echo "$(tput setaf 64)---------------------------------------------"
echo " ✓ done$(tput sgr0)"

View File

@ -7,41 +7,28 @@
# https://github.com/michaeljsmalley/dotfiles/blob/master/makesymlinks.sh
########################################################################
# ----------------------------------------------------------------------
# Variables
# ----------------------------------------------------------------------
# dotfiles directory
cd ../ || exit
# list of files/folders to symlink in homedir
files="aliases bashrc bash_profile bash_paths bash_prompt editorconfig exports gemrc gitconfig gitignore hushlogin inputrc private npmrc bin tmux.conf"
FILES="bash_aliases bashrc bash_profile bash_paths bash_prompt bash_exports editorconfig gemrc gitconfig gitignore hushlogin inputrc private npmrc bin tmux.conf"
for FILE in $FILES; do
# ----------------------------------------------------------------------
# delete existing dotfiles in ~
# ----------------------------------------------------------------------
# remove old symlinks if present
if [ -h "$HOME/.$FILE" ]; then
rm "$HOME/.$FILE"
echo "$(tput setaf 64)$(tput sgr0) Removed old symlink to $(tput setaf 37)$FILE$(tput sgr0)"
fi
# symlink files
ln -s "$PWD/$FILE" "$HOME/.$FILE"
echo "$(tput setaf 64)$(tput sgr0) Created new symlink to $(tput setaf 37)$FILE$(tput sgr0)"
for file in $files; do
rm ~/."$file"
done
# ----------------------------------------------------------------------
# create symlinks from the homedir to any files in the ~/dotfiles directory
# specified in $files
# ----------------------------------------------------------------------
for file in $files; do
ln -s "$file" ~/."$file"
echo "$(tput setaf 64)$(tput sgr0) Created symlink to $(tput setaf 37)$file$(tput sgr0)"
done
# ----------------------------------------------------------------------
# source what we just created
# ----------------------------------------------------------------------
source ~/.bash_profile
# shellcheck source=/dev/null
source "$HOME/.bash_profile"
exit