Skip to content

Commit

Permalink
Add removal phase
Browse files Browse the repository at this point in the history
  • Loading branch information
mudler committed May 3, 2019
1 parent 25af319 commit c3b0468
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion sark-localcreaterepo
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export REPO_CLEAN_EXPIRE="${REPO_CLEAN_EXPIRE:-0}"
export REPO_CLEAN_EXPIRE_DAYS="${REPO_CLEAN_EXPIRE_DAYS:-1}"
# Clean obsolete packages .tgz under binhost directory
export REPO_BINHOST_CLEAN="${REPO_BINHOST_CLEAN:-0}"
export SAB_BUILDFILE=${SAB_BUILDFILE:-build.yaml}

export REPOSITORY_DESCRIPTION="${REPOSITORY_DESCRIPTION:-Autogenerated repository}"
export ENTROPY_DIR="${ENTROPY_DIR:-/${SAB_WORKSPACE}/artifacts/${REPOSITORY_NAME}}"
Expand All @@ -22,6 +23,13 @@ set -e

. /sbin/sark-functions.sh

if [ ! -e ${SAB_BUILDFILE} ]; then
echo "Must be run from a repository directory containing a ${SAB_BUILDFILE}"
exit 1
fi

load_env_from_yaml ${SAB_BUILDFILE}

cat >/etc/entropy/server.conf <<EOF
# expiration-days = <internal value>
community-mode = enable
Expand Down Expand Up @@ -83,8 +91,16 @@ eit key import ${REPOSITORY_NAME} ${SAB_WORKSPACE}/confs/${REPOSITORY_NAME}.key
echo "=== Injecting packages ==="
echo "INJECT = ${built_pkgs}"
eit inject --to ${REPOSITORY_NAME} --quick ${built_pkgs} || { echo "ouch unable to inject" && exit 3; }

echo "=== Inject COMPLETED ====="

echo "=== Removing packages ==="

if [ -n "${TOREMOVE}" ]; then
echo "Yes" | eit rm --from $REPOSITORY_NAME $TOREMOVE || { echo "ouch unable to remove" && exit 3; }
fi

echo "=== Removing packages completed ==="

if [[ ${SKIP_COMMIT} = 0 ]] ; then
echo "=== Commit packages ====="
eit commit --quick
Expand Down

0 comments on commit c3b0468

Please sign in to comment.