Created
February 24, 2022 10:39
-
-
Save bechampion/aa5046941308638b72402e84edca334b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
SRCCREDS="user:password" | |
DSTCREDS="user:password" | |
SOURCE="http://localhost:8081" | |
DEST="http://localhost:8081" | |
for i in $(curl -s -H"Content-Type: application/json" -u ${SRCCREDS} $SOURCE/service/rest/v1/repositories | jq '.[]|select(.format=="apt" or .format=="yum")|select(.type=="proxy" or .type=="group")|.name+","+.format+","+.type' -r) | |
do | |
IFS="," read -r NAME FORMAT TYPE < <( echo $i) | |
JJ=$(curl -s -H"Content-Type: application/json" -u ${SRCCREDS} ${SOURCE}/service/rest/v1/repositories/${FORMAT}/${TYPE}/${NAME}) | |
echo ${JJ} | |
curl -s -H"Content-Type: application/json" -u ${DSTCREDS} ${DEST}/service/rest/v1/repositories/${FORMAT}/${TYPE} -d @<(echo ${JJ}) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment