aboutsummaryrefslogtreecommitdiff
path: root/macos.local/.flake/home/scripts/manage-system.org
blob: 91670f0e5d02583fcf902ff512b44a5b832a459b (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
#+title: System Management Script

#+begin_src sh
  #!/bin/sh

  usage ()
  {
      echo "Usage: $0 [-u/-i]"
  }

  [ "$#" -eq 0 ] && usage && exit 1

  dir="$pwd"
  cd ~/.dotfiles || exit 1

  while getopts ":hui" arg; do
      case "$arg" in
          h)
              usage
              cd "$dir" || exit 1
              exit 0
              ;;
          u)
              make update
              cd "$dir" || exit 1
              exit 0
              ;;
          i)
              make install
              cd "$dir" || exit 1
              exit 0
              ;;
          ,*)
              cd "$dir" || exit 1
              exit 1
              ;;
      esac
  done
#+end_src