Skip to content

Commit 38d1404

Browse files
committed
cleanup
1 parent 8b08b0f commit 38d1404

File tree

9 files changed

+49
-3
lines changed

9 files changed

+49
-3
lines changed

1

Lines changed: 0 additions & 2 deletions
This file was deleted.

ff renamed to ff.sh

File renamed without changes.

find-used-ref-yaml.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
#
3+
# Checks to see which YAML files listed in a text file are not referenced in AsciiDoc source files.
4+
5+
# Pass a text file containing the YAML filenames (one per line)
6+
FILES="$1"
7+
8+
OCPDOCS_DIR="/home/aireilly/openshift-docs"
9+
10+
# Read $FILES, search for $FILENAME in AsciiDoc, if not found, report the missing file
11+
while IFS= read -r FILENAME; do
12+
find "$OCPDOCS_DIR" -type f -name "*.adoc" -exec grep -qF "$FILENAME" {} \; || echo "$FILENAME is not used."
13+
done < "$FILES"

get-ref-yaml.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
#
3+
# grabs the reference CRs listed in $1 and copies them to /openshift-docs/snippets with a _ztp prefix.
4+
# for example:
5+
# $ ./get-ref-yaml.sh ran_ref_crs.txt 4.13
6+
7+
# pass a text file containing the reference CR filenames
8+
FILES="$1"
9+
10+
# pass the OCP version as the second variable, for example, 4.13
11+
OCP_VERSION="$2"
12+
13+
OCPDOCS_DIR="/home/aireilly/openshift-docs"
14+
15+
# clean up previous
16+
rm -rf out ref && mkdir out ref
17+
18+
# pull the ztp container & extract the source
19+
podman pull registry.redhat.io/openshift4/ztp-site-generate-rhel8:v"$OCP_VERSION"
20+
21+
podman run --log-driver=none --rm registry.redhat.io/openshift4/ztp-site-generate-rhel8:v"$OCP_VERSION" extract /home/ztp --tar | tar x -C ./out
22+
23+
# Read $FILES, find $FILE in /out, and copy to /ref
24+
while IFS= read -r FILENAME; do
25+
find out -name "$FILENAME" -exec cp {} ref \;
26+
done < "$FILES"
27+
28+
# prepend a _ztp prefix to the found files and put them in /openshift-docs
29+
for OUT_FILE in ref/*; do
30+
BASENAME=$(basename "$OUT_FILE")
31+
mv "$OUT_FILE" "$OCPDOCS_DIR/snippets/ztp_$BASENAME"
32+
done
33+
34+
echo " Put ZTP $OCP_VERSION CRs in $OCPDOCS_DIR/snippets"
File renamed without changes.

move-to-bin.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ dest_dir="$HOME/bin"
66

77
for file in "$source_dir"/*.sh; do
88
if [ "$file" != "$source_dir/move-to-bin.sh" ]; then
9-
mv "$file" "$dest_dir/"
9+
file_no_ext=$(basename "$file" .sh)
10+
cp "$file" "$dest_dir/$file_no_ext"
1011
fi
1112
done
1213

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)