[Lunar-commits] CVS: brutus/lunar-tools/grimoire/lunar-convert BUILD, NONE, 1.1 DEPENDS, NONE, 1.1 DETAILS, NONE, 1.1 POST_BUILD, NONE, 1.1 POST_INSTALL, NONE, 1.1 PRE_BUILD, NONE, 1.1

Auke Kok sofar at lunar-linux.org
Sat Jan 31 21:55:40 GMT 2004


Update of /var/cvs/lunar/brutus/lunar-tools/grimoire/lunar-convert
In directory dbguin.lunar-linux.org:/tmp/cvs-serv27952/lunar-convert

Added Files:
	BUILD DEPENDS DETAILS POST_BUILD POST_INSTALL PRE_BUILD 
Log Message:
Moving things to a logical place


--- NEW FILE: BUILD ---
(
# we will not track the installation 
# what if someone lrm that ? :)
#  prepare_install  &&
  ./install

) > $C_FIFO 2>&1

--- NEW FILE: DEPENDS ---
depends  bash
depends  bzip2
depends  cpio
depends  dialog
depends  e2fsprogs
depends  file
depends  findutils
depends  grep
depends  gzip
depends  installwatch
depends  less
depends  makedev
depends  nano
depends  patch
depends  rpmunpack
depends  sed
depends  tar
depends  textutils
depends  unzip
depends  wget
depends  xdelta

optional_depends  "lunaric-sound"  ""  ""  "to have sorcery signal events with sound."
optional_depends  "openssh"        ""  ""  "to use cabal multi-box system administration"
optional_depends  "mutt"           ""  ""  "to send messages"

--- NEW FILE: DETAILS ---
           SPELL=lunar-convert
         VERSION=`date -u +%Y%m%d`
          SOURCE=lunar.tar.bz2
SOURCE_DIRECTORY=$BUILD_DIRECTORY/lunar
   SOURCE_URL[0]=http://lunar-penguin.org/lunar/$SOURCE
        WEB_SITE=http://lunar-penguin.org
         ENTERED=20020323
         UPDATED=20020326
      MAINTAINER=kongar at tsrsb.org.tr
        NO_CACHE="--cache=off"
           SHORT="Lunar-convert installs lunar package and migrates sorcery files"
cat << EOF
lunar-convert installs lunar, the new package management system for 
lunar-penguin.  It migrates the old sorcery files to the new system. 

The information for lunar once it is installed will be more detailed. 

EOF

--- NEW FILE: POST_BUILD ---
# . $SCRIPT_DIRECTORY/DETAILS > /dev/null
default_post_build

--- NEW FILE: POST_INSTALL ---
ETC="/etc"
VAR="/var"
MV=mv

query()
{
   echo $1
   read -n 1 ANSWER
   ANSWER=${ANSWER:=$2}
   case  $ANSWER  in
          Y|y) true  ;;
            *) false ;;
   esac
}


# phase 1: convert the locals

if [ -e $ETC/lunar/local/config ]; then 
   echo "$ETC/lunar/local/config already exists, no action taken" 
else
   if (
         mkdir -p $ETC/lunar/local               &&
         cp    -r /etc/sorcery/local $ETC/lunar 
      ); then
      echo
      echo "Phase 1/6: etc directories converted" 
   else
      echo
      echo "Can not create $ETC/lunar/local or can not copy /etc/sorcery/local to $ETC/lunar"
      echo "Aborting..."
      exit
   fi
fi

if [ -e $ETC/lunar/local/config ]; then
   cp $ETC/lunar/local/config $ETC/lunar/local/config.sorcerer
   echo "--------------------------------------------------------------"
   echo "Seems that you have set a couple of local options for sorcery."
   echo "These local options are probably not compatible with lunar."
   echo "You will find $ETC/lunar/local/config.sorcerer contains your"
   echo "prior local settings. Please run lunar and re-set appropriate"
   echo "options."
   echo "--------------------------------------------------------------"
fi

# phase 2: convert the spool dir
if [ -d $VAR/spool/lunar ]; then 
   echo "$VAR/spool/lunar already exists, no action taken" 
else 
   if [ -n "$NO_BIGGIES" ]; then
      echo 
      echo "NO_BIGGIES is set :=), spool dirs not moved"
   else
      if (
            $MV /var/spool/sorcery $VAR/spool/lunar    &&
            ln -s $VAR/spool/lunar $VAR/spool/sorcery
          ); then
         echo
         echo "Phase 2/6: spool directories converted" 
      else
         echo
         echo "Can not $MV /var/spool/sorcery $VAR/spool/lunar"
         echo "Aborting..."
         exit
      fi
   fi
fi

# phase 3: convert the log directories
if [ -d $VAR/log/lunar ]; then 
   echo "$VAR/log/lunar exists, no action taken" 
else 
   if (
      $MV /var/log/sorcery $VAR/log/lunar   &&
      ln -s $VAR/log/lunar $VAR/log/sorcery
      ); then
      echo "Phase 3/6: log directories converted" 
   else
      echo
      echo "Can not $MV /var/log/sorcery $VAR/spool/lunar"
      echo "Aborting..."
      exit
   fi
fi


# phase 4: convert the cache
if [ -d $VAR/cache/lunar ]; 
then 
   echo "$VAR/cache/lunar exists, no action taken" 
else 
   if [ -n "$NO_BIGGIES" ]; then
      echo
      echo "NO_BIGGIES is set :=), cache dirs not moved"
  else
      if (
            $MV /var/cache/sorcery $VAR/cache/lunar  &&
            ln -s $VAR/cache/lunar $VAR/cache/sorcery 
         ); then
         echo
         echo "Phase 4/6 cache directories converted" 
      else
         echo
         echo "Can not $MV $VAR/cache/sorcery $VAR/cache/lunar"
         echo "Aborting..."
         exit
      fi
   fi
fi


# phase 5: convert the state
if [ -d $VAR/state/lunar ];
then 
   echo "$VAR/state/lunar exists, no action taken" 
else 
   if (
      $MV /var/state/sorcery $VAR/state/lunar      &&
      ln -s $VAR/state/lunar $VAR/state/sorcery
      ); then
      echo "Phase 5/6: state directories converted" 
   else
      echo
      echo "Can not $MV $VAR/state/sorcery $VAR/state/lunar"
      echo "Aborting..."
      exit
   fi
fi


echo
if query  "Do you wish to run lunar to set your options? (recommended, y|Y do accept, any ther key to decline)" 
then
   lunar
else
   echo "action cancelled by user"
fi

echo
if query  "Do you wish to run lunar update? (recommended, y|Y do accept, any other key to decline)" 
then
   lunar update
else
   echo "action cancelled by user" 
fi

# phase 6: chmod -x sorcery binaries

echo
if [ -x /usr/sbin/cast   ];  then chmod -x /usr/sbin/cast;    echo "cast is now lin";      fi;
if [ -x /usr/sbin/dispel ];  then chmod -x /usr/sbin/dispel;  echo "dispel is now lrm";    fi;
if [ -x /usr/sbin/gaze   ];  then chmod -x /usr/sbin/gaze;    echo "gaze is now lvu";      fi;
if [ -x /usr/sbin/leach  ];  then chmod -x /usr/sbin/leach;   echo "leach is now lget";    fi;
if [ -x /usr/sbin/vcast  ];  then chmod -x /usr/sbin/vcast;   echo "vcast is now lvu";     fi;
if [ -x /usr/sbin/sorcery ]; then chmod -x /usr/sbin/sorcery; echo "sorcery is now lunar"; fi;
echo
echo "Phase 6/6: old sorcery executable scripts are NOT executable anymore" 

--- NEW FILE: PRE_BUILD ---
query()
{  
   echo $1
   read -s -n 1 ANSWER 
   ANSWER=${ANSWER:=$2}
   case  $ANSWER  in
         Y|y) true  ;;
           *) false ;;
   esac
}  

check_wish() {
cat << EOF
------------------------------------------------------------------
This spell will convert your sorcery base to lunar base.

It will NOT remove or alter any files; however, it will
rename and symlink a couple of directories.

After the script is finished, you will have the new lunar
base and lunar commands. If you wish to revert (why?) make
the old sorcery scripts executable again (ie, cd /usr/sbin; 
chmod +x cast dispel sorcery leach vcast gaze).

This will be a six phased conversion.

Lunar will be run in order to make sure the local configuration
is ok.

A lunar update will also be run automatically to install
other necessary files and moonbase.

EOF

  if ! query  "Do you wish to continue? (Y|y to accept, any other key to decline)"
  then 
     echo "cancelled by user"
     exit 
  fi
}

# note from hevisko, to check unavail due to net shares

check_netmounts() {
if ! [ -d /var/spool/lunar ]; then
   mkdir /var/spool/lunar
   df /var/spool/lunar >/tmp/l.test
   df /var/spool/sorcery > /tmp/s.test
   rmdir /var/spool/lunar
   if ( `diff --brief /tmp/?.test | grep -q "differ"` ) ; then
      echo "------------------------------------------------------------------"
      echo 
      echo "Seems that either your /var/spool/sorcery directory is"
      echo "a network mount or a seperate partition etc."
      echo
      echo "In order to run that spell, the free space on"
      echo "/var/spool/sorcery and /var/spool/lunar (not created yet)"
      echo "must be SAME. In other words, these two must be in the same"
      echo "mount point."
      echo
      echo "You may continue to convert BUT /var/spool/sorcery and"
      echo "/var/cache/sorcery directories will NOT be converted"
      echo
      if ! query "Do you wish to continue? (Y|y to accept, any other key to decline)"
      then
         echo "cancelled by user"
         exit
      else
         export NO_BIGGIES="yes"
      fi
   fi
else
   echo
   echo "You already have a /var/spool/lunar directory"
   echo "This spell moves /var/spool/sorcery to /var/spool/lunar"
   echo "since you already have a target destination, either you"
   echo "converted your box to lunar already, or something other :=)"
   echo 
   echo "Conversion cancelled"
   echo
   exit
fi
}

unset NO_BIGGIES
check_wish
check_netmounts
default_pre_build





More information about the Lunar-commits mailing list