#!/bin/bash

clientctl(){
  opway=$1
  if [ -f "/run/systemd/system" ];then
    systemctl ${opway} linux_client.service
  elif [ -f "/sbin/initctl" ]; then
    ${opway} linux_client
  else
    service linux_client ${opway}
  fi
}

online(){
    guard_client stop
    clientctl stop
    preinstall
    clientctl start
    guard_client start
}

uninstall(){
    dpkg -P topclient.domesticdesktop
}

main(){
    export PATH=$PATH:/usr/local/bin:/usr/sbin
    case "$1" in
        online)
          $1
          ;;
        uninstall)
          $1
          ;;
        *)
          echo "Usage: $0 {online}"
          exit 2
          ;;
    esac
}
main $@
