Skip to content

Commit

Permalink
shell args
Browse files Browse the repository at this point in the history
  • Loading branch information
dipterix committed Jan 23, 2024
1 parent f8294d5 commit 1fc9805
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 19 deletions.
48 changes: 33 additions & 15 deletions inst/installer.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,48 @@
#!/bin/bash

set -e
set -u

SCRIPT_DIR=$(dirname "$0")
R_CMD=$(which Rscript || echo $1)
OS_TYPE=$(/usr/bin/uname)

if [ "$2" == "--skip-sysreq" ]; then
echo "Skipping system requisites"
elif [ "$OS_TYPE" == "Darwin" ]; then
echo "Operating System: macOS"
. "${SCRIPT_DIR}/shell/installer-prerequisites-osx.sh"
elif [ "$OS_TYPE" == "Linux" ]; then
echo "Operating System: Linux"
# . "${SCRIPT_DIR}/shell/installer-prerequisites-linux.sh"
fi

R_CMD=$(/usr/bin/which Rscript)
SYSREQ="1"

while getopts ":s:r:" opt; do
case $opt in
s)
SYSREQ="$OPTARG"
;;
r)
R_CMD="$OPTARG"
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done

# Load installer commons
. "${SCRIPT_DIR}/shell/installer-common.sh"


ohai "Operating System: ${OS_TYPE}"
ohai "R binary path: ${R_CMD}"

if [ "${SYSREQ}" == "1" ]; then
if [ "$OS_TYPE" == "Darwin" ]; then
ohai "Operating System: macOS"
. "${SCRIPT_DIR}/shell/installer-prerequisites-osx.sh"
elif [ "$OS_TYPE" == "Linux" ]; then
ohai "Operating System: Linux"
# . "${SCRIPT_DIR}/shell/installer-prerequisites-linux.sh"
fi
else
ohai "Skipping system requisites"
fi


# Create a temporary directory
tmpdir=$(mktemp -d -t "rave-installer")
Expand Down
8 changes: 4 additions & 4 deletions inst/shell/installer-prerequisites-osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

set -u

SCRIPT_DIR=$(dirname "$0")

# Load installer commons
. "${SCRIPT_DIR}/installer-common.sh"
# SCRIPT_DIR=$(dirname "$0")
#
# # Load installer commons
# . "${SCRIPT_DIR}/installer-common.sh"

ohai "Checking sudo access (may require your password): "
have_sudo_access true
Expand Down

0 comments on commit 1fc9805

Please sign in to comment.