~tardypad/alpine-system

819e86ef98e12ed392d1f04ba291a612dc6c118d — Damien Tardy-Panis 4 months ago c693d7d
bin: fix build index

The index contains all the packages present in the directory so we
shouldn't do the build on an empty folder, otherwise the index would
contain only one item.

This is different than the build "index" on Arch where a single item
could be added to the existing db.
1 files changed, 4 insertions(+), 6 deletions(-)

M bin/sync
M bin/sync => bin/sync +4 -6
@@ 3,7 3,6 @@
# - lxc
# - mktemp
# - pass
# - scp

init_variables() {
  COMMAND=${0##*/}


@@ 72,14 71,13 @@ build() {
}

import_env() {
  lxc exec "${CONTAINER_NAME}" -- rm -r /home/damien/packages \
  && scp "chestnut:/srv/http/pkgs/alpine/${REPO_NAME}/x86_64/APKINDEX.tar.gz" "${TMP_DIR}/" \
  && lxc file push -p "${TMP_DIR}/APKINDEX.tar.gz" "${CONTAINER_NAME}/home/damien/packages/${REPO_NAME}/x86_64/"
  lxc exec "${CONTAINER_NAME}" -- \
    su -lc "rsync -azh --delete --mkpath chestnut:/srv/http/pkgs/alpine/${REPO_NAME}/ /home/damien/packages/${REPO_NAME}" damien
}

export_env() {
  lxc file pull -r "${CONTAINER_NAME}/home/damien/packages/${REPO_NAME}/x86_64/" "${TMP_DIR}" \
  && scp "${TMP_DIR}/x86_64"/* "chestnut:/srv/http/pkgs/alpine/${REPO_NAME}/x86_64/"
  lxc exec "${CONTAINER_NAME}" -- \
    su -lc "rsync -azh /home/damien/packages/${REPO_NAME}/ chestnut:/srv/http/pkgs/alpine/${REPO_NAME}" damien
}

init_variables