Finish up lab3

This commit is contained in:
2025-06-16 18:49:18 -07:00
parent d1e7574cf9
commit e7297ff195
10 changed files with 261 additions and 217 deletions

View File

@ -9,15 +9,15 @@ cd /labs || { echo "Error: /labs directory not found in container. Exiting."; ex
# Find all directories prefixed with "lab-"
find . -maxdepth 1 -type d -name "lab-*" | while read lab_dir; do
echo "Processing directory: $lab_dir"
markdown_file="$lab_dir/LAB-REPORT.md"
pdf_file="$lab_dir/LAB-REPORT.pdf"
markdown_file="$lab_dir/README.md"
pdf_file="$lab_dir/README.pdf"
# Check if LAB-REPORT.md exists
if [ -f "$markdown_file" ]; then
echo "Found $markdown_file"
# Check if LAB-REPORT.pdf does not exist
if [ ! -f "$pdf_file" ]; then
echo "LAB-REPORT.pdf not found. Generating PDF from markdown..."
echo "README.pdf not found. Generating PDF from markdown..."
# Generate PDF using pandoc
# Make sure 'pandoc' command is available in the image, which it is for pandoc/latex
image_dir="$lab_dir"
@ -29,10 +29,10 @@ find . -maxdepth 1 -type d -name "lab-*" | while read lab_dir; do
echo "Error generating $pdf_file"
fi
else
echo "LAB-REPORT.pdf already exists. Skipping generation."
echo "README.pdf already exists. Skipping generation."
fi
else
echo "LAB-REPORT.md not found in $lab_dir. Skipping."
echo "README.md not found in $lab_dir. Skipping."
fi
done

View File

@ -1,14 +1,11 @@
#!/bin/bash
MFA_TOKEN=$1
<<<<<<< HEAD
=======
# Capture everything from second argument onward as a command
shift
COMMAND=("$@")
>>>>>>> 1437cee (Add resume pdf & html)
if [ -z "$1" ]; then
if [ -z "MFA_TOKEN" ]; then
echo "Error: Run with MFA token!"
exit 1
fi
@ -31,13 +28,9 @@ export AWS_SECRET_ACCESS_KEY=$(echo "$SESSION_OUTPUT" | jq '.Credentials.SecretA
#echo $AWS_SESSION_TOKEN
#echo $AWS_ACCESS_KEY_ID
#echo $AWS_SECRET_ACCESS_KEY
<<<<<<< HEAD
aws s3 ls s3://witch-lab-3
echo "finished!"
=======
# aws s3 ls s3://witch-lab-3
if command -v "$COMMAND" >/dev/null 2>&1; then
"${COMMAND[@]}"
else
aws s3 ls s3://witch-lab-3
fi
>>>>>>> 1437cee (Add resume pdf & html)

View File

@ -0,0 +1,11 @@
#!/bin/bash
if [ -z $BW_AWS_ACCOUNT_SECRET_ID ]; then
echo "env var BW_AWS_ACCOUNT_SECRET_ID must be set!"
exit 1
fi
AWS_SECRETS=$(bw get item $BW_AWS_ACCOUNT_SECRET_ID)
export AWS_ACCESS_KEY_ID=$(echo "$AWS_SECRETS" | jq -r '.fields[0].value')
export AWS_SECRET_ACCESS_KEY=$(echo "$AWS_SECRETS" | jq '.fields[1].value' | tr -d '"')