diff --git a/bootstrap.sh b/bootstrap.sh index e206dae..9c92206 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -12,19 +12,19 @@ QUIET="n" CREATE_LINKS="n" usage() { - if [ "$1" != "" ]; then - echo "" - echo -e "${CRED}$1${CEND}\n" + if [ "$1" != "" ]; then + echo "" + echo -e "${CRED}$1${CEND}\n" fi - echo "Applies all settings stored in the script's directory to your home directory" - echo "" - echo "Usage: $0 [-q|--quiet] [-l|--create-links]" - echo " -q, --quiet No screen outputs" - echo " -l, --create-links Creates soft-links to files in the current directory instead of copying them" + echo "Applies all settings stored in the script's directory to your home directory" + echo "" + echo "Usage: $0 [-q|--quiet] [-l|--create-links]" + echo " -q, --quiet No screen outputs" + echo " -l, --create-links Creates soft-links to files in the current directory instead of copying them" - echo "" - echo "Example: $0 -q --create-links" + echo "" + echo "Example: $0 -q --create-links" } place_dotfile_at_target_location() { @@ -48,50 +48,51 @@ place_dotfile_at_target_location() { mkdir -p "$target_directory" && [ "$QUIET" = "n" ] && echo "Directory ${target_directory} created" fi - if [ "$CREATE_LINKS" = "y" ]; then + if [ "$CREATE_LINKS" = "y" ]; then # echo "ln -s ${source_file_location} ${target_directory}" ln -s "$source_file_location" "$target_directory" && [ "$QUIET" = "n" ] && echo "Linked ${file_target_location}" else # echo "cp ${source_file_location} ${target_directory}" - cp "$source_file_location" "$target_directory" && [ "$QUIET" = "n" ] && echo "Copied ${file_target_location}" + cp "$source_file_location" "$target_directory" && [ "$QUIET" = "n" ] && echo "Copied ${file_target_location}" fi } -main() { +main() { while [ "${#}" -gt 0 ]; do case $1 in - -q | --quiet) - QUIET="y" - shift - ;; - -l | --create-links) - CREATE_LINKS="y" - shift - ;; - -h | --help) - echo - usage - echo - exit 0 - ;; - *) - usage "Unknown parameter passed: $1" "h" - exit 1 - ;; + -q | --quiet) + QUIET="y" + shift + ;; + -l | --create-links) + CREATE_LINKS="y" + shift + ;; + -h | --help) + echo + usage + echo + exit 0 + ;; + *) + usage "Unknown parameter passed: $1" "h" + exit 1 + ;; esac done case $(uname -a) in - Linux*) - OS="linux" - [ "$XDG_CURRENT_DESKTOP" = "KDE" ] && OS="kde-neon" - ;; - Darwin*) - OS="macos" - ;; - *) - OS="UNSUPPORTED" - ;; + Linux*) + OS="kde-neon" + + [ "$XDG_CURRENT_DESKTOP" = "KDE" ] && OS="kde-neon" + ;; + Darwin*) + OS="macos" + ;; + *) + OS="UNSUPPORTED" + ;; esac TS=$(date '+%d_%m_%Y-%H_%M_%S') @@ -100,18 +101,16 @@ main() { cd -P "$(dirname "$0")" || exit # Copy all files in "Common" dotfiles to $HOME directory ("~") - find "./common" -type f -not -path '*.DS_Store' -not -path '*.directory' | while read -r file; - do - file_target_location="${file/.\/common/$HOME}" - source_file_location="${file/./$PWD}" + find "./common" -type f -not -path '*.DS_Store' -not -path '*.directory' | while read -r file; do + file_target_location="${HOME}${file#./common}" + source_file_location="${PWD}${file#.}" place_dotfile_at_target_location "$source_file_location" "$file_target_location" "$TS" done # Copy platform specific files to $HOME directory ("~") - find "./${OS}" -type f -not -path '*.DS_Store' -not -path '*.directory' | while read -r file; - do - file_target_location="${file/.\/${OS}/$HOME}" - source_file_location="${file/./$PWD}" + find "./${OS}" -type f -not -path '*.DS_Store' -not -path '*.directory' | while read -r file; do + file_target_location="${HOME}${file#./${OS}}" + source_file_location="${PWD}${file#.}" place_dotfile_at_target_location "$source_file_location" "$file_target_location" "$TS" done } diff --git a/common/.profile b/common/.profile index d1eda69..625de7f 100644 --- a/common/.profile +++ b/common/.profile @@ -49,7 +49,7 @@ if [ "$(uname -s)" = "Linux" ]; then export CUDA_CACHE_PATH="XDG_CACHE_HOME/nv" # Map caps-lock to escape TIP: also added to /etc/profile - setxkbmap -option caps:escape + command -v setxkbmap >/dev/null && setxkbmap -option caps:escape fi export QT_PLUGIN_PATH="$HOME/local/lib/qt/plugins/:"