Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
takyshu98 committed Jan 21, 2024
1 parent abd77b1 commit a0616b1
Show file tree
Hide file tree
Showing 16 changed files with 17 additions and 20 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 3 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,16 @@ else
echo
fi

cd "${DOTPATH}"

# Restore macOS settings
scripts/defaults.sh
"${DOTPATH}/scripts/defaults.sh"
echo

# Make symbolic links and directories
scripts/symlink.sh
"${DOTPATH}/scripts/symlink.sh"
echo

# Install command line tools and applications
brew bundle
brew bundle --file "${DOTPATH}/Brewfile"
echo

# Restore application settings
Expand Down
29 changes: 14 additions & 15 deletions scripts/symlink.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
#!/bin/bash

readonly DOTPATH="${HOME}/share/dotfiles"
readonly DOTHOME="${HOME}/share/dotfiles/home"

if [ ! -e "${DOTPATH}" ]; then
echo "Error: Directory does not exist: ${DOTPATH}"
if [ ! -e "${DOTHOME}" ]; then
echo "Error: Directory does not exist: ${DOTHOME}"
exit 1
fi

cd "${DOTPATH}"

# Make symbolic links from ~/.* to ~/share/dotfiles/.*
for file in .??*; do
[[ "${file}" == ".DS_Store" ]] && continue
[[ "${file}" == ".config" ]] && continue
[[ "${file}" == ".git" ]] && continue
[[ "${file}" == ".github" ]] && continue
[[ "${file}" == ".gitignore" ]] && continue
ln -fvns "${DOTPATH}/${file}" "${HOME}/${file}"
# Make symbolic links from ~/.* to ~/share/dotfiles/home/.*
for file_path in "${DOTHOME}"/.??*; do
file_name="$(basename "${file_path}")"
[[ "${file_name}" == ".DS_Store" ]] && continue
[[ "${file_name}" == ".config" ]] && continue
[[ "${file_name}" == ".git" ]] && continue
[[ "${file_name}" == ".github" ]] && continue
[[ "${file_name}" == ".gitignore" ]] && continue
ln -fvns "${DOTHOME}/${file_name}" "${HOME}/${file_name}"
done

# Make symbolic links on the basis of XDG Base Directory specification
[[ -z "${XDG_CONFIG_HOME}" ]] && XDG_CONFIG_HOME="${HOME}/.config"
mkdir -p "${XDG_CONFIG_HOME}"
find "${DOTPATH}/.config" -maxdepth 1 -exec ln -fvns {} "${XDG_CONFIG_HOME}" \;
find "${DOTHOME}/.config" -maxdepth 1 ! -name '.config' ! -name '.DS_Store' -exec ln -fvns {} "${XDG_CONFIG_HOME}" \;

[[ -z "${XDG_CACHE_HOME}" ]] && XDG_CACHE_HOME="${HOME}/.cache"
mkdir -p "${XDG_CACHE_HOME}"
Expand All @@ -35,7 +34,7 @@ mkdir -p "${XDG_STATE_HOME}"

# Make directories with reference to Filesystem Hierarchy Standard
mkdir -p "${HOME}/bin" # for original commands
find "${DOTPATH}/bin/" -type f -perm 0755 -exec ln -fvns {} "${HOME}/bin/" \;
find "${DOTHOME}/bin/" -type f ! -name '.DS_Store' -perm 0755 -exec ln -fvns {} "${HOME}/bin/" \;

mkdir -p "${HOME}/src" # for code repositories

Expand Down

0 comments on commit a0616b1

Please sign in to comment.