[Lunar-commits] <lunar> Split code from /etc/lunar/config to /var/lib/lunar/bootstrap

Peter de Ridder peter at lunar-linux.org
Sun Jul 8 17:27:37 CEST 2012


commit bac454b3cd48744eec59b77f0f5c6cebe41515f1
Author: Peter de Ridder <peter at lunar-linux.org>
Date: Sun, 08 Jul 2012 08:27:37 -0700
URL: https://github.com/lunar-linux/lunar/commit/bac454b3cd48744eec59b77f0f5c6cebe41515f1

Split code from /etc/lunar/config to /var/lib/lunar/bootstrap
---
  Makefile                                                     +1/-0     
  etc/config                                                   +1/-19    
  misc/bootstrap                                               +36/-0    
  prog/lget                                                    +1/-0     
  prog/lin                                                     +1/-0     
  prog/lrm                                                     +1/-0     
  prog/lsh                                                     +2/-1     
  prog/lunar                                                   +1/-0     
  prog/lvu                                                     +1/-0     
  9 files changed, 45 insertions (+), 20 deletions (-)

--- a/Makefile
+++ b/Makefile
@@ -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/
--- a/etc/config
+++ b/etc/config
@@ -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
@@ -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
-
--- /dev/null
+++ b/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
--- a/prog/lget
+++ b/prog/lget
@@ -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:" -- "$@")
 
--- a/prog/lin
+++ b/prog/lin
@@ -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:" -- "$@")
 
--- a/prog/lrm
+++ b/prog/lrm
@@ -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" -- "$@")
--- a/prog/lsh
+++ b/prog/lsh
@@ -5,6 +5,7 @@
 #
 
 . /etc/lunar/config
+. $BOOTSTRAP
 
 set_priority
 
@@ -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
 
--- a/prog/lunar
+++ b/prog/lunar
@@ -794,6 +794,7 @@ main() {
 }
   
 . /etc/lunar/config
+. $BOOTSTRAP
 
 GETOPT_ARGS=$(getopt -q -n lunar -o "dhv" -l "debug,help,verbose" -- "$@")
 
--- a/prog/lvu
+++ b/prog/lvu
@@ -1668,6 +1668,7 @@ main()  {
 
 
 . /etc/lunar/config
+. $BOOTSTRAP
 
 GETOPT_ARGS=$(getopt -q -n lvu -o "dhv" -l "debug,help,verbose" -- "$@")
 




More information about the Lunar-commits mailing list