Lua Odin
Enviado por leugim802 • 23 de Noviembre de 2018 • Apuntes • 1.313 Palabras (6 Páginas) • 382 Visitas
#!/bin/sh
dfltlib=${ODINPKGS-/usr/local/lib/Odin}
prog=odin
USAGE="usage: $prog [-c cache] [-k] [-r] [-R] [-s] command ..."
cmd=; keep_going=; meta_cache=; preset=; quick=; reset=;
ODIN_SERVER=1; ODIN_SERVER_SHUTDOWN=;
export ODINCACHE ODIN_SERVER ODIN_SERVER_SHUTDOWN
while [ $# -gt 0 ] ; do
case $1 in
# use specified cache rather than the default cache
-c)
if [ $# -lt 2 ] ; then echo $USAGE; exit 1; fi
meta_cache=$2; shift;shift;;
# keep going after build errors detected
-k)
ODIN_KEEPGOING=1; export ODIN_KEEPGOING; shift;;
# do not run the derivation graph compiler
-q)
quick=1; shift;;
# reset the cache (clear all derived objects)
-r)
reset=1; shift;;
# reset the cache and the packages (update to latest versions)
-R)
preset=1; reset=1; shift;;
# have Odin client be its own server if there is not a server
-s)
ODIN_SERVER=; shift;;
-*)
echo $USAGE; exit 1;;
*)
break;; esac; done
while [ $# -gt 0 ] ; do
case $1 in
-*)
echo $USAGE; exit 1;;
*)
cmd="$cmd;$1"; shift;; esac; done
if [ "$ODINCACHE" != "" -a "$meta_cache" = "" ] ; then
if [ "$reset" != "" ] ; then
echo "Cannot reset active cache."
exit 1; fi
ODINVERIFYLEVEL=0; export ODINVERIFYLEVEL
ODINLOGLEVEL=0; export ODINLOGLEVEL
ODINERRLEVEL=0; export ODINERRLEVEL
ODINWARNLEVEL=0; export ODINWARNLEVEL
exec $ODINCACHE/PKGS/odin/odin.exe "$cmd"; fi
if [ "$meta_cache" = "" ] ; then
meta_cache=${ODIN-$HOME/.ODIN}; fi
odinview=${ODINVIEW-`uname -n`}
if [ "$odinview" = "" ] ; then
odinview=local; fi
cache=$meta_cache/$odinview
if [ ! -d $cache ] ; then
case $meta_cache in /*);; *)
echo "Cache location must be an absolute pathname: $meta_cache"
exit 1;; esac
if [ ! -d $meta_cache ] ; then
mkdir $meta_cache || exit; fi
mkdir $cache || exit
echo $cache > $cache/PATH
mkdir $cache/PKGS || exit
touch $cache/LOG || exit
preset=1; reset=''
echo "New cache created at $cache."; fi
...