summaryrefslogtreecommitdiffstats
path: root/.local/bin/allupdate
blob: a7cab2d3157c28d9825a5ffe0b7499670664ab1f (plain) (blame)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env zsh

~/.setup/confgit.sh

# Rust
if [ "$(command -v rustup)" ]; then
  rustup update;
  if [ "$(command -v cargo)" ]; then
    cargo --list |grep install-update &> /dev/null
    if [ $? -eq 0 ]; then
      cargo install-update -a;
    fi
  fi
fi

case "$OSTYPE" in
  darwin*)
    if [ "$(command -v gcloud)" ]; then
        gcloud components update;
    fi
    if [ -d "~/work" ]; then
        # Git config for work
        if [ "$(command -v fd)" ]; then
            fd -H -t d -E mod -E vendor '.git$' ~/work -x bash -c "cd {//}; git config user.email tdavis@hpe.com; git config http.cookiefile /Users/tydavis/.gitcookies-work;" ;
        fi
    fi
    if [ "$(command -v code)" ]; then
        code --list-extensions > ~/.setup/code-extensions
    fi

    # Brew specifics, add installed formula capture later.
    if [ "$(command -v brew)" ]; then
        brew upgrade;
    fi
  ;;
  linux*)
    # == FEDORA ==
    sudo dnf upgrade --assumeyes
    # Generate new RPM list
    sudo rpm -qa --qf "%{NAME}\n" |sort|uniq > ~/.setup/rpmlist
    # == END FEDORA ==

    # Git config for work
    if [ "$(command -v fetchgit)" ]; then
        # Update all existing repos
        if [ "$(command -v fd)" ]; then
            fd -H -t d -E mod -E vendor '.git$' ~/work -x bash -c "cd {//}; git config user.email tdavis@hpe.com; git config http.cookiefile /home/tydavis/.gitcookies-work;" ;
        fi
        if [ -d "~/.golang/go" ]; then
          cd ~/.golang/go;
          fetchgit;
        fi
    fi
    if [ "$(command -v gitrect)" ]; then
      gitrect -v;
      # Update our list of git repos
      gitrect -u;
    else
      if [ "$(command -v go)" ]; then
        go install -u github.com/tydavis/utilities/cmd/gitrect ;
      else
          echo "Go compiler not found"
      fi
    fi
  ;;
esac

echo "" # Newline
date -u +"%Y-%m-%d %H:%M:%SZ"