Lines Matching full:file

40 # unmodified file, the new version of the file, and the modified file.
41 # This requires having all three versions of the file available when
73 etcupdate revert [-d workdir] [-D destdir] [-L logfile] file ...
93 # file with " " prepended.
109 # Output a text description of a specified file's type.
111 # $1 - file pathname.
117 # Returns true (0) if a file exists
119 # $1 - file pathname.
125 # Returns true (0) if a file should be ignored, false otherwise.
127 # $1 - file pathname
144 # same file in /root. This ensures we only compare those
159 # Returns true (0) if the new version of a file should always be
162 # $1 - file pathname
186 local destdir dir file make autogenfiles metatmp
211 for file in $PREWORLD_FILES; do
212 name=$(basename $file)
214 cp -p $SRCDIR/$file $1/etc/$name || return 1
356 # If the two nodes are different file types fail.
374 # If both are files, compare the file contents.
383 # As long as the two nodes are the same type of file, consider
391 # $1 - path of first file
392 # $2 - path of second file
441 local contents file
450 for file in $contents; do
451 if ! compare $1/$file $2/$file; then
455 if [ -d $1/$file ]; then
456 if ! dir_subset $1/$file $2/$file; then
494 local first second file old new diffargs
524 first=`readlink $1/$file`
525 second=`readlink $2/$file`
527 echo "Link changed: $file"
542 # are not tied to a specific file, so they cannot be handled by
594 # If non-directory file exists with the desired directory
598 # directory in the DESTDIR and the file in the DESTDIR
599 # matches the file in the old tree, then fake success
629 # Perform post-install fixups for a file. This largely consists of
630 # regenerating any files that depend on the newly installed file.
632 # $1 - pathname of the updated file (relative to DESTDIR)
688 # Install the "new" version of a file. Returns true if it succeeds
691 # $1 - pathname of the file to install (relative to DESTDIR)
706 # Install the "resolved" version of a file. Returns true if it succeeds
709 # $1 - pathname of the file to install (relative to DESTDIR)
713 # This should always be present since the file is already
727 # Generate a conflict file when a "new" file conflicts with an
728 # existing file in DESTDIR.
730 # $1 - pathname of the file that conflicts (relative to DESTDIR)
745 # Remove the "old" version of a file.
747 # $1 - pathname of the old file to remove (relative to DESTDIR)
757 # Update a file that has no local modifications.
759 # $1 - pathname of the file to update (relative to DESTDIR)
764 # If the old file is a directory, then remove it with rmdir
765 # (this should only happen if the file has changed its type
780 # existing file. This avoids breaking hard links for /.cshrc
781 # and /.profile. Otherwise, explicitly remove the old file.
789 # If the new file is a directory, note that the old file has
795 echo " D $file"
797 echo " U $file"
800 echo " U $file"
805 # Update the FreeBSD ID string in a locally modified file to match the
806 # FreeBSD ID string from the "new" version of the file.
808 # $1 - pathname of the file to update (relative to DESTDIR)
811 local new dest file
813 # If the FreeBSD ID string is removed from the local file,
814 # there is nothing to do. In this case, treat the file as
815 # updated. Otherwise, if either file has more than one
827 # If the FreeBSD ID string in the new file matches the FreeBSD ID
828 # string in the local file, there is nothing to do.
835 # Build the new file in three passes. First, copy all the
837 # of the file. Second, append the FreeBSD ID string line from
839 # FreeBSD ID string from the local version of the file.
840 file=`mktemp $WORKDIR/etcupdate-XXXXXXX`
841 awk '/\$FreeBSD.*\$/ { exit } { print }' ${DESTDIR}$1 >> $file
842 awk '/\$FreeBSD.*\$/ { print }' ${NEWTREE}$1 >> $file
844 ${DESTDIR}$1 >> $file
847 # version of the file has any differences aside from the
849 if ! fbsdid_only ${DESTDIR}$1 $file; then
850 rm -f $file
854 log "cp $file ${DESTDIR}$1"
856 cp $file ${DESTDIR}$1 >&3 2>&1
858 rm -f $file
864 # Attempt to update a file that has local modifications. This routine
866 # conflicts, the updated file is installed. If the merge fails, the
869 # $1 - pathname of the file to merge (relative to DESTDIR)
880 # real file.
910 # Returns true if a file contains conflict markers from a merge conflict.
912 # $1 - pathname of the file to resolve (relative to DESTDIR)
920 # action for each conflict. If the user edits the file, they are
926 # $1 - pathname of the file to resolve (relative to DESTDIR)
934 # Only display the resolved command if the file
953 (df) diff-full - show all changes made to merged file
954 (e) edit - change merged file in an editor
955 (r) resolved - accept merged version of file
956 (mf) mine-full - accept local version of entire file (ignore new changes)
957 (tf) theirs-full - accept new version of entire file (lose local changes)
963 # merged file and leave the local
964 # version of the file as-is.
972 # If the merged file has conflict
975 echo "File '$1' still has conflicts," \
992 # version of the file over top of the
993 # existing file.
1008 # Handle a file that has been removed from the new tree. If the file
1009 # does not exist in DESTDIR, then there is nothing to do. If the file
1012 # file in DESTDIR. To handle directories, this uses two passes. The
1016 # If -F is specified, and the only difference in the file in DESTDIR
1017 # is a change in the FreeBSD ID string, then remove the file.
1019 # $1 - pathname of the file (relative to DESTDIR)
1022 local dest file
1024 file=$1
1025 if ignore $file; then
1026 log "IGNORE: removed file $file"
1030 compare_fbsdid $DESTDIR/$file $OLDTREE/$file
1033 if ! [ -d $DESTDIR/$file ]; then
1034 remove_old $file
1038 panic "Removed file now missing"
1044 dest=`file_type $DESTDIR/$file`
1045 warn "Modified $dest remains: $file"
1077 # Handle a file that exists in both the old and new trees. If the
1078 # file has not changed in the old and new trees, there is nothing to
1079 # do. If the file in the destination directory matches the new file,
1080 # there is nothing to do. If the file in the destination directory
1081 # matches the old file, then the new file should be installed.
1085 # $1 - pathname of the file (relative to DESTDIR)
1088 local cmp dest file new newdestcmp old
1090 file=$1
1091 if ignore $file; then
1092 log "IGNORE: modified file $file"
1096 compare $OLDTREE/$file $NEWTREE/$file
1103 panic "Changed file now missing"
1106 compare $NEWTREE/$file $DESTDIR/$file
1112 # If the only change in the new file versus the destination
1113 # file is a change in the FreeBSD ID string and -F is
1114 # specified, just install the new file.
1116 fbsdid_only $NEWTREE/$file $DESTDIR/$file; then
1117 if update_unmodified $file; then
1124 # If the local file is the same as the old file, install the
1125 # new file. If -F is specified and the only local change is
1126 # in the FreeBSD ID string, then install the new file as well.
1127 if compare_fbsdid $OLDTREE/$file $DESTDIR/$file; then
1128 if update_unmodified $file; then
1133 # If the file was removed from the dest tree, just whine.
1135 # If the removed file matches an ALWAYS_INSTALL glob,
1136 # then just install the new version of the file.
1137 if always_install $file; then
1138 log "ALWAYS: adding $file"
1139 if ! [ -d $NEWTREE/$file ]; then
1140 if install_new $file; then
1141 echo " A $file"
1147 # If the only change in the new file versus the old
1148 # file is a change in the FreeBSD ID string and -F is
1151 fbsdid_only $OLDTREE/$file $NEWTREE/$file; then
1157 old=`file_type $OLDTREE/$file`
1158 new=`file_type $NEWTREE/$file`
1159 warn "Remove mismatch: $file ($old became $new)"
1162 old=`readlink $OLDTREE/$file`
1163 new=`readlink $NEWTREE/$file`
1165 "Removed link changed: $file (\"$old\" became \"$new\")"
1168 warn "Removed file changed: $file"
1174 # Treat the file as unmodified and force install of the new
1175 # file if it matches an ALWAYS_INSTALL glob. If the update
1178 if always_install $file; then
1179 log "ALWAYS: updating $file"
1180 if update_unmodified $file; then
1185 # If the only change in the new file versus the old file is a
1187 # update the FreeBSD ID string in the local file.
1189 fbsdid_only $OLDTREE/$file $NEWTREE/$file; then
1190 if update_freebsdid $file; then
1195 # If the file changed types between the old and new trees but
1197 # type, treat it like an added file just comparing the new and
1202 new=`readlink $NEWTREE/$file`
1203 dest=`readlink $DESTDIR/$file`
1205 "New link conflict: $file (\"$new\" vs \"$dest\")"
1209 new_conflict $file
1210 echo " C $file"
1215 # If the file has not changed types between the old
1219 new=`file_type $NEWTREE/$file`
1220 dest=`file_type $DESTDIR/$file`
1221 warn "Modified mismatch: $file ($new vs $dest)"
1228 old=`file_type $OLDTREE/$file`
1229 new=`file_type $NEWTREE/$file`
1230 dest=`file_type $DESTDIR/$file`
1231 warn "Modified $dest changed: $file ($old became $new)"
1234 old=`readlink $OLDTREE/$file`
1235 new=`readlink $NEWTREE/$file`
1237 "Modified link changed: $file (\"$old\" became \"$new\")"
1240 merge_file $file
1245 # Handle a file that has been added in the new tree. If the file does
1246 # not exist in DESTDIR, simply copy the file into DESTDIR. If the
1247 # file exists in the DESTDIR and is identical to the new version, do
1248 # nothing. Otherwise, generate a diff of the two versions of the file
1251 # $1 - pathname of the file (relative to DESTDIR)
1254 local cmp dest file new
1256 file=$1
1257 if ignore $file; then
1258 log "IGNORE: added file $file"
1262 compare $DESTDIR/$file $NEWTREE/$file
1269 panic "Added file now missing"
1275 if ! [ -d $NEWTREE/$file ]; then
1276 if install_new $file; then
1277 echo " A $file"
1285 # Treat the file as unmodified and force install of the new
1286 # file if it matches an ALWAYS_INSTALL glob. If the update
1289 if always_install $file; then
1290 log "ALWAYS: updating $file"
1291 if update_unmodified $file; then
1298 new=`file_type $NEWTREE/$file`
1299 dest=`file_type $DESTDIR/$file`
1300 warn "New file mismatch: $file ($new vs $dest)"
1303 new=`readlink $NEWTREE/$file`
1304 dest=`readlink $DESTDIR/$file`
1305 warn "New link conflict: $file (\"$new\" vs \"$dest\")"
1308 # If the only change in the new file versus
1309 # the destination file is a change in the
1311 # install the new file.
1313 fbsdid_only $NEWTREE/$file $DESTDIR/$file; then
1314 if update_unmodified $file; then
1322 new_conflict $file
1323 echo " C $file"
1372 local file
1386 for file in `(cd $NEWTREE; find .) | sed -e 's/^\.//'`; do
1387 if ignore $file; then
1391 diffnode $NEWTREE "$DESTDIR" $file "stock" "local"
1454 for file in $conflicts; do
1455 resolve_conflict $file
1472 local cmp file
1478 for file; do
1479 log "revert $file"
1481 if ! [ -e $NEWTREE/$file ]; then
1482 echo "File $file does not exist in the current tree."
1485 if [ -d $NEWTREE/$file ]; then
1486 echo "File $file is a directory."
1490 compare $DESTDIR/$file $NEWTREE/$file
1496 if update_unmodified $file; then
1497 # If this file had a conflict, clean up the
1499 if [ -e $CONFLICTS/$file ]; then
1500 if ! rm $CONFLICTS/$file >&3 2>&1; then
1502 "for $file".
1625 # odd case that a directory is converted into a file, the
1627 # file is converted. Similarly, in the case that a file is
1628 # converted into a directory, the file needs to be converted
1632 for file in `cat $WORKDIR/removed.files`; do
1633 handle_removed_file $file
1640 for file in `sort -r $WORKDIR/removed.files`; do
1641 handle_removed_directory $file
1646 for file in `cat $WORKDIR/both.files`; do
1647 handle_modified_file $file
1651 for file in `cat $WORKDIR/added.files`; do
1652 handle_added_file $file
1756 # Files that should always have the new version of the file installed.
1768 # Include a config file if it exists. Note that command line options
1769 # override any settings in the config file. More details are in the
1866 # the config file.
1873 # config file.
1882 # Log file for verbose output from program that are run. The log file
1895 # The path of the "warnings" file that accumulates warning notes from an update.
1905 # about unsupported options. Since the configuration file is always
1907 # may have been set via the config file rather than the command line.
1948 # Open the log file. Don't truncate it if doing a minor operation so