Skip to content

Instantly share code, notes, and snippets.

@ProxiBlue
Created March 1, 2024 08:12
Show Gist options
  • Save ProxiBlue/f00ecb42c1eade71c8c0f991da6d13f0 to your computer and use it in GitHub Desktop.
Save ProxiBlue/f00ecb42c1eade71c8c0f991da6d13f0 to your computer and use it in GitHub Desktop.
repman packages fix from 404
#!/bin/env bash
# Requires HTTPie and JQ
ORG_NAME='xxxxxx'
API_KEY='xxxxxx'
SLEEP_S=0.5
# End of variables that need to change
package_url="https://app.repman.io/api/organization/${ORG_NAME}/package"
echo "http -j '${package_url}' 'X-Api-Token:${API_KEY}'"
result=`http -j "${package_url}" "X-Api-Token:${API_KEY}"`
echo $result
while [[ true ]]
do
for uuid in `echo "${result}" | jq -r '.data[].id'`
do
sync_url="${package_url}/${uuid}"
echo "Syncing package ${sync_url}"
http -j PUT "${sync_url}" "X-Api-Token:${API_KEY}"
sleep "${SLEEP_S}"
done
next_link=`echo "${result}" | jq -re '.links.next'`
if [ $? -ne 0 ]; then
break
fi
echo "---- Fetching ${next_link}"
result=`http -j "${next_link}" "X-Api-Token:${API_KEY}"`
done
echo "done"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment