Feature: Support linking files only
This commit is contained in:
parent
f9c314858c
commit
f2e8d831ab
2 changed files with 19 additions and 5 deletions
24
setup.sh
24
setup.sh
|
@ -4,32 +4,46 @@ mkdir -p ~/.config/homedir-backup 2>/dev/null
|
||||||
|
|
||||||
function linkfiles {
|
function linkfiles {
|
||||||
for file in $@; do
|
for file in $@; do
|
||||||
|
create_dir=false
|
||||||
name=$(basename $file)
|
name=$(basename $file)
|
||||||
dir=$(dirname $file)
|
dir=$(dirname $file)
|
||||||
if [ "$dir" == "dotfiles" ] ; then
|
if [ "$dir" == "dotfiles" ] ; then
|
||||||
targetdir=""
|
targetdir=""
|
||||||
|
elif [ "$( dirname $dir | cut -f1 -d/)" == "configfile" ] ; then
|
||||||
|
targetdir="config/$(echo $dir | cut -f2- -d/)/"
|
||||||
|
create_dir=true
|
||||||
else
|
else
|
||||||
targetdir="$dir/"
|
targetdir="$dir/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -L ~/.${targetdir}${name} ] ; then
|
if [ ! -L ~/.${targetdir}${name} ] ; then
|
||||||
|
if $create_dir ; then
|
||||||
|
mkdir -p ~/.${targetdir}
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -f hosts/$(hostname -s)/${name} ] ; then
|
if [ -f hosts/$(hostname -s)/${name} ] ; then
|
||||||
dotfile="$(pwd)/hosts/$(hostname -s)/${name}"
|
dotfile="$(pwd)/hosts/$(hostname -s)/${name}"
|
||||||
else
|
else
|
||||||
dotfile="$(pwd)/$dir/${name}"
|
dotfile="$(pwd)/$dir/${name}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mv -v ~/.${targetdir}${name} ~/.config/homedir-backup
|
mv -v ~/.${targetdir}${name} ~/.config/homedir-backup
|
||||||
ln -s "$dotfile" ~/.${targetdir}${name}
|
ln -s "$dotfile" ~/.${targetdir}${name}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
linkfiles 'dotfiles/*'
|
#linkfiles 'dotfiles/*'
|
||||||
|
|
||||||
git clone https://github.com/NvChad/NvChad ~/.config/nvim
|
|
||||||
nvim -c "autocmd User PackerComplete quitall" -c "PackerSync"
|
|
||||||
linkfiles 'config/*'
|
|
||||||
|
|
||||||
|
#git clone https://github.com/NvChad/NvChad ~/.config/nvim
|
||||||
|
#nvim -c "autocmd User PackerComplete quitall" -c "PackerSync"
|
||||||
|
#linkfiles 'config/*'
|
||||||
|
set -x
|
||||||
|
for file in $(find configfile -type f) ; do
|
||||||
|
linkfiles $file
|
||||||
|
done
|
||||||
|
set +x
|
||||||
|
exit
|
||||||
# Install powerline if possible
|
# Install powerline if possible
|
||||||
if which pip3 ; then
|
if which pip3 ; then
|
||||||
pip3 install --user -U -r requirements.txt
|
pip3 install --user -U -r requirements.txt
|
||||||
|
|
Loading…
Reference in a new issue