-
Notifications
You must be signed in to change notification settings - Fork 0
/
depcheck
executable file
·118 lines (101 loc) · 2.99 KB
/
depcheck
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/bash
keep=false
twoconf=false
for var in "$@"
do
if [[ "$var" == "-h" || "$var" == "--help" ]]; then
echo "Usage: depcheck repo_name [optional: custom yum.conf]"
echo "Example: depcheck centos7-rutgers-testing-temp"
echo "Note: To use -k, add it after the rest otherwise the program will fail"
exit 0
fi
if [[ "$var" == "-k" ]]; then
keep=true
fi
done
if [[ $keep = false && $# -eq 2 && ! -f "$2" ]]; then
echo "That file does not exist"
exit 1
fi
if [[ $keep = false && $# -eq 2 && -f "$2" ]]; then
twoconf=true
fi
if [[ $keep = true && $# -eq 3 && ! -f "$2" ]]; then
echo "That file does not exist"
exit 1
fi
if [[ $keep = true && $# -eq 3 && -f "$2" ]]; then
twoconf=true
fi
source /etc/rutgers-repotools-2.cfg
input=$1
ver=${input//[^0-9]/}
error=false
extra_repos=""
if [[ $ver -lt 7 ]]; then
if [[ $1 == *"testing"* ]]; then
extra_repos="-l centos$ver-rutgers-current -l centos$ver-rutgers-current-32";
fi
if [[ $1 == *"unstable"* ]]; then
extra_repos="-l centos$ver-rutgers-current -l centos$ver-rutgers-testing-current \
-l centos$ver-rutgers-current-32 -l centos$ver-rutgers-testing-current-32";
fi
else
if [[ $1 == *"testing"* ]]; then
extra_repos="-l centos$ver-rutgers-current";
fi
if [[ $1 == *"unstable"* ]]; then
extra_repos="-l centos$ver-rutgers-current -l centos$ver-rutgers-testing-current";
fi
fi
echo "Checking Dependencies"
if [[ $ver -lt 7 ]]; then
if [[ $twoconf = true ]]; then
repoclosure -t -r $1 -r $1-32 --config=$YUMCNF --config=$2 \
-l base$ver-32 -l updates$ver-32 -l extras$ver-32 \
-l base$ver -l updates$ver -l extras$ver -l epel$ver $extra_repos > $TMPRPL
else
repoclosure -t -r $1 -r $1-32 --config=$YUMCNF \
-l base$ver-32 -l updates$ver-32 -l extras$ver-32 \
-l base$ver -l updates$ver -l extras$ver -l epel$ver $extra_repos > $TMPRPL
fi
else
if [[ $twoconf = true ]]; then
repoclosure -t -r $1 --config=$YUMCNF --config=$2 \
-l base$ver -l updates$ver -l extras$ver -l epel$ver $extra_repos > $TMPRPL
else
repoclosure -t -r $1 --config=$YUMCNF \
-l base$ver -l updates$ver -l extras$ver -l epel$ver $extra_repos > $TMPRPL
fi
fi
rm -r /var/tmp/yum-${USER}-*
sed -n '/unresolved\ deps/{:a;n;/package:\ /b;p;ba}' $TMPRPL \
> $URDEPS
touch $RDPROB
while read line; do
grep -q -i "$line" $DPIGN
if [[ "$?" != "0" ]]; then
echo "Missing dependency: $line" >> $RDPROB
error=true
fi
done < $URDEPS
if [ "$error" = true ]; then
echo -e "\nDependency errors detected:"
cat $RDPROB
echo -e "\nOutput from repoclosure:"
cat $TMPRPL
echo -e ""
if [[ "$keep" = false ]]; then
rm $RDPROB
rm $TMPRPL
rm $URDEPS
fi
exit 1
fi
if [[ "$keep" = false ]]; then
rm $RDPROB
rm $TMPRPL
rm $URDEPS
fi
echo "No Dependency errors found"
exit 0