diff --git a/export_gpg_private b/export_gpg_private index a14db0f..40c5f1e 100755 --- a/export_gpg_private +++ b/export_gpg_private @@ -2,6 +2,8 @@ . settings +require_pass_name_key + if [[ ! -d $KEYDIR ]] ; then echo "Keydir $KEYDIR doesn't exist" exit 1 diff --git a/generate_gpg b/generate_gpg index 378d65c..97c2600 100755 --- a/generate_gpg +++ b/generate_gpg @@ -13,6 +13,8 @@ if [[ -n $FULLGPGKEY ]] ; then exit 2 fi +require_pass_name_gpg + mkdir -m 0700 $KEYDIR ( gopass show --password "$PASS_NAME_GPG" 2> /dev/null || gopass generate "$PASS_NAME_GPG" 20 ) > /dev/null diff --git a/import_gpg_private b/import_gpg_private index 7349b95..fab49a2 100755 --- a/import_gpg_private +++ b/import_gpg_private @@ -2,6 +2,8 @@ . settings +require_pass_name_key + if [[ ! -d "$KEYDIR" ]] ; then mkdir -p -m 0700 "$KEYDIR" fi diff --git a/releases/foreman/settings b/releases/foreman/settings index ae51007..962aca9 100644 --- a/releases/foreman/settings +++ b/releases/foreman/settings @@ -1,3 +1,11 @@ -TAR_PROJECTS="foreman foreman-proxy foreman-installer foreman-selinux" -RPM_PACKAGES=(foreman foreman-installer foreman-proxy foreman-release foreman-selinux) -PACKAGING_SUBDIR="packages/foreman" +# This deals with inheritance with other projects +if [[ -z $FOREMAN_VERSION ]] ; then + TAR_PROJECTS="foreman foreman-proxy foreman-installer foreman-selinux" + RPM_PACKAGES=(foreman foreman-installer foreman-proxy foreman-release foreman-selinux) + PACKAGING_SUBDIR="packages/foreman" +else + FOREMAN_VERSION=$VERSION +fi + +PASS_NAME_GPG="theforeman/releases/foreman/${FOREMAN_VERSION}-gpg" +PASS_NAME_KEY="theforeman/releases/foreman/${FOREMAN_VERSION}-key" diff --git a/settings b/settings index fd06403..d2a7a47 100644 --- a/settings +++ b/settings @@ -21,6 +21,17 @@ load_settings() { # Expected: FULLGPGKEY # Optional: FULLVERSION . "$RELEASEDIR/settings" + + if [[ $PROJECT != foreman ]]; then + if [[ -z "$FOREMAN_VERSION" ]]; then + echo "please set FOREMAN_VERSION in $RELEASEDIR/settings" + exit 1 + elif [[ "$FOREMAN_VERSION" != "none" ]]; then + # load foreman settings, which will contain keys etc + . releases/foreman/settings + . "releases/foreman/${FOREMAN_VERSION}/settings" + fi + fi } # Prepare settings file @@ -29,19 +40,6 @@ if [[ ! -d "$RELEASEDIR" ]] ; then echo "FULLVERSION='${VERSION}.0-rc1'" > "$RELEASEDIR/settings" fi -if [[ $PROJECT != foreman ]]; then - load_settings - if [[ -z "$FOREMAN_VERSION" ]]; then - echo "please set FOREMAN_VERSION in $RELEASEDIR/settings" - exit 1 - elif [[ "$FOREMAN_VERSION" != "none" ]]; then - # load foreman settings, which will contain keys etc - . "releases/foreman/${FOREMAN_VERSION}/settings" - fi -else - FOREMAN_VERSION="$VERSION" -fi - SIGNER="packages@theforeman.org" SIGNER_NAME="Foreman Automatic Signing Key" OSES="" @@ -52,8 +50,6 @@ TARDIR="$RELEASEDIR/tarballs" EXTRASDIR="$RELEASEDIR/extras" HOSTS="web01.osuosl.theforeman.org," DOCROOT="/var/www/vhosts/downloads/htdocs" -PASS_NAME_GPG="theforeman/releases/foreman/$FOREMAN_VERSION-gpg" -PASS_NAME_KEY="theforeman/releases/foreman/$FOREMAN_VERSION-key" XARGS_JOBS="-n 20 -P 4" GIT_DIR="${GIT_DIR:-$HOME/dev}" GIT_USE_WORKTREES=false @@ -72,7 +68,22 @@ load_settings HALFGPGKEY="$(echo ${FULLGPGKEY: -16} | tr '[A-Z]' '[a-z]')" +require_pass_name_gpg() { + if [[ -z $PASS_NAME_GPG ]] ; then + echo "Set PASS_NAME_GPG in the settings" + exit 1 + fi +} + +require_pass_name_key() { + if [[ -z $PASS_NAME_KEY ]] ; then + echo "Set PASS_NAME_KEY in the settings" + exit 1 + fi +} + show_gpg_password() { + require_pass_name_gpg gopass show --password "$PASS_NAME_GPG" }