Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ansible/ansible-role-rocky-stig
Submodule ansible-role-rocky-stig added at bd8729
Empty file added tools/README.md
Empty file.
50 changes: 50 additions & 0 deletions tools/RepoName
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash
# Get arguements Repo and Url.
while getopts r:u: flag
do
case "${flag}" in
r) repository_name=${OPTARG};;
u) url=${OPTARG};;
esac
done
# Uncomment for debugging Verify Arguements
#echo "$url $repository_name $help"

declare -a Debrand=("s/rhel8/rocky8/g" "s/redhat/rocky/g" "s/CentOS/Rocky/g" "s/RedHat/Rocky/g")

# If URL or Repository Name not Provided echo usage.
if [[ -z "$repository_name" ]] || [[ -z "$url" ]] || [[ ! -z "$help" ]];
then
echo "USAGE: $0 -r RepoName (ansible-role-rhel8-stig) -u URL (https://github.com/RedHatOfficial/)\nThis will create a subfolder with the new repository under the parent folder ansible. In the directory where the script is run.";
else
# Create directory and git repos.
mkdir -p ansible
cd ansible
git clone $url/$repository_name
declare -a Files=(`find . -type f -not -path '*/\.*'`)

# For each set of Debrand run through all files and change the Name.
for f in "${Files[@]}"
do
for d in "${Debrand[@]}"
do
# Uncomment for Debugging
# echo sed -i $d $f
sed -i $d $f

done
done
new_repostitory_name=`echo $repository_name | sed 's/rhel8/rocky/g'`
mv $repository_name $new_repostitory_name
fi
#Check if branding stil exists.
redhat=(`grep -rci 'redhat' | grep -v .git | cut -d: -f2-`)
centos=(`grep -rci 'centos' | grep -v .git | cut -d: -f2-`)
rhel8=(`grep -rci 'rhel8' | grep -v .git | cut -d: -f2-`)
declare -i sumredhat
declare -i sumcentos
declare -i sumrhel8
IFS=+ sumredhat="${redhat[*]}"
IFS=+ sumcentos="${centos[*]}"
IFS=+ sumrhel8="${rhel8[*]}"
printf "Mentions of RedHat found: $sumredhat\nMentions of CentOS found: $sumcentos\nMentions of rhel8 found: $sumrhel8\n"
46 changes: 46 additions & 0 deletions tools/scap-ansible-debrand2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash
# Get arguements Repo and Url.
while getopts r:u: flag
do
case "${flag}" in
r) repository_name=${OPTARG};;
u) url=${OPTARG};;
esac
done
# Uncomment for debugging Verify Arguements
#echo "$url $repository_name $help"
declare -a Debrand=("s/rhel8/rocky8/g" "s/redhat/rocky/g" "s/CentOS/Rocky/g" "s/RedHat/Rocky/g")
# If URL or Repository Name not Provided echo usage.
if [[ -z "$repository_name" ]] || [[ -z "$url" ]] || [[ ! -z "$help" ]];
then
echo "USAGE: $0 -r RepoName (ansible-role-rhel8-stig) -u URL (https://github.com/RedHatOfficial/)\nThis will create a subfolder with the new repository under the parent folder ansible. In the directory where the script is run.";
else
# Create directory and git repos.
mkdir -p ansible
cd ansible
git clone $url/$repository_name
declare -a Files=(`find scripts/ansible/ -type f -not -path '*/\.*'`)
# For each set of Debrand run through all files and change the Name.
for f in "${Files[@]}"
do
for d in "${Debrand[@]}"
do
# Uncomment for Debugging
# echo sed -i $d $f
sed -i $d $f
done
done
new_repostitory_name=`echo $repository_name | sed 's/rhel8/rocky/g'`
mv $repository_name $new_repostitory_name
fi
#Check if branding stil exists.
redhat=(`grep -rci 'redhat' ansible | grep -v .git | cut -d: -f2-`)
centos=(`grep -rci 'centos' ansible | grep -v .git | cut -d: -f2-`)
rhel8=(`grep -rci 'rhel8' ansible | grep -v .git | cut -d: -f2-`)
declare -i sumredhat
declare -i sumcentos
declare -i sumrhel8
IFS=+ sumredhat="${redhat[*]}"
IFS=+ sumcentos="${centos[*]}"
IFS=+ sumrhel8="${rhel8[*]}"
printf "Mentions of RedHat found: $sumredhat\nMentions of CentOS found: $sumcentos\nMentions of rhel8 found: $sumrhel8\n"