Created
February 2, 2020 21:58
-
-
Save cemkeylan/2a66ffa865c8a35f865166013eec5cf5 to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
# $1: rootfs-tarball | |
# $2: httpd releases directory | |
out() { printf '\033[1;36m-> \033[m%s\n' "$@" ;} | |
error() { printf '\033[1;31m!> \033[1mERROR: \033[m%s\n' "$@" >&2 ;} | |
die() { error "$1" ; exit 1 ;} | |
usage() { printf 'usage: %s <tarball> <release directory>\n' "${0##*/}" ; exit 1 ;} | |
[ "$2" ] || usage | |
[ -f "$1" ] || usage | |
[ -d "$2" ] || usage | |
rootfs="$(basename "$1")" | |
releasedir="$(realpath "$2")" | |
# Sign release with gnupg | |
gpg --output "$rootfs.sig" --detach-sig "$rootfs" || die "Could not create gpg signature" | |
# Copy rootfs and signature to httpd directory | |
mkdir -p "$releasedir" || die "Could not create $releasedir/sig" | |
cp "$rootfs.sig" "$releasedir/$rootfs.sig" || error "Could not copy rootfs signature" | |
cp "$rootfs" "$releasedir/$rootfs" || die "Could not copy $rootfs to $releasedir" | |
# Link rootfs to the latest | |
ln -sfv "$rootfs" "$releasedir/carbs-rootfs.tar.xz" || error "Could not link rootfs to the latest" | |
( | |
cd "$releasedir" || die "Could not change directory to $releasedir" | |
sha256sum -- * > sha256sums.txt | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment