From cb1380834ef1db724f4e71ce80aabee0f23e9043 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Sun, 29 Jan 2012 15:12:41 -0500 Subject: [PATCH] revising the core startup scripts for the better, i hope. --- scripts/core/launch_feisty_meow.sh | 94 +++++++++++++++++++ ...ht_unix_login.sh => lightweight_launch.sh} | 3 +- scripts/core/profile.sh | 53 ----------- scripts/core/unix_login.sh | 50 ---------- scripts/core/variables.sh | 44 ++++++--- 5 files changed, 129 insertions(+), 115 deletions(-) create mode 100644 scripts/core/launch_feisty_meow.sh rename scripts/core/{lightweight_unix_login.sh => lightweight_launch.sh} (72%) delete mode 100644 scripts/core/profile.sh delete mode 100644 scripts/core/unix_login.sh diff --git a/scripts/core/launch_feisty_meow.sh b/scripts/core/launch_feisty_meow.sh new file mode 100644 index 00000000..7c318375 --- /dev/null +++ b/scripts/core/launch_feisty_meow.sh @@ -0,0 +1,94 @@ +#!/bin/bash + +############## + +# Fred Hamster's Feisty Meow Concerns Ltd. Startup Profile. +# +# This file is useful within .profile or other initialization scripts. +# +# Author: Chris Koeritz + +############## + +export SHELL_DEBUG=true + # this variable causes the scripts that listen to it to print more information + # when they run. + +############## + +# FEISTY_MEOW_GENERATED is where the generated files yeti uses are located. +# this is our single entry point we can use without knowing any variables +# yet in the initialization process. +export FEISTY_MEOW_GENERATED="$HOME/.zz_auto_gen" +if [ ! -z "$WINDIR" -o ! -z "$windir" ]; then + # assume they are using windoze. + export FEISTY_MEOW_GENERATED="$TMP/zz_auto_gen" +fi + +# make sure our main variables are established. +GENERATED_FEISTY_MEOW_VARIABLES="$FEISTY_MEOW_GENERATED/feisty_meow_variables.sh" +if [ ! -f "$GENERATED_FEISTY_MEOW_VARIABLES" ]; then + echo -e '\n\n' + echo "The yeti scripts need to be initialized via the bootstrap process, e.g.:" + echo " bash $HOME/feisty_meow/scripts/core/bootstrap_shells.sh" + echo -e '\n\n' +fi + +# pull in our variable set. +source "$GENERATED_FEISTY_MEOW_VARIABLES" + +############## + +# Set up all of the environment's system variables. This is the first step +# in the majestic plan we have for this shell's initialization. +source $FEISTY_MEOW_SCRIPTS/core/variables.sh + +# Set up the temporary directory... +source $FEISTY_MEOW_SCRIPTS/core/create_tempdir.sh + +############## + +# check if this is dos/windows. +if [ "$OS" == "Windows_NT" ]; then + if [ -z "$HOME" ]; then + # set a default that might not be appropriate for everyone, but should + # still work. + export HOME=/c/home + fi + if [ ! -d "$HOME" ]; then mkdir $HOME; fi +fi + +############## + +if [ -z "$LIGHTWEIGHT_INIT" ]; then + # perform the bulkier parts of the login and initialization. + + if [ ! -z "$SHELL_DEBUG" ]; then echo heavyweight login begins...; fi + +#FEISTY_MEOW_GENERATED=$(echo $FEISTY_MEOW_GENERATED | sed -e 's/\\/\//g') +#FEISTY_MEOW_SCRIPTS="$(echo $FEISTY_MEOW_SCRIPTS | sed -e 's/\\/\//g')" +#FEISTY_MEOW_SCRIPTS="$FEISTY_MEOW_SCRIPTS" + + # set up the aliases for the shell, but only if they are not already set. + alias regenerated &>/dev/null # see if a crucial alias exists. + if [ $? -ne 0 ]; then + if [ ! -z "$SHELL_DEBUG" ]; then + echo the aliases were missing, now they are added... + fi + source $FEISTY_MEOW_GENERATED/aliases.sh + fi + + # allow connections to our x server from the local host. + if [ ! -z "$DISPLAY" ]; then + if [ ! -z "$(echo "$OS_TYPE" | grep -i darwin)" ]; then + if [ ! -z "$SHELL_DEBUG" ]; then echo Enabling localhost X connections...; fi + xhost + localhost >/dev/null 2>&1 + fi + fi + + # a minor tickle of the title of the terminal, in case there is one. + bash $FEISTY_MEOW_SCRIPTS/tty/label_terminal_with_infos.sh + + if [ ! -z "$SHELL_DEBUG" ]; then echo heavyweight login ends....; fi +fi + diff --git a/scripts/core/lightweight_unix_login.sh b/scripts/core/lightweight_launch.sh similarity index 72% rename from scripts/core/lightweight_unix_login.sh rename to scripts/core/lightweight_launch.sh index 99afe94e..3a4d145c 100644 --- a/scripts/core/lightweight_unix_login.sh +++ b/scripts/core/lightweight_launch.sh @@ -1,8 +1,9 @@ #!/bin/bash # -# lightweight version of unix login script. +# lightweight version of startup. # source $FEISTY_MEOW_SCRIPTS/core/variables.sh source $FEISTY_MEOW_SCRIPTS/core/create_tempdir.sh + diff --git a/scripts/core/profile.sh b/scripts/core/profile.sh deleted file mode 100644 index 5421d9ed..00000000 --- a/scripts/core/profile.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# Hamster Login Profile. -# -# This file takes the place of .profile or other initialization scripts. - -export SHELL_DEBUG=true - # this variable causes the scripts that listen to it to print more information - # when they run. - -####fault--repeated code from bootstrap. isolate to shared location. -# FEISTY_MEOW_GENERATED is where the generated files yeti uses are located. -export FEISTY_MEOW_GENERATED="$HOME/.zz_auto_gen" -if [ ! -z "$WINDIR" -o ! -z "$windir" ]; then - # assume they are using windoze. - export FEISTY_MEOW_GENERATED="$TMP/zz_auto_gen" -fi - -# make sure our main variables are established. -GENERATED_FEISTY_MEOW_VARIABLES="$FEISTY_MEOW_GENERATED/feisty_meow_variables.sh" -if [ ! -f "$GENERATED_FEISTY_MEOW_VARIABLES" ]; then - echo -e '\n\n' - echo "The yeti scripts need to be initialized via the bootstrap process, e.g.:" - echo " bash $HOME/feisty_meow/scripts/core/bootstrap_shells.sh" - echo -e '\n\n' -fi - -# pull in our variable set. -source "$GENERATED_FEISTY_MEOW_VARIABLES" - -# define a default name, if one wasn't already set. -if [ -z "$NAME" ]; then - export NAME='Unset Q. Namington, Fixley Your Name III' -fi - -# check if this is dos/windows. -if [ "$OS" == "Windows_NT" ]; then - if [ -z "$HOME" ]; then - # set a default that might not be appropriate for everyone, but should - # still work. - export HOME=/c/home - fi - if [ ! -d "$HOME" ]; then mkdir $HOME; fi -## export FEISTY_MEOW_GENERATED=$TMP/zz_auto_gen -fi - -if [ -z "$LIGHTWEIGHT_INIT" ]; then - # perform the bulk of the login. - source $FEISTY_MEOW_SCRIPTS/core/unix_login.sh -else - # this is the lightweight login that just wants variables set. - source $FEISTY_MEOW_SCRIPTS/core/lightweight_unix_login.sh -fi - diff --git a/scripts/core/unix_login.sh b/scripts/core/unix_login.sh deleted file mode 100644 index 418677f3..00000000 --- a/scripts/core/unix_login.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -# -# Unix Start up information and personal environment for bash. -# - -if [ ! -z "$SHELL_DEBUG" ]; then echo unix login begins...; fi - -FEISTY_MEOW_GENERATED=$(echo $FEISTY_MEOW_GENERATED | sed -e 's/\\/\//g') -FEISTY_MEOW_SCRIPTS="$(echo $FEISTY_MEOW_SCRIPTS | sed -e 's/\\/\//g')" -FEISTY_MEOW_SCRIPTS="$FEISTY_MEOW_SCRIPTS" - -# Set up all of the environment's system variables. This is the first step -# in the majestic plan we have for this shell's initialization. -source $FEISTY_MEOW_SCRIPTS/core/variables.sh - -# Also set up the temporary directory... -source $FEISTY_MEOW_SCRIPTS/core/create_tempdir.sh - -# ulimit and umask. umask sets a permission mask for all file -# creations. The mask shown here disallows writing by the "group" and -# "others" categories of users. ulimit sets the user limits. the core -# file size is set to zero. -umask 022 -ulimit -c 0 - -# The second part of this sweeping two-part inauguration process is to set -# up the aliases for the shell, but only if they are not already set. The -# only alias we know of that's specific to our set is used. -alias lsd >/dev/null 2>/dev/null # see if the 'x' alias exists. -if [ $? -ne 0 ]; then - if [ ! -z "$SHELL_DEBUG" ]; then - echo the aliases were missing, now they are added... - fi - source $FEISTY_MEOW_GENERATED/aliases.sh -fi - -# allow connections to our x server from the local host. -if [ ! -z "$DISPLAY" ]; then - if [ ! -z "$(echo "$OS_TYPE" | grep -i darwin)" ]; then - if [ ! -z "$SHELL_DEBUG" ]; then echo Enabling localhost X connections...; fi - xhost + localhost >/dev/null 2>&1 - fi -fi - -# a minor tickle of the title of the terminal, in case there is one. -bash $FEISTY_MEOW_SCRIPTS/tty/label_terminal_with_infos.sh - -if [ ! -z "$SHELL_DEBUG" ]; then echo unix login ends....; fi - diff --git a/scripts/core/variables.sh b/scripts/core/variables.sh index e3dcb0f0..3a26777f 100644 --- a/scripts/core/variables.sh +++ b/scripts/core/variables.sh @@ -1,17 +1,21 @@ #!/bin/bash -############################################################################## +############## + # variables script: # Defines the environment variables used by the personalized unix # environment. -############################################################################## +# Author: Chris Koeritz + +############## if [ ! -z "$SHELL_DEBUG" ]; then echo variables initialization begins...; fi -############################################################################## -# System variables. -############################################################################## -# OS stands for the operating system that we think is running. +############## + +# System variables... + +# OS variable records the operating system we think we found. if [ -z "$OS" ]; then export OS=UNIX fi @@ -34,11 +38,17 @@ if [ "$OS" == "Windows_NT" ]; then export HOSTNAME=$(echo $HOSTNAME | tr A-Z a-z) fi -############################################################################## -# Directory variables. -############################################################################## -# The yeti library directory holds useful shell scripts, public databases, -# configuration examples, javascript code, and other stuff. +# ulimit and umask. umask sets a permission mask for all file +# creations. The mask shown here disallows writing by the "group" and +# "others" categories of users. ulimit sets the user limits. the core +# file size is set to zero. +umask 022 +ulimit -c 0 + +############## + +# Directory variables... + export SCRIPT_SYSTEM=feisty_meow #if [ -z "$FEISTY_MEOW_DIR" ]; then export FEISTY_MEOW_DIR="$HOME/$SCRIPT_SYSTEM"; fi @@ -58,6 +68,18 @@ if [ -z "$FEISTY_MEOW_GENERATED" ]; then export FEISTY_MEOW_GENERATED=$HOME/.zz_auto_gen fi +############## + +# user variables... + +# define a default name, if one wasn't already set. +if [ -z "$NAME" ]; then + export NAME='Unset Q. Namington, Fixley Your Name III' +fi + +############## + + ############################################################################## # other variables... ############################################################################## -- 2.34.1