Skip to content
This repository has been archived by the owner on Feb 24, 2023. It is now read-only.

Commit

Permalink
Fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
coatless committed Mar 23, 2018
1 parent c386e1b commit b2a4ae7
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 49 deletions.
14 changes: 7 additions & 7 deletions make_installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ mkdir empty

# Build macOS installer
pkgbuild --root empty \
--scripts scripts \
--identifier com.rbinaries.rtools \
--version $INSTALLER_VERSION \
macos-rtools-temp.pkg
--scripts scripts \
--identifier com.rbinaries.rtools \
--version $INSTALLER_VERSION \
macos-rtools-temp.pkg

# Create a distribution file to allow for customization
productbuild --synthesize --package ./macos-rtools-temp.pkg distribution.xml
Expand Down Expand Up @@ -79,9 +79,9 @@ echo "Rebuilding the package archive..."

# Rebuild package with distribution hacks
productbuild --distribution distribution.xml \
--resources ./build_files \
--sign "Developer ID Installer: James Balamuta" \
--package-path ./macos-rtools-temp.pkg macos-rtools.pkg
--resources ./build_files \
--sign "Developer ID Installer: James Balamuta" \
--package-path ./macos-rtools-temp.pkg macos-rtools.pkg

# Delete the initial build
rm macos-rtools-temp.pkg
Expand Down
84 changes: 42 additions & 42 deletions scripts/postinstall
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@ echo "Verifying Xcode CLI is installed..."

if [ ! -d "/Library/Developer/CommandLineTools" ]; then

# Create a temporary file for the header
# Create a temporary file for the header
touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress

# Figure out the correct Xcode CLI for the given mac OS
PROD=$(sudo softwareupdate -l |
grep "\*.*Command Line" |
tail -n 1 | awk -F"*" '{print $2}' |
sed -e 's/^ *//' |
tr -d '\n')
# Install Xcode CLI
grep "\*.*Command Line" |
tail -n 1 | awk -F"*" '{print $2}' |
sed -e 's/^ *//' |
tr -d '\n')

# Install Xcode CLI
sudo softwareupdate -i "$PROD" --verbose;

rm -rf /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
else
echo "Xcode CLI is installed..."
Expand All @@ -64,7 +64,7 @@ download_file(){
if [ -f "$2" ]; then
echo "$2 has already been downloaded..."
else
echo "Downloading file $2 ... Please be patient..."
echo "Downloading file $2 ... Please be patient..."
# Download file into working directory
curl -O $1$2
fi
Expand All @@ -85,17 +85,17 @@ extract_file(){
#1 Variable to find/remove
#2 Config file to search
remove_config_variable(){

pattern=$1
config_file=$2

# Check if there are matches
if grep -q $pattern $config_file; then
# Remove matches
# '' required due to macOS
sed -i '' "/$pattern/d" $config_file
echo "Removed configuration line containing: $pattern ..."
fi
fi
}

#1 Variable to find
Expand All @@ -105,7 +105,7 @@ append_config_variable(){
pattern=$1
append_with=$2
config_file=$3

# Check if there are matches
if grep -q $pattern $config_file; then
# Append to the end of the line of each match
Expand All @@ -122,9 +122,9 @@ append_config_variable(){
add_config_variable(){
config_var=$1
config_file=$2

echo "Adding configuration line $config_var to $config_file ..."

# Append a new line to end of config file
echo "$config_var" >> $config_file
}
Expand Down Expand Up @@ -159,44 +159,44 @@ echo "Checking if file '~/.R/Makevars' exists"
if [ -f "$R_MAKEVARS_LOCAL" ]; then

echo "'~/.R/Makevars' detected. Making a backup at ''~/.R/Makevars.bck'..."

# Consider adding [[:space:]]*= for a more selective destruction

remove_config_variable "CC" $R_MAKEVARS_LOCAL
add_config_variable "CC=$CC_COMPILER" $R_MAKEVARS_LOCAL

remove_config_variable "CXX" $R_MAKEVARS_LOCAL
add_config_variable "CXX=$CXX_COMPILER" $R_MAKEVARS_LOCAL
# Adds configuration variables that specify all C++ standards
add_config_variable "CXX1X=$CXX_COMPILER" $R_MAKEVARS_LOCAL
add_config_variable "CXX98=$CXX_COMPILER" $R_MAKEVARS_LOCAL
add_config_variable "CXX11=$CXX_COMPILER" $R_MAKEVARS_LOCAL
add_config_variable "CXX14=$CXX_COMPILER" $R_MAKEVARS_LOCAL
add_config_variable "CXX17=$CXX_COMPILER" $R_MAKEVARS_LOCAL

# Adds configuration variables that specify all C++ standards

add_config_variable "CXX1X=$CXX_COMPILER" $R_MAKEVARS_LOCAL

add_config_variable "CXX98=$CXX_COMPILER" $R_MAKEVARS_LOCAL
add_config_variable "CXX11=$CXX_COMPILER" $R_MAKEVARS_LOCAL
add_config_variable "CXX14=$CXX_COMPILER" $R_MAKEVARS_LOCAL
add_config_variable "CXX17=$CXX_COMPILER" $R_MAKEVARS_LOCAL

# Remove any instances of the LDFLAG (in the odd case they re-run the installer...)
LDFLAGS_PATH_VAR="-L/usr/local/clang4/lib"

sed -i '' "s~$LDFLAGS_PATH_VAR~~" $R_MAKEVARS_LOCAL

# Add only one instance
append_config_variable "LDFLAGS" "$LDFLAGS_PATH_VAR" $R_MAKEVARS_LOCAL

else

echo "No '~/.R/Makevars' found. Creating one..."

# Create the R directory
mkdir -p ~/.R

# Create the file
touch $R_MAKEVARS_LOCAL

echo "Filling '~/.R/Makevars' with appropriate compile time implicit variables..."

# Fill with appropriate linking statements via heredoc insertion
# The - removes tabbing
cat <<- EOF > $R_MAKEVARS_LOCAL
Expand All @@ -211,7 +211,7 @@ else
LDFLAGS=-L/usr/local/clang4/lib
# End clang4 inclusion statements
EOF

fi

echo "Success! '~/.R/Makevars' has been configured correctly..."
Expand All @@ -234,16 +234,16 @@ os_vers_minor="${os_vers[1]}"

# Check if the version is between Sierra or High Sierra. If not, check for El Capitan.
if [[ ${os_vers_minor} -ge 12 && ${os_vers_minor} -le 13 ]]; then
GFORTRAN_DMG=gfortran-6.3-Sierra
GFORTRAN_DMG=gfortran-6.3-Sierra
GFORTRAN_PKG=gfortran
# Fill with appropriate linking statements via heredoc insertion
cat <<- EOF >> $R_MAKEVARS_LOCAL
# The following statement changes the Fortran linking path
FLIBS=-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin16/6.3.0
# End Fortran linking path statement
# The following statement changes the Fortran linking path
FLIBS=-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin16/6.3.0
# End Fortran linking path statement
EOF
else
GFORTRAN_DMG=gfortran-6.1-ElCapitan
GFORTRAN_DMG=gfortran-6.1-ElCapitan
GFORTRAN_PKG=gfortran-6.1-ElCapitan/gfortran
fi

Expand Down

0 comments on commit b2a4ae7

Please sign in to comment.