Commit b3a46582 authored by sulzbach's avatar sulzbach

Adding features to run create-iso as a cron job

parent 0428e85e
......@@ -5,3 +5,4 @@ _OUTPUT=""
_REPO="stable"
_VERSION=""
_DEBUG=false
_MAIL=false
......@@ -33,6 +33,7 @@ while true; do
-o | --output ) _OUTPUT="$2"; shift; shift ;;
-r | --repo ) _REPO="$2"; shift; shift ;;
-d | --debug ) _DEBUG=true; shift ;;
-s | --sendmail ) _MAIL=true; shift ;;
-* ) echo "Unrecognized option. Try with --help."; \
exit 1 ;;
* ) break ;;
......@@ -96,7 +97,9 @@ if [ "${_REPO}" != "stable" ] && [ "${_REPO}" != "testing" ] && \
exit 1
fi
TIME_STAMP="$(date +'%Y-%m-%dT%H:%M:%S')"
export _MAIL
export TIME_STAMP="$(date +'%Y-%m-%dT%H:%M:%S')"
export LOG_FILE="${LOG_PATH}/create-iso-${TIME_STAMP}.log"
......
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
echo "You must have more power to run this script. Are you root?"
exit -1
fi
SESSION="$(date +'%Y-%m-%d')"
DIR="/home/lucas/create-iso"
CMD="./create-iso.sh --profile le6 --version 6.1.1 --repo testing --debug --sendmail"
# Create GNU screen session
screen -dmS "${SESSION}" || exit 1
# Execute c3geniso in the main window
screen -S "${SESSION}" -X stuff "pushd ${DIR} && ${CMD} && exit\n" || exit 2
exit 0
......@@ -54,6 +54,11 @@ createIsoLogger() {
echo -e "${LOG_LINE}" >> "${LOG_FILE}"
if [ "${TYPE}" -eq "${ERROR}" ] || [ "${TYPE}" -eq "${DEBUG}" ]; then
[[ "${_MAIL}" == true ]] && sendmail -t <<< \
"$(sed "s/##SUBJECT##/${TIME_STAMP}/" < \
"${PREFIX}/mail.txt" && screen -ls; echo ""; \
tail --lines=20 "${LOG_FILE}")" || createIsoLogger -m \
"Unable to send mail"
/bin/bash
fi
else
......
To: ls17@c3sl.ufpr.br
Subject: ##SUBJECT##
......@@ -14,7 +14,7 @@ ubiquity ubiquity/success_command \
in-target apt-cdrom add --fast --no-mount </dev/null; \
in-target apt-get update --yes; \
in-target apt-get install --yes lc-conf; \
if grep -qi "Server" "/etc/default/version"; then \
if grep -qi "server" "/etc/default/version"; then \
in-target env DEBIAN_FRONTEND=noninteractive apt-get install --yes -o \
Dpkg::Options::="--force-confnew" lc-server-all; \
else \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment