Skip to content

Instantly share code, notes, and snippets.

@stanwu
Last active November 10, 2016 06:14
Show Gist options
  • Select an option

  • Save stanwu/f080ab66063d782f2597 to your computer and use it in GitHub Desktop.

Select an option

Save stanwu/f080ab66063d782f2597 to your computer and use it in GitHub Desktop.
Auto Mirror channel_v3.json (Wbond Package-Control Issues #1057)
#!/bin/bash
byte=`curl -s https://packagecontrol.io/channel_v3.json | wc -c`
if [ $byte -gt 2000000 ]; then
echo "OK! mirror it"
cp channel_v3.json channel_v3.json-old
curl -s https://packagecontrol.io/channel_v3.json -o channel_v3.json
cmp -s channel_v3.json channel_v3.json-old
if [ $? == 0 ]; then
echo "We don't need update now"
else
echo "Update data to github now"
git commit -a -m "update"
git push
fi
else
echo "Failed, We need keep last data now"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment