From 32d7caf45d886d0d24e69eea00511c7815ac15d0 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Wed, 25 Jan 2012 02:21:20 -0500 Subject: [PATCH] rumblings of change; got custom scripts sorted, improved approach to loading them, found a new name for core which i need to move to. so now i get to see how well git can move a hierarchy. --- makefile | 2 +- scripts/core/variables.sh | 9 +- scripts/custom/examples/fred/java_profile.sh | 100 ++++++++++++++++++ .../examples/fred/mac_profile_additions.txt | 11 -- .../examples/fred/uva_profile_additions.txt | 16 --- scripts/custom/examples/readme.txt | 7 +- 6 files changed, 111 insertions(+), 34 deletions(-) create mode 100644 scripts/custom/examples/fred/java_profile.sh delete mode 100644 scripts/custom/examples/fred/mac_profile_additions.txt delete mode 100644 scripts/custom/examples/fred/uva_profile_additions.txt diff --git a/makefile b/makefile index 1162976a..d775b5ab 100644 --- a/makefile +++ b/makefile @@ -1,7 +1,7 @@ include variables.def PROJECT = feisty_meow_sources -BUILD_BEFORE = start_make core scripts octopi graphiq production end_make +BUILD_BEFORE = start_make nucleus scripts octopi graphiq production end_make include rules.def diff --git a/scripts/core/variables.sh b/scripts/core/variables.sh index 16574ec5..07e03ee6 100644 --- a/scripts/core/variables.sh +++ b/scripts/core/variables.sh @@ -62,10 +62,11 @@ fi # other variables... ############################################################################## -# pull in the custom variable overrides for bash. -if [ -f "$YETI_SCRIPTS/custom/c_variables.sh" ]; then - source "$YETI_SCRIPTS/custom/c_variables.sh" -fi +# pull in the custom overrides for feisty_meow scripts. +for i in $YETI_SCRIPTS/custom/*.sh; do + echo "Sourcing custom file: $i" + source $i +done # sets the prompts to what we (i.e., i) like... # there are four different prompts. the first one, PS1, is the one that users diff --git a/scripts/custom/examples/fred/java_profile.sh b/scripts/custom/examples/fred/java_profile.sh new file mode 100644 index 00000000..7186b446 --- /dev/null +++ b/scripts/custom/examples/fred/java_profile.sh @@ -0,0 +1,100 @@ +#!/bin/bash +# this script tries to intuit where java is installed on this machine. + +############################ + +function intuition_failure() +{ + missing="$1"; shift + echo "We cannot intuit your $missing variable for this host." + # remove the variable because its value is busted. + unset $missing +} + +############################ + +# set some fairly liberal limits for ant. +export ANT_OPTS="-Xms512m -Xmx768m -XX:MaxPermSize=768m" + +############################ + +# start guessing some settings... + +# this bin portion works for most javas... +export JAVA_BIN_PIECE=bin + +if [ ! -d "$JAVA_HOME" ]; then + # first try a recent linux version. + export JAVA_HOME=/usr/lib/jvm/java-6-sun/jre +fi +if [ ! -d "$JAVA_HOME" ]; then + # try using a windows version. +#note: this logic is untested. +# probably will break due to space in path issues. + declare -a any_there=$(find "/c/Program Files/java" -type d -iname "jdk" 2>/dev/null) + if [ ${#any_there[*]} -gt 0 ]; then + (( last = ${#any_there[@]} - 1 )) + JAVA_HOME="${any_there[$last]}" + fi + if [ ! -d "$JAVA_HOME" ]; then + # if no jdk, try a jre. + declare -a any_there=$(find "/c/Program Files/java" -type d -iname "jre" 2>/dev/null) + if [ ${#any_there[*]} -gt 0 ]; then + (( last = ${#any_there[@]} - 1 )) + JAVA_HOME="${any_there[$last]}" + fi + fi +fi +# this should go last, since it changes the bin dir. +if [ ! -d "$JAVA_HOME" ]; then + # if that didn't work, try the location for mac os x. + JAVA_HOME=/Library/Java/Home + JAVA_BIN_PIECE=Commands +fi +# last thing is to tell them we couldn't find it. +if [ ! -d "$JAVA_HOME" ]; then + intuition_failure JAVA_HOME + unset JAVA_BIN_PIECE +fi + +############################ + +# intuit where we have our local eclipse. +if [ ! -d "$ECLIPSE_DIR" ]; then + export ECLIPSE_DIR=/usr/local/eclipse_jee +fi +if [ ! -d "$ECLIPSE_DIR" ]; then + ECLIPSE_DIR=$HOME/eclipse +fi +if [ ! -d "$ECLIPSE_DIR" ]; then + ECLIPSE_DIR=$HOME/apps/eclipse +fi +if [ ! -d "$ECLIPSE_DIR" ]; then +#uhhh, default on winders? + ECLIPSE_DIR="/c/Program Files/eclipse" +fi +if [ ! -d "$ECLIPSE_DIR" ]; then + ECLIPSE_DIR="/c/tools/eclipse" +fi +if [ ! -d "$ECLIPSE_DIR" ]; then + ECLIPSE_DIR="/d/tools/eclipse" +fi +if [ ! -d "$ECLIPSE_DIR" ]; then + ECLIPSE_DIR="/e/tools/eclipse" +fi +# final option is to whine. +if [ ! -d "$ECLIPSE_DIR" ]; then intuition_failure ECLIPSE_DIR; fi + +############################ + +# use the variables we just set in our path, and try to make them override +# any other paths to different versions. + +if [ ! -z "$JAVA_HOME" ]; then + export PATH=$JAVA_HOME/$JAVA_BIN_PIECE:$PATH +fi +if [ ! -z "$ECLIPSE_DIR" ]; then + export PATH=$ECLIPSE_DIR:$PATH +fi + + diff --git a/scripts/custom/examples/fred/mac_profile_additions.txt b/scripts/custom/examples/fred/mac_profile_additions.txt deleted file mode 100644 index cb59c2ac..00000000 --- a/scripts/custom/examples/fred/mac_profile_additions.txt +++ /dev/null @@ -1,11 +0,0 @@ - - -# added this after the bashrc setup stuff for feisty_meow scripts... - -# extras for uva -export JAVA_HOME=/Library/Java/Home -export PATH=$PATH:$JAVA_HOME/Commands - -# ant options to get the wsdl files to all build properly. -export ANT_OPTS="-Xms512m -Xmx768m -XX:MaxPermSize=768m" - diff --git a/scripts/custom/examples/fred/uva_profile_additions.txt b/scripts/custom/examples/fred/uva_profile_additions.txt deleted file mode 100644 index ed1bde72..00000000 --- a/scripts/custom/examples/fred/uva_profile_additions.txt +++ /dev/null @@ -1,16 +0,0 @@ - -# added this after the bashrc setup stuff for feisty_meow... - -# extras for uva -export JAVA_HOME=/usr/lib/jvm/java-6-sun/jre - -# ant options to get the wsdl files to all build properly. -export ANT_OPTS="-Xms512m -Xmx768m -XX:MaxPermSize=768m" - -# where we have our local eclipse. -export ECLIPSE_DIR=/usr/local/eclipse_jee - -# add in the places we'd like in the path. -# java and eclipse go first to override any other installed versions. -export PATH=$JAVA_HOME/bin:$ECLIPSE_DIR:$PATH - diff --git a/scripts/custom/examples/readme.txt b/scripts/custom/examples/readme.txt index cf04e876..e8e14a5c 100644 --- a/scripts/custom/examples/readme.txt +++ b/scripts/custom/examples/readme.txt @@ -3,8 +3,11 @@ this folder has some examples of how various people (or one person right now) do their custom scripts. -the scripts should have the same name as the main yeti script's corresponding -name, but with a "c_" in front. +the scripts often have the same name as the main script's name, but with +a "c_" in front. ones understood currently are: + c_common_aliases.txt + c_sh_aliases.txt + c_variables.sh when you have some custom scripts you want to use, copy them from your own folder to the scripts/custom directory. be careful though, because these -- 2.34.1