Skip to content

Commit

Permalink
desktop: auto commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kovetskiy committed Oct 31, 2019
1 parent e67e3ae commit 1531cac
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 9 deletions.
2 changes: 0 additions & 2 deletions .clones
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
.config/systemd/user.conf
.config/systemd/user/gocode.service
.config/systemd/user/qbittorrent.service
45 changes: 38 additions & 7 deletions bin/.sync
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,40 @@
symlinks=($(cat ~/dotfiles/.symlinks))
clones=($(cat ~/dotfiles/.clones))

:ask() {
echo -n ":: Press y to $1:"
read result
if [[ "$result" != "y" ]]; then
return 1
fi
}

for path in "${symlinks[@]}"; do
echo "$path" >&2
rm -rf ~/"$path"
ln -s ~/dotfiles/"$path" ~/"$path"
done
if [[ "$path" == "" ]]; then
echo "Wow!"
fi

for path in "${clones[@]}"; do
echo "$path" >&2
rm -rf ~/"$path"
cp -r ~/dotfiles/"$path" ~/"$path"
if [[ ! -L ~/"$path" ]]; then
if ! :ask "remove ~/$path"; then
echo "skipping"
continue
fi
rm -rf ~/"$path"
ln -s ~/dotfiles/"$path" ~/"$path"
fi
done

#for path in "${clones[@]}"; do
# echo "$path" >&2
# if [[ "$path" == "" ]]; then
# echo "Wow!"
# fi

# rm -rf ~/"$path"
# cp -r ~/dotfiles/"$path" ~/"$path"
#done

(
cd $HOME/dotfiles/rootfs/
find . -type f -printf '%P\n' | while read filename; do
Expand All @@ -25,6 +47,15 @@ done
sudo mkdir -p /"$(dirname "$filename")"
fi

if [[ -f "/$filename" ]]; then
if ! diff /"$filename" ./"$filename"; then
if ! :ask "overwrite /$filename"; then
echo "skipping"
continue
fi
fi
fi

sudo cp ./"$filename" /"$filename"
done
)

0 comments on commit 1531cac

Please sign in to comment.