Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ Run as root or insert `sudo -E` before `bash`:
```
Script to set up SimpleRisk on a server.

./simplerisk-setup [-d|--debug] [-n|--no-assistance] [-h|--help] [--validate-os-only]
./simplerisk-setup [-d|--debug] [-n|--no-assistance] [-h|--help]

Flags:
-d|--debug: Shows the output of the commands being run by this script
-n|--no-assistance: Runs the script in headless mode (will assume yes on anything)
-t|--testing: Picks the current testing version
--validate-os-only: Only validates if the current host (OS and version) are supported by the script. This option does not require running the script as superuser.
-h|--help: Shows instructions on how to use this script
```
27 changes: 5 additions & 22 deletions simplerisk-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,12 @@ readonly MYSQL_GPG_KEY='B7B3B788A8D3785C' # Key taken from https://dev.mysql.com
setup (){
validate_args "${@:1}"

# Check root unless you only want to validate if the script works on the host
if [ ! -v VALIDATE_ONLY ]; then
check_root
fi
# Ask user input unless it is on headless mode or validating if the script works
if [ ! -v HEADLESS ] && [ ! -v VALIDATE_ONLY ]; then
check_root
if [ ! -v HEADLESS ]; then
ask_user
fi
load_os_variables
validate_os_and_version
if [ -v VALIDATE_ONLY ]; then
exit 0
fi
perform_installation
}

Expand All @@ -46,12 +39,6 @@ validate_args(){
-d|--debug)
DEBUG=y
shift;;
-t|--testing)
TESTING=y
shift;;
--validate-os-only)
VALIDATE_ONLY=y
shift;;
-h|--help)
print_help
exit 0;;
Expand Down Expand Up @@ -146,7 +133,7 @@ validate_os_and_version(){
if ! sudo suseconnect --list-extensions | grep -F "$php_module" | grep -q "Activated"; then
print_error_message "$php_module is not enabled on your subscription. Please enable it before running this installer."
fi
if [ ! -v HEADLESS ] && [ ! -v VALIDATE_ONLY ]; then
if [ ! -v HEADLESS ]; then
read -r -p 'Before continuing, SLES 15 does not have sendmail available. Proceed? [ Yes / (No) ]: ' answer < /dev/tty
case "${answer}" in
Yes|yes|Y|y ) SETUP_TYPE=suse;;
Expand Down Expand Up @@ -291,7 +278,7 @@ set_up_backup_cronjob() {
}

get_current_simplerisk_version() {
curl -sL "https://updates${TESTING:+-test}.simplerisk.com/releases.xml" | grep -oP '<release version=(.*)>' | head -n1 | cut -d '"' -f 2
curl -sL "https://updates.simplerisk.com/releases.xml" | grep -oP '<release version=(.*)>' | head -n1 | cut -d '"' -f 2
}

get_installed_php_version() {
Expand All @@ -312,14 +299,10 @@ print_help() {

Script to set up SimpleRisk on a server.

./simplerisk-setup [-d|--debug] [--yes] [-h|--help] [--validate-os-only]
./simplerisk-setup [-d|--debug] [--yes] [-h|--help]

Flags:
-d|--debug: Shows the output of the commands being run by this script
-t|--testing: Picks the current testing version
--validate-os-only: Only validates if the current host (OS and version) are supported
by the script. This option does not require running the script
as superuser.
--yes: Will answer yes on every question (Use it carefully)
-h|--help: Shows instructions on how to use this script
EOC
Expand Down