[Ultrapossum-cvs 573] ultrapossum 1.17,1.18,update-ultrapossum

Back to archive index

Masato Taruishi taru****@users*****
2004年 9月 27日 (月) 18:07:56 JST


===================================================================
RCS file: ultrapossum/update-ultrapossum,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- ultrapossum/update-ultrapossum	2004/09/22 05:50:53	1.17
+++ ultrapossum/update-ultrapossum	2004/09/27 09:07:55	1.18
@@ -27,11 +27,11 @@
 trap "eval `ultrapossum-config term`" 0
 
 configure_module() {
-  ultrapossum-config module | while read f
+  for module in $@
   do
-    v="ULTRAPOSSUM_MODULE_`echo $f | tr a-z- A-Z_`"
+    v="ULTRAPOSSUM_MODULE_`echo $module | tr a-z- A-Z_`"
     if test "x$reconfig" = "x" || test "${!v}" = "installed"; then
-      $UPDATEDIR/update-$f configure
+      $UPDATEDIR/update-$module configure
     fi
   done
 }
@@ -44,7 +44,7 @@
 }
 
 sanity_module() {
-  ultrapossum-config module | while read f
+  for f in $@
   do
     v="ULTRAPOSSUM_MODULE_`echo $f | tr a-z- A-Z_`"
     if test "${!v}" = "installed"; then
@@ -54,53 +54,57 @@
 }
 
 up_to_date() {
+
   if ! test -f "$CONFSTATUS"; then
     echo "status change detected" 1>&2
     return 1
   fi
-  if test "$SLAPDCONF" -nt "$CONFSTATUS"; then
-    echo "$SLAPDCONF is newer than current status" 1>&2
-    return 1
-  fi
-  find $SYSCONFDIR | while read f
-  do
-    if test "$f" -nt "$CONFSTATUS"; then
-      echo "$f is newer than current status" 1>&2
+  if test "x$@" = "x"; then
+    if test "$SLAPDCONF" -nt "$CONFSTATUS"; then
+      echo "$SLAPDCONF is newer than current status" 1>&2
       return 1
     fi
-  done || return 1
+    find $SYSCONFDIR | while read f
+    do
+      if test "$f" -nt "$CONFSTATUS"; then
+        echo "$f is newer than current status" 1>&2
+        return 1
+      fi
+    done || return 1
+  fi
+
   return 0
 }
 
+check_configuring_module() {
+  modules=`ultrapossum-config module`
+  if ! up_to_date; then
+    echo $modules
+  else
+    for module in $modules
+    do
+      getvalues $conftemp "`ultrapossum-config variable $module`" > $conftemp.$$
+      getvalues $CONFSTATUS "`ultrapossum-config variable $module`" > $conftemp.$$2 
+      if diff -c $conftemp.$$ $conftemp.$$2 | egrep "^\! [^+]" | cut -d' ' -f2- | cut -d= -f1 | sort | uniq | egrep . > /dev/null; then
+        echo " $module"
+      fi
+      /bin/rm -f $conftemp.$$ $conftemp.$$2
+    done
+  fi
+}
+
 configure() {
   conftemp=`tempfile`
   chmod 640 $conftemp
-  getconfig | grep -v SLAPROOTPW | grep -v CHROOTFILES > $conftemp
   # little evil
-  if ! up_to_date ||
-  	diff -c $CONFSTATUS $conftemp | egrep "^\! [^+]" | cut -d' ' -f2- | cut -d= -f1 | sort | uniq | egrep . 1>&2
-  then
-    sanity_module
-
-#  if test "x$MASTER" = "x$HOST"; then
-#    if test -f "$DIRECTORY/$BACKUP.ldif"; then
-#      ssh -t $BACKUP "sh -c '
-#eval \`ultrapossum-config get SYSCONFDIR\`
-#if test "x$ULTRAPOSSUM_PROJECT" = "x"; then
-#  cf=\$SYSCONFDIR/ultrapossum.cf
-#else
-#  cf=\$SYSCONFDIR/projects/$ULTRAPOSSUM_PROJECT
-#fi
-#ultrapossum-config set \$cf SUFFIX=$SUFFIX MASTER=$MASTER BACKUP=$BACKUP > \$cf.tmp 
-#mv \$cf.tmp \$cf
-#ULTRAPOSSUM_PROJECT=$ULTRAPOSSUM_PROJECT update-ultrapossum configure'
-#"
-#    fi
-#  fi
-
+  getconfig | grep -v SLAPROOTPW | grep -v CHROOTFILES > $conftemp
+  module=`check_configuring_module`
+  if test "x$module" != "x"; then
+    sanity_module $module
     install -d $CONFDIR
 
-    configure_module
+    configure_module $module
+
     /bin/cp -p $conftemp $CONFSTATUS
     cat $conftemp > $CONFSTATUS
   else



Ultrapossum-cvs メーリングリストの案内
Back to archive index