#!/usr/bin/env bash

if [ "$#" -ne 1 ]; then
  echo "Usage: $0 <service1> <service2> ..."
  exit 1
fi

PASSWORD=$(openssl rand -base64 12)

TEMP=$(mktemp -d)

for FILE in "$@"; do
  cp -r "$FILE" "$TEMP/$FILE"
done

(cd "$TEMP" && zip -r -P "$PASSWORD" services.zip .)
mv "$TEMP/services.zip" .
echo "Created services.zip containing handout directories with password '$PASSWORD'."
echo $PASSWORD > pass
