summaryrefslogtreecommitdiffstats
path: root/tiny/repos-update.sh
blob: be89cae175771f743a4e0154c729b5933354a1e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash

# ToDo
#
# git pull submodules if .gitmodules exists?
#


# run as kyle
if [[ $(id -u) -eq 0 ]]; then
  su - kyle
fi


declare -a REPODIRS=("REPO" "repo" "repo crypto" "repo cs" "repo emu" "repo exploit" "repo gaming r" "repo malware" "repo r" "repo small projects" "repo webdesign" "repo rice" "repo cs edu" "repo debug-profile" "repo gitgud" "repo weeb" "repo lang tools")

for d in "${REPODIRS[@]}"; do
  cd "$d"
  for r in *; do
    if [[ ! -d "$r" ]]; then
      echo -e "skipping ${r} file as it is not a repo of known type"
      continue
    fi
    # skip files like .zip or tarballs as they're not REPOs

    echo -e "\e[00;32mUpdating ${r}\e[00m"
    cd "$r"
    if [[ -d ".git" ]]; then git pull; fi
    if [[ -d ".svn" ]]; then svn up; fi
    if [[ -d "CVS" ]]; then CVS_RSH="ssh" cvs update -Pd; fi

    if [[ ! $? -eq 0 ]]; then echo "failed to update repo: ${r}"; fi
    cd ../
  done
  cd ../
done

exit 0