Copy and install unless --files-only specified
This commit is contained in:
parent
242089bb2c
commit
599937b806
32
copy.sh
32
copy.sh
|
@ -1,27 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ "$1" != "--install" ]]; then
|
||||
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
FAKE_HOME="$SCRIPT_DIR/fake_home"
|
||||
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
FAKE_HOME="$SCRIPT_DIR/fake_home"
|
||||
|
||||
dotdirs="$(find $FAKE_HOME -mindepth 1 -type d)"
|
||||
dotdirs="$(find $FAKE_HOME -mindepth 1 -type d)"
|
||||
|
||||
echo "$dotdirs" | while read -r dotdir; do
|
||||
new="$HOME${dotdir:${#FAKE_HOME}}"
|
||||
echo "mkdir -p $new"
|
||||
mkdir -p $new
|
||||
done
|
||||
echo "$dotdirs" | while read -r dotdir; do
|
||||
new="$HOME${dotdir:${#FAKE_HOME}}"
|
||||
echo "mkdir -p $new"
|
||||
mkdir -p $new
|
||||
done
|
||||
|
||||
|
||||
dotfiles="$(find $FAKE_HOME -mindepth 1 -type f)"
|
||||
dotfiles="$(find $FAKE_HOME -mindepth 1 -type f)"
|
||||
|
||||
echo "$dotfiles" | while read -r dotfile; do
|
||||
new="$HOME${dotfile:${#FAKE_HOME}}"
|
||||
echo "$dotfile => $new"
|
||||
ln -sf "$dotfile" "$new"
|
||||
done
|
||||
echo "$dotfiles" | while read -r dotfile; do
|
||||
new="$HOME${dotfile:${#FAKE_HOME}}"
|
||||
echo "$dotfile => $new"
|
||||
ln -sf "$dotfile" "$new"
|
||||
done
|
||||
|
||||
touch "$HOME/.zsh_local"
|
||||
touch "$HOME/.zsh_local"
|
||||
if [[ "$1" == "--files-only" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in New Issue