CVS: brutus/elaine/lunar+versions lin,NONE,1.1
elaine at lunar-linux.org
elaine at lunar-linux.org
Mon Sep 8 19:51:39 GMT 2003
Update of /var/cvs/lunar/brutus/elaine/lunar+versions
In directory dbguin.lunar-linux.org:/tmp/cvs-serv18334
Added Files:
lin
Log Message:
Added -V --Version may be used as an alternat to module/version syntax or
to pass $MOD_VERSION to the module SCRIPTS
--- NEW FILE: lin ---
#!/bin/bash
############################################################
# #
# lin - install Lunar modules #
# #
############################################################
# cast is part of the sorcery spell management utility #
# Copyright 2001 by Kyle Sallee #
############################################################
# #
# this WAS the cast script of a source based Linux distro, #
# calls Sorcerer GNU/Linux, or SGL. SGL is no longer #
# available with GPL license. Since this script was taken #
# before licensing scheme change, no legal problems I #
# guess. #
# #
# the code is re-written for Lunar. The previous Copyright #
# notices are kept; just in case some code is left :=) #
# Kagan Kongar <kongar at tsrsb.org.tr>, 20020519 #
# #
############################################################
# #
# Parts Copyrighted Jason Johnston 2002 under GPLv2 #
# #
# Parts Copyrighted Kagan Kongar 2002 under GPLv2 #
# #
############################################################
help() {
cat << EOF
Lin installs single or multiple modules
Example: lin nano hdparm sudo
Usage: lin [parameters] [module]
Optional Parameters:
-c | --compile Ignore $INSTALL_CACHE and compiles
-d | --debug Enables debug messages
--deps Configure modules and determine dependencies,
-f | --from directory Specify an alternate for $SOURCE_CACHE
-h | --help Displays this help text
-p | --probe Only lin if not already installed
-r | --reconfigure Select new dependencies for modules
-R | --resurrect Force module to be unpacked from /var/cache/lunar
-s | --silent Decreases the level of message output
-v | --verbose Increases the level of message output
-V | --Version Select specific Version of module to install
EOF
exit 1
}
main() {
debug_msg "main ($@)"
MODULES="$@"
message "mod_v = $MOD_VERSION mod= $MODULES"
if echo $MODULES | grep -qw moonbase ; then
# just update moonbase, no other modules
get_moonbase
# remove moonbase rofm MODULES and continue
MODULES=$(echo $MODULES | sed 's/moonbase//g')
if [ -z "$MODULES" ] ; then
return
fi
fi
if [ -z "$MODULES" ] ; then
message "${MESSAGE_COLOR}Nothing to do!${DEFAULT_COLOR}"
return
fi
# different approaches for multiple modules (start up downloads first)
# and single modules (plain install)
if [ $(echo $MODULES | wc -w) -gt 1 ] ; then
if [ -n "$MOD_VERSION" ] ; then
message "${MESSAGE_COLOR} -V|--Version only allowed for single-mdoule install!${DEFAULT_COLOR}"
exit 1
fi
if [ ! -n "$TEMP_DOWNLOADLOG" ] ; then
export TEMP_DOWNLOADLOG=$(temp_create "${MODULE}.download-log")
fi
if [ ! -n "$TEMP_PREPAREDDEPS" ] ; then
export TEMP_PREPAREDDEPS=$(temp_create "${MODULE}.prepared-depends")
fi
# pass 1 : run full dependency checking
# This pass does configuration and dependency identification.
if ! build_depends $MODULES ; then
temp_destroy $TEMP_DOWNLOADLOG
temp_destroy $TEMP_PREPAREDDEPS
verbose_msg "Unexpected errors, bailing out!"
exit 1
elif [ -n "$DEPS_ONLY" ] ; then
temp_destroy $TEMP_DOWNLOADLOG
temp_destroy $TEMP_PREPAREDDEPS
exit 0
fi
# pass 2 : hit the download manager button and grab a beer
# this runs as a background process, so we are off to step #3 right away
verbose_msg "Spawning download manager"
lget $MODULES >> $TEMP_DOWNLOADLOG 2>&1 &
# pass 3 : compile/install
# no strange stuff should happen here anymore
for MODULE in $MODULES ; do
verbose_msg "starting installation of \"$MODULE\""
if ! module_installed $MODULE || [ ! -n "$PROBE" ] ; then
if ! module_held $MODULE ; then
linING="/var/lock/installing.$MODULE"
if [ -n "$COMPILE" ] ||
[ -n "$RECONFIGURE" ] ||
module_installed $MODULE ||
! resurrect $MODULE; then
if ! lin $DEPS_ONLY $RECONFIGURE $COMPILE $PROBE $SILENT $MODULE ; then
if [ -e "$TMP_LIN_FAIL" ] ; then
echo "$MODULE" >> $TMP_LIN_FAIL
fi
lin_EXIT_STATUS=1;
else
if [ -e "$TMP_LIN_SUCCESS" ] ; then
echo "$MODULE" >> $TMP_LIN_SUCCESS
fi
fi
fi
else
verbose_msg "Skipping compile and install for held module \"$MODULE\""
fi
fi
done
# cleanups that we need to do
temp_destroy $TEMP_DOWNLOADLOG
temp_destroy $TEMP_PREPAREDDEPS
else
if [ -n "$MOD_VERSION" ] ; then
if echo $MODULES | grep -q '/' ; then
if [ -d ${MOONBASE}/*/${MODULES} ] ; then
unset MOD_VERSION
else
message "${PROBLEM_COLOR}No Moonbase module:${FILE_COLOR}$MODULES${MESSAGE_COLOR}\
with $MODULES form, bailing!${DEFAULT_COLOR}"
return 1
fi
else
if [ -d ${MOONBASE}/*/${MODULES}/${MOD_VERSION} ] ; then
MODULES="${MODULES}/${MOD_VERSION}"
else
message "${MESSAGE_COLOR}$MODULES Passing${FILE_COLOR} $MOD_VERSION${MESSAGE_COLOR}\
to module for processing${DEFAULT_COLOR}"
fi
message "Module = $MODULES"
fi
fi
if [ -z "$TEMP_PREPAREDDEPS" ] ; then
FLAG_PREPAREDDEPS_SET=on
export TEMP_PREPAREDDEPS=$(temp_create "prepared-depends")
fi
# we are only doing one module, drop down to:
MODULE=$MODULES
if ! module_held $MODULE ; then
if [ -n "$PROBE" ] ; then
if ! module_installed $MODULE ; then
build_depends $MODULE &&
if [ ! -n "$DEPS_ONLY" ] ; then
if ! lin_module $MODULE ; then
temp_destroy $TEMP_PREPAREDDEPS
exit 1
fi
fi
fi
else
build_depends $MODULE &&
if [ ! -n "$DEPS_ONLY" ] ; then
if ! lin_module $MODULE ; then
temp_destroy $TEMP_PREPAREDDEPS
exit 1
fi
fi
fi
else
verbose_msg "Skipping held module \"$MODULE\""
fi
if [ -n "$FLAG_PREPAREDDEPS_SET" ] ; then
temp_destroy $TEMP_PREPAREDDEPS
unset FLAG_PREPAREDDEPS_SET
fi
fi
}
. /etc/lunar/config
GETOPT_ARGS=$(getopt -q -n lin -o "cdf:hprRsvV:" -l "compile,debug,deps,from:,help,probe,reconfigure,resurrect,silent,verbose,Version:" -- "$@")
if [ -z "$?" ] ; then
help | view_file
exit
else
eval set -- $GETOPT_ARGS
export IFS="$STANDARD_IFS"
root_check
enviro_check
set_priority
while true ; do
case "$1" in
-c|--compile ) export COMPILE="$1" ; shift ;;
-d|--debug ) (( LUNAR_DEBUG++ )) ; export LUNAR_DEBUG ; shift ;;
--deps ) export DEPS_ONLY="$1" ; shift ;;
-f|--from ) export SOURCE_CACHE=$2 ; shift 2 ;;
-h|--help ) help ; exit ;;
-p|--probe ) export PROBE="$1" ; shift ;;
-r|--reconfigure ) export RECONFIGURE="$1" ; shift ;;
-R|--resurrect ) export RESURRECT="$1" ; shift ;;
-s|--silent ) export SILENT="$1" ; shift ;;
-v|--verbose ) export VERBOSE="on" ; shift ;;
-V|--Version ) export MOD_VERSION=$2 ; shift 2 ;;
--) shift ; break ;;
*) help ; break ;;
esac
done
if [ -n "$RESURRECT" ] ; then
resurrect_modules $@
else
main $@
fi
fi
More information about the Lunar-commits
mailing list