#!/bin/bash

## Copyright (C) 2012 - 2025 ENCRYPTED SUPPORT LLC <adrelanos@whonix.org>
## See the file COPYING for copying conditions.

root_check() {
   if [ ! "$ROOT_CHECK" = "0" ]; then
      if [ "$(id -u)" != "0" ]; then
         local MSG="<p>Root Check Result: Ok, not running as root.</p>"
         if [ "$verbose" -ge "2" ]; then
            $output_x ${output_opts[@]} --messagex --typex "info" --message "$MSG"
            $output_cli ${output_opts[@]} --messagecli --typecli "info" --message "$MSG"
         fi
      else
         local MSG="<p>Please do not run systemcheck as root.</p>"
         $output_x ${output_opts[@]} --messagex --typex "error" --message "$MSG"
         $output_cli ${output_opts[@]} --messagecli --typecli "error" --message "$MSG"
         EXIT_CODE="1"
         cleanup "1"
         return 0
      fi
   fi
}
