-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathuninstall.sh
More file actions
executable file
·38 lines (32 loc) · 899 Bytes
/
Copy pathuninstall.sh
File metadata and controls
executable file
·38 lines (32 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#! /bin/bash
# from dpeticol's dotfiles, with mods
ignore=( install.sh uninstall.sh .git .gitmodules README.mdown backups )
DIR=~/dotfiles
cd $DIR
for filename in *
do
# check if the file should be ignored
shouldIgnore=false
for ignorename in ${ignore[@]}
do
if [[ $filename == $ignorename ]]
then
shouldIgnore=true
fi
done
# if you shouldn't ignore and the file is a symlink
if [ $shouldIgnore == false -a -L ~/.$filename ]
then
# Delete the symlink
echo deleted ${filename}
rm -rf ~/.$filename
# if the file exists as a backup, restore the backup
if [ -e $DIR/backups/.$filename ]
then
echo ${filename} restored from ${DIR}/backups/${filename}
mv $DIR/backups/.$filename ~/
fi
fi
done
# update the submodules
git submodule update --init