Created
February 6, 2018 09:44
-
-
Save caius/abb6775a912a1553071da2949cd1b907 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
#!/usr/bin/env bash | |
# | |
# Syncs pkgsrc releases to manta | |
# | |
# MIT License - Caius Durling <dev@caius.name> | |
# | |
[[ "$TRACE" ]] && set -o xtrace | |
set -o errexit | |
set -o nounset | |
set -o pipefail | |
set -o noclobber | |
readonly DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
readonly pkgsrc_root="/${MANTA_USER}/public/pkgsrc.chd.cloud" | |
log() { | |
if [[ -z ${2:-} ]]; then | |
level="INFO" | |
else | |
level="$1" | |
shift | |
fi | |
echo -e "$(date +%FT%T) $level: $@" | |
} | |
log "pkgsync reporting for duty" | |
if ! which manta-sync > /dev/null 2>&1; then | |
log "FATAL" "manta-sync required to sync pkgsrc. Please run\n npm install -g manta-sync" | |
exit 1 | |
fi | |
cd $DIR/.. | |
for source in $(find . -type d -maxdepth 1 -not -name bin -not -name .) | |
do | |
source="$(basename "${source}")" | |
destination="${pkgsrc_root}/${source}/x86_64/All" | |
log "Syncing ${source} to ${destination}" | |
manta-sync $@ "${source}" "${destination}" | |
log "${source} synced to ${destination}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment