处理 git代码
#!/bin/bash SRC="aosp" DEST="test" TEMP_DIR="TEMP" function init() { for FILE_LIST in `cat /tmp/path`; do if [ ! -d $DEST/$FILE_LIST.git ]; then git clone --mirror $TEMP_DIR/$FILE_LIST $DEST/$FILE_LIST.git fi done } function text() { grep -r "<project" manifest.xml |awk '{print $3}'|sed "s/name\=\"//g"|sed "s/\"//g" grep -r "path" $SRC/.repo/manifest.xml > /tmp/manifest awk '{print $2}' /tmp/manifest > /tmp/path awk '{print $3}' /tmp/manifest > /tmp/name sed -i -e "s/path\=\"//g" /tmp/path sed -i -e "s/\"//g" /tmp/path sed -i -e "s/name\=\"//g" /tmp/name sed -i -e "s/\"//g" /tmp/name } text if [ -d $DEST ]; then echo "Error, Your dest dirtory is exsits" else mkdir $DEST fi #if [ -f /tmp/find_list ]; then # rm /tmp/find_list #fi #find $SRC -name ".git" >> /tmp/find_list #if [ -f /tmp/find_list ]; then # sed -i -e "s/\/\.git//g" /tmp/find_list #fi for DIR in `cat /tmp/path`; do DIR_A=$DIR mkdir -p $TEMP_DIR/$DIR_A git clone $SRC/$DIR_A $TEMP_DIR/$DIR_A done for DIR in `cat /tmp/name`; do DIR_B=$DIR mkdir -p $DEST/$DIR init done rm /tmp/manifest rm /tmp/path rm /tmp/name
转载于:https://blog.51cto.com/jin771998569/1576801