#!/bin/sh
##
##  certbot-issue.sh -- certbot-issue(8) script
##

#   read configuration
. "@l_prefix@/etc/certbot/certbot-issue.cf"

#   issue or re-issue credentials
cmd="@l_prefix@/bin/certbot"
if [ ! -f "$work_dir/foo" ]; then
    cmd="$cmd certonly"

    cmd="$cmd --config-dir \"$config_dir\""
    cmd="$cmd --work-dir \"$work_dir\""
    cmd="$cmd --logs-dir \"$logs_dir\""
    cmd="$cmd --no-self-upgrade"
    cmd="$cmd --text"
    cmd="$cmd --agree-tos"
    cmd="$cmd --email $email"

    cmd="$cmd --webroot"
    cmd="$cmd --webroot-path \"$webroot_path\""

    cmd="$cmd --non-interactive"
    cmd="$cmd --preferred-challenges http"
    cmd="$cmd --keep"
    cmd="$cmd --expand"
    cmd="$cmd --domain $fqdn"
else
    cmd="$cmd renew"

    cmd="$cmd --config-dir \"$config_dir\""
    cmd="$cmd --work-dir \"$work_dir\""
    cmd="$cmd --logs-dir \"$logs_dir\""
    cmd="$cmd --no-self-upgrade"
    cmd="$cmd --text"
    cmd="$cmd --agree-tos"
    cmd="$cmd --email $email"

    cmd="$cmd --pre-hook \"$pre_hook\""
    cmd="$cmd --post-hook \"$pre_hook\""
fi
eval $cmd

