Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: b1b4d0686e
Fetching contributors…

Cannot retrieve contributors at this time

file 64 lines (59 sloc) 2.6 kb
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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
#!/bin/bash
# #
# init.lunar - Lunar subroutines #
# #
############################################################
# #
# this WAS the subroutines of a source based Linux distro, #
# calls Sorcerer GNU/Linux, or SGL. SGL is no longer #
# available with GPL license. Since this script was taken #
# before licensing scheme change, no legal problems I #
# guess. #
# #
# the code is re-written for Lunar. The previous Copyright #
# notices are kept; just in case some code is left :=) #
# Kagan Kongar <kongar@tsrsb.org.tr>, 20020519 #
# #
############################################################
# #
# Copyright 2001 by Kyle Sallee #
# #
# Parts Copyrighted Hendrik Visage 2002 under GPLv2 #
# #
# Parts Copyrighted Kagan Kongar 2002 under GPLv2 #
# #
############################################################


# function : enviro_check
# usage : enviro_check
# purpose : check if the shell is proper
enviro_check() {
  debug_msg "enviro_check ($@)"
  if [ -z $LUNAR_INSTALL ]; then
    if [ -z "$SHELL" ] || [ "$(getent passwd $USER | cut -d: -f3)" != "0" ] ; then
      message "${PROBLEM_COLOR}WARNING:${DEFAULT_COLOR}${MESSAGE_COLOR}" \
              "You are not running a fully initialized root shell, consider"
      message "running a proper root shell with 'su -'" \
              "${DEFAULT_COLOR}"
    fi
  fi
}

# function : root_check
# usage : root_check
# purpose : check if the user is root
root_check() {
  debug_msg "root_check ($@)"
  if [ "$UID" != "0" ] ; then
    message "${PROBLEM_COLOR}ERROR:${DEFAULT_COLOR}${MESSAGE_COLOR}" \
            "User must have root privileges to run this program" \
            "${DEFAULT_COLOR}"
    exit 1
  fi
}


# function : set_priority
# usage : set_priority
# purpose : force niceness on lunar's processes
set_priority() {
  debug_msg "set_priority ($@)"
  LUNAR_PRIORITY=${LUNAR_PRIORITY:-"+10"}
  renice "$LUNAR_PRIORITY" -p $$ 2> /dev/null >/dev/null
}
Something went wrong with that request. Please try again.