Skip to content

Commit

Permalink
switch ubuntu qna script
Browse files Browse the repository at this point in the history
  • Loading branch information
jgstew committed Jun 19, 2024
1 parent 3a605bb commit 71b632d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/test_run_qna.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ on:
- "bash/bigfix_run_qna_debian.sh"
- "bash/bigfix_run_qna_macos.sh"
- "bash/bigfix_run_qna_rhel_family.sh"
- "bash/bigfix_run_qna_ubuntu.sh"
branches:
- "**"

env:
relevance: ("Team Demo"; it) of pathnames of (files of it; folders of it) of folders ("/tmp";"/Windows/Temp")
relevance: ( (it as string) of operating system ; version of client ; elements of it ) of sets of pathnames of (files of it; folders of it) of folders ("/tmp";"/Windows/Temp")

jobs:
test_run_qna_docker:
Expand All @@ -32,7 +33,7 @@ jobs:
bash bash/bigfix_run_qna_rhel_family.sh '${{ env.relevance }}' > qna_output.txt
cat qna_output.txt
cat qna_output.txt | grep "A: " | sed 's/^.*: //' > qna_markdown.txt
echo "## Linux QNA:" >> $GITHUB_STEP_SUMMARY
echo "## Linux RHEL QNA:" >> $GITHUB_STEP_SUMMARY
echo "### Errors:" >> $GITHUB_STEP_SUMMARY
cat qna_output.txt | grep "E: " | sed 's/^.*: //' >> $GITHUB_STEP_SUMMARY
echo "### Result Type:" >> $GITHUB_STEP_SUMMARY
Expand All @@ -56,10 +57,10 @@ jobs:
if: runner.os == 'Linux'
# https://github.com/jgstew/tools/blob/master/bash/bigfix_run_qna_debian.sh
run: |
bash bash/bigfix_run_qna_debian.sh '${{ env.relevance }}' > qna_output.txt
bash bash/bigfix_run_qna_ubuntu.sh '${{ env.relevance }}' > qna_output.txt
cat qna_output.txt
cat qna_output.txt | grep "A: " | sed 's/^.*: //' > qna_markdown.txt
echo "## Linux QNA:" >> $GITHUB_STEP_SUMMARY
echo "## Linux Ubuntu QNA:" >> $GITHUB_STEP_SUMMARY
echo "### Errors:" >> $GITHUB_STEP_SUMMARY
cat qna_output.txt | grep "E: " | sed 's/^.*: //' >> $GITHUB_STEP_SUMMARY
echo "### Result Type:" >> $GITHUB_STEP_SUMMARY
Expand Down
27 changes: 27 additions & 0 deletions bash/bigfix_run_qna_ubuntu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

args=$*

# TODO: detect if Ubuntu
# cat /etc/os-release /etc/lsb-release | grep --ignore-case --max-count=1 --count ubuntu

if ! [ -f /tmp/BESAgent-ubuntu.deb ]; then
curl -o /tmp/BESAgent-ubuntu.deb https://software.bigfix.com/download/bes/110/BESAgent-11.0.2.125-ubuntu18.amd64.deb
fi

# https://www.cyberciti.biz/faq/how-to-extract-a-deb-file-without-opening-it-on-debian-or-ubuntu-linux/
ar x /tmp/BESAgent-ubuntu.deb --output=/tmp

tar --overwrite --extract --file=/tmp/data.tar.gz --directory=/tmp --exclude=var* --exclude=etc* --exclude=lib/*

rm /tmp/control.tar.gz
rm /tmp/data.tar.gz
rm /tmp/debian-binary
rm --dir /tmp/lib

# get arg length
len=${#args}
if [ $len -lt 3 ]; then
/tmp/opt/BESClient/bin/qna -showtypes
else
echo $args | /tmp/opt/BESClient/bin/qna -showtypes
fi

0 comments on commit 71b632d

Please sign in to comment.