[Abtlinux-svn] SF.net SVN: abtlinux: [466] src/trunk/abt.rb
Status: Alpha
Brought to you by:
eschabell
From: <esc...@us...> - 2007-12-31 14:26:28
|
Revision: 466 http://abtlinux.svn.sourceforge.net/abtlinux/?rev=466&view=rev Author: eschabell Date: 2007-12-31 06:26:27 -0800 (Mon, 31 Dec 2007) Log Message: ----------- Implemented auto fix/setup of configuration and libs. This includes setting load paths and loading. Modified Paths: -------------- src/trunk/abt.rb Modified: src/trunk/abt.rb =================================================================== --- src/trunk/abt.rb 2007-12-31 14:08:51 UTC (rev 465) +++ src/trunk/abt.rb 2007-12-31 14:26:27 UTC (rev 466) @@ -1,8 +1,5 @@ #!/usr/bin/ruby -w -$LOAD_PATH.unshift '/etc/abt/' -$LOAD_PATH.unshift '/var/lib/abt/' - ## # abt.rb # @@ -29,15 +26,18 @@ ## # Load our central configuration file. +# $ABTLINUX_MAIN_CONFIG = "https://abtlinux.svn.sourceforge.net/svnroot/abtlinux/src/trunk/abtconfig.rb" if File.exist?( "/etc/abt/abtconfig.rb" ) - load '/etc/abt/abtconfig.rb' + $LOAD_PATH.unshift '/etc/abt/' + load 'abtconfig.rb' else # missing configuration file, do some abt update? puts "\nMissing our main configuration file at /etc/abt/abtconfig.rb" puts "\nMaybe time for an abt update? Let us try to fix it for you!\n" - # TODO: check for root login. + + # check for root login. if ( Process.uid != 0 ) puts "\nMust be root to fix configuration files." exit @@ -49,10 +49,36 @@ end } system( "svn export #{$ABTLINUX_MAIN_CONFIG} /etc/abt/abtconfig.rb" ) - exit end + + $LOAD_PATH.unshift '/etc/abt/' + load 'abtconfig.rb' + + if File.exist?( "/etc/abt/local/localconfig.rb" ) + $LOAD_PATH.unshift '/etc/abt/local/' + load 'localconfig.rb' + end end +# Check and install our library files. +# +$ABTLINUX_CLASS_LIBS = "https://abtlinux.svn.sourceforge.net/svnroot/abtlinux/src/trunk/libs" + +if ( ! File.directory?( '/var/lib/abt' ) || Dir["/var/lib/abt"].empty? ) + puts "\nMissing needed AbTLinux library files at /var/lib/abt" + puts "\nMaybe time for an abt update? Let us try to fix it for you!\n" + + # check for root login. + if ( Process.uid != 0 ) + puts "\nMust be root to fix library files." + exit + else + system( "svn co #{$ABTLINUX_CLASS_LIBS} /var/lib/abt/" ) + end + + $LOAD_PATH.unshift '/var/lib/abt/' +end + ## # Setup needed classes and get ready to parse arguments. ## This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |