Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

89 lines (74 sloc) 1.931 kb
#!/bin/bash
####################################################################
# Prey Core Setup Routine - by Tomas Pollak (bootlog.org)
# URL: http://preyproject.com
# License: GPLv3
####################################################################
# step throught the params and check
until [ -z "$1" ]; do
if [[ "$1" == "-t" || "$1" == "--test" ]]; then
echo -e "\n -- TEST MODE ENABLED."
. $base_path/test/include "$2" 2> /dev/null
test_mode=1
elif [[ "$1" == '-c' || "$1" == '--check' ]]; then
echo -e "\n -- CHECK MODE ENABLED."
check_mode=1
fi
shift
done
lowercase(){
echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
}
get_os(){
os=`lowercase \`uname\``
if [ "$os" == "windowsnt" ]; then
os=windows
else # linux/mac stuff
if [ "$os" == "darwin" ]; then
os=mac
fi
readonly logged_user=`who | cut -d' ' -f1 | sort -u | tail -1`
readonly root_path='/'
readonly home_path=`eval echo ~`
set_colors
fi
readonly os
readonly platform_path="$base_path/platform/$os"
PATH=$PATH:$platform_path/bin
}
# here we put the vars that are shared by two os, but a third one has
# different values
set_vars(){
tmpdir="/tmp/p${RANDOM}"
line_breaker="\n"
user_agent="-A Prey/$version ($os)"
}
set_aliases(){
shopt -s expand_aliases
alias getter="curl -s \"$user_agent\""
alias mailsender="sendEmail"
alias patcher='patch'
alias processes='ps ax'
}
set_constants(){
readonly lang
readonly start_time=`date +"%F %T"`
readonly tmpdir
readonly logged_user
readonly control_panel_url="http://control.preyproject.com" 2> /dev/null
readonly updates_url="http://cloud.github.com/downloads/tomas/prey" 2> /dev/null
readonly modules_url=$control_panel_url 2> /dev/null
}
set_colors(){
cyan='\E[36m'
green='\E[32m'
red='\E[31m'
color_end='\E[0m'
bold='\033[1m'
bold_end='\033[0m'
}
get_os
set_vars
set_aliases
. "$platform_path/settings"
set_constants
Jump to Line
Something went wrong with that request. Please try again.