[Lunar-commits]
CVS: theedge/var/lib/lunar/functions recovery.lunar, 1.5, 1.6
Auke Kok
sofar at lunar-linux.org
Mon May 10 11:46:22 GMT 2004
Update of /var/cvs/lunar/theedge/var/lib/lunar/functions
In directory dbguin.lunar-linux.org:/tmp/cvs-serv32583
Modified Files:
recovery.lunar
Log Message:
This way recovery even recovers the approximate install date. I've tested this on many boxes now and it's absolutely wonderfull. Considering putting this in the lunar maintenance menu so people can use it (although it's still mopping up after some other part goofs up)
Index: recovery.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/recovery.lunar,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- recovery.lunar 9 May 2004 12:08:55 -0000 1.5
+++ recovery.lunar 10 May 2004 11:46:20 -0000 1.6
@@ -21,33 +21,21 @@
# purpose : rebuild the accidentally deleted status files
rebuild_status_files() {
debug_msg "rebuild_status_files ($@)"
- message "${PROBLEM_COLOR} Unable to find MODULE_STATUS files\n" \
- "${MODULE_COLOR}$MODULE_STATUS and $MODULE_STATUS_BACKUP" \
- "${DEFAULT_COLOR}\n" \
- "${PROBLEM_COLOR}This is a serious error!!\n\nInformation about" \
- "the modules on hold CAN NOT be recovered.\nHowever, the files" \
- "can be re-constructed.\nDo not forget to check your on hold " \
- "modules!" \
- "${DEFAULT_COLOR}\n"
if ! query \
"Do you want to re-construct the status files from install logs?" y; then
- message "${PROBLEM_COLOR}Unable to continue without status files :=("\
- "No more operation!!" \
+ message "${PROBLEM_COLOR}Unable to continue without status files" \
"${DEFAULT_COLOR}"
exit 1
fi
if ! [ -d "$INSTALL_LOGS" ]; then
- message "${PROBLEM_COLOR}Unable to continue without install logs :=("\
- "No more operation!!" \
+ message "${PROBLEM_COLOR}Unable to continue without install logs " \
"${DEFAULT_COLOR}"
exit 1
fi
message "${MESSAGE_COLOR}Re-creating status files." \
- "${DEFAULT_COLOR}" \
- "${PROBLEM_COLOR}DO NOT BREAK!!" \
"${DEFAULT_COLOR}"
LOG_FILES=$(ls -rt $INSTALL_LOGS)
@@ -62,16 +50,23 @@
((COUNTS++))
VERSION=$(echo $MODULE_NAME | cut -d "-" -f "$COUNTS"-)
SIZE=$(find_module_size $REAL_NAME $VERSION)
- add_module $REAL_NAME installed $VERSION $SIZE
- message "Added: $REAL_NAME-$VERSION ($SIZE)"
+ DATE=$(ls -l $INSTALL_LOGS/$REAL_NAME-$VERSION --time-style=+%Y%m%d | awk '{print $6}')
+ lock_file $MODULE_STATUS &&
+ lock_file $MODULE_STATUS_BACKUP &&
+ # adjusted add_module code that echos the DATE field ;^)
+ grep -v "^$1:" $MODULE_STATUS_BACKUP >$MODULE_STATUS 2>/dev/null &&
+ echo "$1:$DATE:$2:$3:$4" >>$MODULE_STATUS &&
+ cat $MODULE_STATUS >$MODULE_STATUS_BACKUP &&
+ unlock_file $MODULE_STATUS_BACKUP &&
+ unlock_file $MODULE_STATUS
+ message "Added: $REAL_NAME-$VERSION ($SIZE) ($DATE)"
break;
fi
((COUNTS--))
done
done
- message "${MESSAGE_COLOR}Success!!" \
- "${DEFAULT_COLOR}\n"
+ message "${MESSAGE_COLOR}Success!!${DEFAULT_COLOR}\n"
}
More information about the Lunar-commits
mailing list