-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsystem-clean.sh
executable file
·47 lines (41 loc) · 1.19 KB
/
system-clean.sh
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
39
40
41
42
43
44
45
46
47
#!/bin/bash
#===============================================================================
#
# FILE: system-clean.sh
#
# USAGE: ./system-clean.sh
#
# DESCRIPTION: Highlights files in the home directory and other nominated
# locations which are not correctly under version control
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Stu Bevan (SRB), [email protected]
# COMPANY:
# VERSION: 1.0
# CREATED: 31/03/2019 18:15:39 CEST
# REVISION: ---
#===============================================================================
CONFIG_FILE=$1
exclude_str="\( "
filelist=/tmp/clean_1.$$
yadmlist=/tmp/clean_2.$$
#Start with the home directory
IFS=$'\n'
for dir in $(cat $CONFIG_FILE)
do
exclude_str="$exclude_str -path \*/$dir -o "
done
exclude_str="$exclude_str -path $HOME/.yadm \) "
FIND="find $HOME $exclude_str -prune -o -exec ls -Fd {} \; | grep -v '/$'"
yadm list -a > $yadmlist
cat $HOME/.yadm/encrypt >> $yadmlist
exclude_str=""
for entry in $(cat $yadmlist)
do
exclude_str="${exclude_str}${entry}|"
done
exclude_str="${exclude_str}zzzz"
eval $FIND | sed "s,^$HOME/,," | egrep -v "${exclude_str}"