commit - 4296ac34ab12564a2ad1373d836f05640c81a52d
commit + 027fa3d916b0f730e7b29e32aea80566d5704422
blob - 410d6c1f2bbd1b3571eb658b46f1a65aa5c0487b
blob + 8f2749da0d93446c5b918ddebe86f0a8298d0f7f
--- client/update-dragonfly.conf
+++ client/update-dragonfly.conf
SERVER=http://globus.mathematik.uni-marburg.de:2323
# Path on the update server
-RPATH=apache2-default/update
+RPATH=apache2-default/update/up
# SHA1 Fingerprint
FINGERPRINT=25d291846a993e055a368fa07f58c545ffba283f
blob - 88afc9cd4274cf6501092c804bb9dcac7afc1c91
blob + e9470c71b49b127a45c5b2dbb757753b317f5644
--- client/update-dragonfly.sh
+++ client/update-dragonfly.sh
fi
}
+# Write entries to a log file and update previous entries. This avoids
+# duplicates
+write_log_entry()
+{
+ TMP=`mktemp /tmp/update-dragonfly.XXXXXX` || return 1
+
+ # File not found thus create an entry and return
+ if [ ! -e ${5} ]; then
+ echo "${1}#${2}#${3}#${4}" > ${5}
+ rm -f ${TMP}
+ return 0
+ fi
+
+ DUP=0
+ for i in `cat ${5}`; do
+ # Duplicate found
+ if [ "`echo $i | cut -d '#' -f 1`" = "${1}" ]; then
+ DUP=1
+ log "Duplicate entry for ${1} detected. Update."
+ echo "${1}#${2}#${3}#${4}" >> ${TMP}
+ else
+ echo "$i" >> ${TMP}
+ fi
+ done
+
+ # No duplicate found thus we have to add the new entry manually
+ if [ ${DUP} -eq 0 ]; then
+ echo "${1}#${2}#${3}#${4}" >> ${TMP}
+ fi
+
+ cat ${TMP} > ${5}
+ rm -f ${TMP} || return 1
+
+ return 0
+}
+
# Save all file information needed for a correct installation:
# User, Group, Location, Mode
save_file_perm()
# $2 = Checksum of the modified (new) file
if [ -e ${1} ]; then
- log "Save file status"
# Handle file flag
if [ `stat -f "%Of" ${1}` -eq 400000 ]; then
log "schg"
fi
STR=`stat -f "%OLp#%Su#%Sg" ${1}` || return
# Write install log entry
- echo "${1}#${STR}#${2}#${FL}" >> ${TMPLOG}
+ #echo "${1}#${STR}#${2}#${FL}" >> ${INSTLOG}
+ write_log_entry "${1}" "${STR}" "${2}" "${FL}" "${INSTLOG}"
else
log "${1} not installed. Help me"
fi
exit 1
fi
- if [ ! -e ${TMPLOG} ]; then
+ if [ ! -e ${PASTLOG} ]; then
echo "No update log found. Cannot reinstall backups"
exit 1
fi
echo -n "Reinstalling backups... "
- for i in `cat ${TMPLOG}`; do
+ for i in `cat ${PASTLOG}`; do
# Location of the file
BINARY=`echo ${i} | cut -d '#' -f 1`
# Mode
# Number of installed files
ISUM=0
- if [ ! -e ${TMPLOG} ]; then
+ if [ ! -e ${INSTLOG} ]; then
echo "No update log found. Please run `basename $0` -g at first"
exit 1
fi
echo "Without -n `basename $0` would update the following files"
fi
- for i in `cat ${TMPLOG}`; do
+ for i in `cat ${INSTLOG}`; do
# Location of the file
BINARY=`echo ${i} | cut -d '#' -f 1`
# Mode
${BIN_TEMP} ${BINARY} || return 1
# Reset possible file flags
handle_file_flags ${BINARY} ${FLAGS} 1
+ write_log_entry "${BINARY}" \
+ "${MODE}#${USER}#${GROUP}" "${SUM_NEW}" \
+ "${FLAGS}" "${PASTLOG}"
ISUM=$(($ISUM + 1))
else
echo "${BINARY}"
show_updates()
{
# NO INSTALL.LOG found
- if [ ! -e ${TMPLOG} ]; then
+ if [ ! -e ${INSTLOG} ]; then
echo "All available updates are already installed"
return
fi
echo ""
echo "Updates for the following files are available:"
- for i in `cat ${TMPLOG}`; do
+ for i in `cat ${INSTLOG}`; do
echo ${i} | cut -d '#' -f 1
done
}
if [ ${CAIRET} -eq 0 -a ${OVER} -eq 0 ]; then
# Patch existing file
save_file_perm ${BINARY} ${SUM_NEW}
- log "Patch ${BINARY}"
patch_file ${BINARY} ${DIFF} ${SUM_NEW}
elif [ ${CAIRET} -eq 0 -a ${OVER} -eq 1 ]; then
# Overwrite existing file
fi
# This is the file where all to-be-installed files are recorded
- TMPLOG=${LOC}/${VERSION}/INSTALL.LOG
- #if [ -e ${TMPLOG} ]; then
- # rm -f ${TMPLOG}
- #fi
+ INSTLOG=${LOC}/${VERSION}/INSTALL.LOG
+ if [ -e ${INSTLOG} ]; then
+ rm -f ${INSTLOG}
+ fi
# Fetch the checksum first. If the fetched checksum and the computed
# checksum of an installed INDEX file match, no newer updates are
RFLAG=0
DEBUG=0
-TMPLOG=
+INSTLOG=
+PASTLOG=
SUM=/sbin/sha1
set -- $args
if [ ${IFLAG} -eq 1 ]; then
startup
VERSION=`uname -r | cut -d '-' -f 1`
- TMPLOG=${LOC}/${VERSION}/INSTALL.LOG
+ INSTLOG=${LOC}/${VERSION}/INSTALL.LOG
+ PASTLOG=${LOC}/${VERSION}/PAST.LOG
install_updates
fi
if [ ${RFLAG} -eq 1 ]; then
startup
VERSION=`uname -r | cut -d '-' -f 1`
- TMPLOG=${LOC}/${VERSION}/INSTALL.LOG
+ INSTLOG=${LOC}/${VERSION}/INSTALL.LOG
+ PASTLOG=${LOC}/${VERSION}/PAST.LOG
reinstall_backup
fi