fixing script. first check should be root user
This commit is contained in:
parent
585051f57b
commit
75fc188ce7
|
@ -1,5 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
REMOTE_USER="root"
|
||||
|
||||
function check_if_running_as_root {
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "This script must be run as root."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "OK: Root user detected."
|
||||
}
|
||||
|
||||
check_if_running_as_root
|
||||
|
||||
read -p "Did you run this script on the remote host? " -n 1 -r
|
||||
echo
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||
|
@ -16,17 +29,6 @@ then
|
|||
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1
|
||||
fi
|
||||
|
||||
REMOTE_USER="root"
|
||||
|
||||
function check_if_running_as_root {
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "This script must be run as root."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "OK: Root user detected."
|
||||
}
|
||||
|
||||
function check_necessary_packages {
|
||||
echo "NEXT: Checking for valid package manager."
|
||||
|
||||
|
@ -105,7 +107,6 @@ function setup_systemd_service_if_available {
|
|||
fi
|
||||
}
|
||||
|
||||
check_if_running_as_root
|
||||
check_necessary_packages
|
||||
check_for_autossh_user
|
||||
|
||||
|
|
Loading…
Reference in New Issue