diff --git a/deployment_scripts/README.md b/deployment_scripts/README.md
index f69a48b77..f51bd151e 100644
--- a/deployment_scripts/README.md
+++ b/deployment_scripts/README.md
@@ -15,7 +15,9 @@ Don't forget to add python to PATH or do so while installing it via this script.
Linux deployment script is meant for Ubuntu 16.x machines.
You must have root permissions, but don't run the script as root.
-Launch deploy_linux.sh from scripts directory.
+`wget https://raw.githubusercontent.com/guardicore/monkey/develop/deployment_scripts/deploy_linux.sh`
+
+Then execute the resulting script with your shell.
First argument should be an absolute path of an empty directory (script will create one if doesn't exist, default is ./infection_monkey).
Second parameter is the branch you want to clone (develop by default).
Example usages:
diff --git a/deployment_scripts/deploy_linux.sh b/deployment_scripts/deploy_linux.sh
index 834d811a7..c41774393 100755
--- a/deployment_scripts/deploy_linux.sh
+++ b/deployment_scripts/deploy_linux.sh
@@ -1,10 +1,31 @@
#!/bin/bash
-source config
exists() {
command -v "$1" >/dev/null 2>&1
}
+is_root() {
+ return $(id -u)
+}
+
+has_sudo() {
+ # 0 true, 1 false
+ timeout 1 sudo id && return 0 || return 1
+}
+
+config_branch=${2:-"develop"}
+config_url="https://raw.githubusercontent.com/guardicore/monkey/"$config_branch"/deployment_scripts/config"
+
+if exists curl; then
+ file=$(mktemp)
+ curl -s -o $file "$config_url"
+ source $file
+ rm $file
+else
+ echo 'Your system does not have curl, exiting'
+ exit 1
+fi
+
# Setup monkey either in dir required or current dir
monkey_home=${1:-$(pwd)}
if [[ $monkey_home == $(pwd) ]]; then
@@ -30,8 +51,13 @@ log_message() {
echo -e "-------------------------------------------\n"
}
-sudo -v
-if [[ $? != 0 ]]; then
+if is_root; then
+ echo "Please don't runt this script as root"
+ exit 1
+fi
+
+HAS_SUDO=$(has_sudo)
+if [[ ! $HAS_SUDO ]]; then
echo "You need root permissions for some of this script operations. Quiting."
exit 1
fi
@@ -46,8 +72,8 @@ if ! exists git; then
fi
if ! exists wget; then
- echo 'Your system does have wget, please install and re-run this script'
- exit 1
+ echo 'Your system does have wget, please install and re-run this script'
+ exit 1
fi
log_message "Cloning files from git"