summaryrefslogtreecommitdiff
path: root/netzbon/functions.sh
blob: 3938aca1ba00da8ae2eed4c8bc31ae6f0ff296bd (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
#!/bin/bash

# Message
function say() {
  echo "TALER: " "$@"
}

# Check user if the user is root
function check_user() {

  if [ "$(whoami)" != "root" ]; then
    say "Please run this script as root"
    exit 1
  fi
}

# Set DISTRO to the detected distro or return non-zero
# status if distro not supported.
function detect_distro() {
  unset DISTRO
  uname -a | grep Ubuntu >/dev/null && DISTRO=ubuntu && return 0
  uname -a | grep Debian >/dev/null && DISTRO=debian && return 0
  return 1
}