Skip to content

Instantly share code, notes, and snippets.

@maz-1
Last active March 19, 2018 08:07
Show Gist options
  • Save maz-1/5acdfdb01256a2e858cc79fa0eff2014 to your computer and use it in GitHub Desktop.
Save maz-1/5acdfdb01256a2e858cc79fa0eff2014 to your computer and use it in GitHub Desktop.
repo sync helper script
#!/bin/bash
#MANIFEST=".repo/manifest.xml"
MANIFEST="/tmp/manifest.xml"
cat .repo/manifest.xml | sed '/<!--.*-->/d' | sed '/<!--/,/-->/d' > $MANIFEST
ls .repo/manifests/snippets/ | while read line
do
cat .repo/manifests/snippets/$line | sed '/<!--.*-->/d' | sed '/<!--/,/-->/d' >> $MANIFEST
done
ALL_PKG=`grep project $MANIFEST |awk '{print $3}' |cut -d'"' -f2`
ERR_PKG=""
T_PKG=$ALL_PKG
while [ 1 ]
do
for i in $T_PKG
do
grep "$i" success.pkg >/dev/null 2>&1
if [ $? -eq 0 ]; then
continue
fi
repo sync $i
if [ $? -ne 0 ];then
echo "SYNC Error $i"
ERR_PKG="$ERR_PKG $i"
continue
else
grep "$i" success.pkg >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "$i" >> success.pkg
fi
echo "SYNC Success $i"
fi
done
if [ "$ERR_PKG" = "" ];then
echo "SYNC ALL"
exit 0
else
T_PKG=$ERR_PKG
ERR_PKG=""
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment