-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
To allow multiple publishers per build, separate the publishing function into its own space, and add sftp/cp examples. While there, make use of clean room builds in hbsd-update-build and remove the assumption that all published builds must be signed (here be dragons).
- Loading branch information
Showing
5 changed files
with
190 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#- | ||
# Copyright (c) 2018 HardenedBSD | ||
# Author: Johannes Meixner <[email protected]> | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions | ||
# are met: | ||
# 1. Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# 2. Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in the | ||
# documentation and/or other materials provided with the distribution. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
# SUCH DAMAGE. | ||
|
||
|
||
function do_publish() { | ||
local dnsstr publish_user publish_host publish_path ver build dnsstr ver | ||
local config=$1 i=$2 dnsstr=$3 ver=$4 | ||
|
||
# foreach publish[i] | ||
# method = jq .build[i][publish]j | ||
npublish=$(jq -r ".builds[$i].publish | length" ${config}) | ||
for ((j=0; j<${npublish}; j++)); do | ||
method=$(jq -r ".builds[$i].publish[$j].method" ${config}) | ||
if [ ! -f lib/publishers/${method}.zsh ]; then | ||
echo "[-] Publisher for ${method} does not exist." | ||
continue | ||
else | ||
. "lib/publishers/${method}.zsh" | ||
fi | ||
if [ ! "$(whence -w publish_${method})" = "publish_${method}: function" ]; then | ||
echo "[-] Publisher method for ${method} does not exist." | ||
continue | ||
fi | ||
echo "[*] Publishing ${name} via ${method}" | ||
publish_${method} ${config} ${i} ${j} ${dnsstr} ${ver} | ||
done | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#- | ||
# Copyright (c) 2018 HardenedBSD | ||
# Author: Johannes Meixner <[email protected]> | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions | ||
# are met: | ||
# 1. Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# 2. Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in the | ||
# documentation and/or other materials provided with the distribution. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
# SUCH DAMAGE. | ||
|
||
function publish_cp() { | ||
local publish_path | ||
local config=$1 i=$2 j=$3 dnsstr=$4 ver=$5 | ||
|
||
echo ${dnsstr} > ${tmpfile} | ||
chmod 744 ${tmpfile} | ||
|
||
|
||
publish_path=$(jq -r ".builds[${i}].publish[$j].directory" ${config}) | ||
|
||
mkdir -p ${publish_path} | ||
|
||
cp -a /builds/updater/output/update-${ver}.tar \ | ||
${publish_path}/ | ||
cp -a ${tmpfile} ${publish_path}/update-latest.txt | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#- | ||
# Copyright (c) 2018 HardenedBSD | ||
# Author: Shawn Webb <[email protected]> | ||
# | ||
# This work originally sponsored by G2, Inc | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions | ||
# are met: | ||
# 1. Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# 2. Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in the | ||
# documentation and/or other materials provided with the distribution. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
# SUCH DAMAGE. | ||
|
||
function publish_sftp() { | ||
local publish_user publish_host publish_path tmpfile | ||
local config=$1 i=$2 j=$3 dnsstr=$4 ver=$5 | ||
tmpfile=$(mktemp) | ||
|
||
|
||
publish_user=$(jq -r ".builds[${i}].publish[$j].user" ${config}) | ||
publish_host=$(jq -r ".builds[${i}].publish[$j].host" ${config}) | ||
publish_path=$(jq -r ".builds[${i}].publish[$j].directory" ${config}) | ||
|
||
echo ${dnsstr} > ${tmpfile} | ||
chmod 744 ${tmpfile} | ||
|
||
|
||
sudo -u ${publish_user} scp /builds/updater/output/update-${ver}.tar \ | ||
${publish_host}:${publish_path}/ | ||
sudo -u ${publish_user} scp ${tmpfile} \ | ||
${publish_host}:${publish_path}/update-latest.txt | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters