Skip to content

Commit

Permalink
Split code from /etc/lunar/config to /var/lib/lunar/bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
cavalier38 committed Jul 8, 2012
1 parent 3e98c26 commit bac454b
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 20 deletions.
1 change: 1 addition & 0 deletions Makefile
Expand Up @@ -56,6 +56,7 @@ install: .PHONY
install -m0755 $$F $(DESTDIR)/var/lib/lunar/compilers/ ; \
done
install -d $(DESTDIR)/var/lib/lunar
install -m0755 misc/bootstrap $(DESTDIR)/var/lib/lunar/
install -m0644 misc/excluded $(DESTDIR)/var/lib/lunar/
install -m0644 misc/protected $(DESTDIR)/var/lib/lunar/
install -m0644 misc/solo $(DESTDIR)/var/lib/lunar/
Expand Down
20 changes: 1 addition & 19 deletions etc/config
Expand Up @@ -16,6 +16,7 @@ export DIALOGRC=/etc/lunar/dialogrc

DEFAULT_PREFIX=/usr

BOOTSTRAP=/var/lib/lunar/bootstrap
EXCLUDED=/var/lib/lunar/excluded
MOONBASE=/var/lib/lunar/moonbase
PROTECTED=/var/lib/lunar/protected
Expand Down Expand Up @@ -116,22 +117,3 @@ export DIALOGRC=/etc/lunar/dialogrc
ENTER_IFS=$'\n'
STANDARD_IFS=$' \t\n'

for FUNCTION in $FUNCTIONS/*.lunar ; do
. $FUNCTION
done

if [ -s "$LOCAL_CONFIG" ] ; then
. $LOCAL_CONFIG
fi

for DIR_VAR in CONFIG_CACHE DEPENDS_CONFIG BUILD_DIRECTORY DOCUMENT_DIRECTORY DEFAULT_PREFIX MOONBASE FUNCTIONS MENUS PLUGIN_DIR SOUND_DIRECTORY INSTALL_LOGS COMPILE_LOGS MD5SUM_LOGS INSTALL_CACHE SOURCE_CACHE TMPDIR ; do
eval $DIR_VAR=\${$DIR_VAR/%\\/}
done

sound $SOUND
color $COLOR

for LUNAR_PLUGIN in $PLUGIN_DIR/*.plugin; do
. $LUNAR_PLUGIN
done

36 changes: 36 additions & 0 deletions misc/bootstrap
@@ -0,0 +1,36 @@
#!/bin/bash
############################################################
# #
# bootstrap - Lunar initialization code #
# #
############################################################
# #
# Copyright 2012 by Peter de Ridder under GPLv2 #
# #
############################################################

# check if /etc/lunar/config is loaded
if [ -z "$BOOTSTRAP" ] ; then
. /etc/lunar/config
fi

for FUNCTION in $FUNCTIONS/*.lunar ; do
. $FUNCTION
done

if [ -s "$LOCAL_CONFIG" ] ; then
. $LOCAL_CONFIG
fi

# validate and correct config variables from $LOCAL_CONFIG
for DIR_VAR in CONFIG_CACHE DEPENDS_CONFIG BUILD_DIRECTORY DOCUMENT_DIRECTORY DEFAULT_PREFIX MOONBASE FUNCTIONS MENUS PLUGIN_DIR SOUND_DIRECTORY INSTALL_LOGS COMPILE_LOGS MD5SUM_LOGS INSTALL_CACHE SOURCE_CACHE TMPDIR ; do
# dir configuration values shouldn't end with a /
eval $DIR_VAR=\${$DIR_VAR/%\\/}
done

sound $SOUND
color $COLOR

for LUNAR_PLUGIN in $PLUGIN_DIR/*.plugin; do
. $LUNAR_PLUGIN
done
1 change: 1 addition & 0 deletions prog/lget
Expand Up @@ -84,6 +84,7 @@ main() {


. /etc/lunar/config
. $BOOTSTRAP

GETOPT_ARGS=$(getopt -q -n lget -o "adf:hu:vw:" -l "all,debug,from:,help,url:,verbose,want:" -- "$@")

Expand Down
1 change: 1 addition & 0 deletions prog/lin
Expand Up @@ -212,6 +212,7 @@ main() {


. /etc/lunar/config
. $BOOTSTRAP

GETOPT_ARGS=$(getopt -q -n lin -o "cdf:hprRsvV:w:" -l "compile,debug,deps,from:,help,opts:,probe,reconfigure,resurrect,silent,verbose,Version:,want:" -- "$@")

Expand Down
1 change: 1 addition & 0 deletions prog/lrm
Expand Up @@ -306,6 +306,7 @@ downgrade() {


. /etc/lunar/config
. $BOOTSTRAP


GETOPT_ARGS=$(getopt -q -n lrm -o "dD:hknuvp" -l "debug,downgrade:,help,keepconfig,nosustain,upgrade,verbose,purge" -- "$@")
Expand Down
3 changes: 2 additions & 1 deletion prog/lsh
Expand Up @@ -5,6 +5,7 @@
#

. /etc/lunar/config
. $BOOTSTRAP

set_priority

Expand All @@ -14,6 +15,6 @@ else
export PS1="\[\033[0;31m\][lunar] \u@\h \w \\$ \[\033[0m\]"
message "\n ${PROBLEM_COLOR}Warning:${DEFAULT_COLOR}${MESSAGE_COLOR}" \
"lsh is potentially hazardous to your system.${DEFAULT_COLOR}\n"
bash --rcfile /etc/lunar/config
bash --rcfile $BOOTSTRAP
fi

1 change: 1 addition & 0 deletions prog/lunar
Expand Up @@ -794,6 +794,7 @@ main() {
}

. /etc/lunar/config
. $BOOTSTRAP

GETOPT_ARGS=$(getopt -q -n lunar -o "dhv" -l "debug,help,verbose" -- "$@")

Expand Down
1 change: 1 addition & 0 deletions prog/lvu
Expand Up @@ -1668,6 +1668,7 @@ main() {


. /etc/lunar/config
. $BOOTSTRAP

GETOPT_ARGS=$(getopt -q -n lvu -o "dhv" -l "debug,help,verbose" -- "$@")

Expand Down

0 comments on commit bac454b

Please sign in to comment.