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

#+begin_src sh
  #!/bin/sh

  usage ()
  {
      echo "Usage: $0 [command] where command is one of"
      echo "help    - show this message and exit"
      echo "update  - update the system"
      echo "install - install the system configurations"
  }

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

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

  case "$1" in
      help)
          usage
          cd "$dir" || exit 1
          exit 0
          ;;
      update)
          make update
          cd "$dir" || exit 1
          exit 0
          ;;
      install)
          make install
          cd "$dir" || exit 1
          exit 0
          ;;
      ,*)
          usage
          cd "$dir" || exit 1
          exit 1
          ;;
  esac
#+end_src