sync-to-staging-sig.sh 923 Bytes
Newer Older
Louis Abel's avatar
Louis Abel committed
1
#!/bin/bash
2
3

# Source common variables
Louis Abel's avatar
Louis Abel committed
4
# shellcheck disable=SC2046,1091,1090
5
source "$(dirname "$0")/common"
6

Louis Abel's avatar
Louis Abel committed
7
# Major Version (eg, 8)
8
MAJ=${1}
Louis Abel's avatar
Louis Abel committed
9
10
11
# Short name (eg, NFV, extras, Rocky, gluster9)
SHORT=${2}
# The directory where we're going to, usually MAJOR.MINOR, sometimes it's MAJOR.MINOR-RCX
12
REV=${3}
Louis Abel's avatar
Louis Abel committed
13
14
# Note, this should be lowercase. eg, storage.
SIG=${4}
15

Louis Abel's avatar
sigh    
Louis Abel committed
16
cd "/mnt/compose/${MAJ}/latest-${SHORT}-${MAJ}/compose" || { echo "Failed to change directory"; ret_val=1; exit 1; }
Louis Abel's avatar
Louis Abel committed
17
ret_val=$?
18

Louis Abel's avatar
Louis Abel committed
19
if [ $ret_val -eq "0" ]; then
Louis Abel's avatar
Louis Abel committed
20
21
  TARGET=${STAGING_ROOT}/${CATEGORY_STUB}/${REV}/${SIG}
  mkdir -p "${TARGET}"
Louis Abel's avatar
Louis Abel committed
22
23
24
  # disabling because none of our files should be starting with dashes. If they
  # are something is *seriously* wrong here.
  # shellcheck disable=SC2035
25
  sudo -l && find **/* -maxdepth 0 -type d | parallel --will-cite -j 18 sudo rsync -av --chown=10004:10005 --progress --relative --human-readable \
Louis Abel's avatar
Louis Abel committed
26
      {} "${TARGET}"
Louis Abel's avatar
Louis Abel committed
27
fi