@@ -40,6 +40,7 @@ download_repo()
40
40
# Create directory and git repos.
41
41
url=$1
42
42
repository_name=$2 ;
43
+ declare -a Debrand=(" s/rhel8/rocky8/g" " s/redhat/rocky/g" " s/CentOS/Rocky/g" " s/RedHat/Rocky/g" " s/Red\sHat/Rocky/g" " s/red\shat/rocky/g" );
43
44
echo " $url $repository_name "
44
45
git clone $url /$repository_name ;
45
46
declare -a Files=(` find $dir /ansible/ -type f -not -path ' */\.*' ` )
@@ -63,9 +64,9 @@ one_repo()
63
64
then
64
65
show_help
65
66
fi
67
+ echo " Passed in -r this will download the specified repository $repo "
66
68
download_repo " $url " " $repo "
67
69
check_repo
68
- exit ;
69
70
}
70
71
# Get all repositories from provided source.
71
72
all_repos ()
@@ -74,33 +75,37 @@ all_repos()
74
75
show_help;
75
76
exit ;
76
77
fi
77
- echo " This Sectrion is not completed yet ."
78
+ echo " Passed in -a this will download and clean all repos with rhel8 in the name ."
78
79
repos=(` curl -sL $url | grep ' href' | grep ' rhel8' | grep item | sed ' s/.*\/RedHatOfficial\///g' | sed ' s/".*//g' | tr ' \n' ' ' ` );
79
80
for r in ${repos[@]} ; do
80
81
echo " Downloading and rebranding $r "
81
82
download_repo " $url " " $r "
82
83
done ;
83
84
check_repo
84
- exit ;
85
85
}
86
86
87
87
# Verify repositories are cleaned.
88
88
check_repo ()
89
89
{
90
90
if [[ -d " $dir /ansible/" ]]; then
91
+ cd $dir /ansible
91
92
# Check if branding stil exists.
92
- redhat=(` grep -rci ' redhat' $dir /ansible/ | grep -v .git | cut -d: -f2-` )
93
- centos=(` grep -rci ' centos' $dir /ansible/ | grep -v .git | cut -d: -f2-` )
94
- rhel8=(` grep -rci ' rhel8' $dir /ansible/ | grep -v .git | cut -d: -f2-` )
93
+ redhat=(` grep -rci ' redhat' | grep -v .git | cut -d: -f2-` )
94
+ centos=(` grep -rci ' centos' | grep -v .git | cut -d: -f2-` )
95
+ rhel8=(` grep -rci ' rhel8' | grep -v .git | cut -d: -f2-` )
96
+ red_hat=(` grep -rci ' red hat' | grep -v .git | cut -d: -f2-` )
95
97
declare -i sumredhat
96
98
declare -i sumcentos
97
99
declare -i sumrhel8
98
100
IFS=+ sumredhat=" ${redhat[*]} "
101
+ IFS=+ sumred_hat=" ${red_hat[*]} "
99
102
IFS=+ sumcentos=" ${centos[*]} "
100
103
IFS=+ sumrhel8=" ${rhel8[*]} "
101
104
# Run through the list of copyrighted names and grep out any names still remaining.
102
105
if [[ $sumredhat -gt 0 ]]; then
103
106
echo " Mentions of RedHat still found: $sumredhat \n" ;
107
+ elif [[ $sumred_hat -gt 0 ]]; then
108
+ echo " Mentions of Red Hat still found: $sumred_hat \n" ;
104
109
elif [[ $sumcentos -gt 0 ]]; then
105
110
echo " Mentions of CentOS still found found: $sumcentos \n" ;
106
111
elif [[ $sumrhel8 -gt 0 ]]; then
@@ -138,7 +143,6 @@ while getopts ":u:r:ahv" FLAG; do
138
143
done
139
144
# Uncomment for debugging Verify Arguements
140
145
# echo "$url $repository_name $help"
141
- declare -a Debrand=(" s/rhel8/rocky8/g" " s/redhat/rocky/g" " s/CentOS/Rocky/g" " s/RedHat/Rocky/g" );
142
146
# If URL not provided echo usage.
143
147
if [[ $# -eq 0 ]]; then
144
148
show_help
0 commit comments