diff --git a/ansible/ansible-role-rocky-stig b/ansible/ansible-role-rocky-stig new file mode 160000 index 00000000..bd8729b8 --- /dev/null +++ b/ansible/ansible-role-rocky-stig @@ -0,0 +1 @@ +Subproject commit bd8729b813bcbaef433d14338bda6e3942a2b3c8 diff --git a/tools/README.md b/tools/README.md new file mode 100644 index 00000000..e69de29b diff --git a/tools/RepoName b/tools/RepoName new file mode 100644 index 00000000..2d198d12 --- /dev/null +++ b/tools/RepoName @@ -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" diff --git a/tools/scap-ansible-debrand2.sh b/tools/scap-ansible-debrand2.sh new file mode 100644 index 00000000..45cf5d8f --- /dev/null +++ b/tools/scap-ansible-debrand2.sh @@ -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"