View | Details | Raw Unified | Return to bug 242212 | Differences between
and this patch

Collapse All | Expand All

(-)usr.sbin/mergemaster/mergemaster.sh (-2 / +116 lines)
Lines 1093-1098 Link Here
1093
  fi
1093
  fi
1094
done
1094
done
1095
1095
1096
# Compare regular files
1096
for COMPFILE in `find . -type f | sort`; do
1097
for COMPFILE in `find . -type f | sort`; do
1097
1098
1098
  # First, check to see if the file exists in DESTDIR.  If not, the
1099
  # First, check to see if the file exists in DESTDIR.  If not, the
Lines 1182-1187 Link Here
1182
  fi # Yes, the file still remains to be checked
1183
  fi # Yes, the file still remains to be checked
1183
done # This is for the for way up there at the beginning of the comparison
1184
done # This is for the for way up there at the beginning of the comparison
1184
1185
1186
ask_answer_for_symbolic_link () {
1187
  HANDLE_COMPSYMLINK=''
1188
  while true; do
1189
    echo "  Use 'd' to delete the temporary ${COMPSYMLINK}"
1190
    echo "  Use 'i' to install the temporary ${COMPSYMLINK}"
1191
    echo ''
1192
    echo "  Default is to leave the temporary symbolic link to deal with by hand"
1193
    echo ''
1194
    echo -n "How should I deal with this? [Leave it for later] "
1195
    read HANDLE_COMPSYMLINK
1196
    case ${HANDLE_COMPSYMLINK} in
1197
      ''|[dDiI])
1198
        break
1199
        ;;
1200
      *)
1201
        echo "invalid choice: ${HANDLE_COMPSYMLINK}"
1202
        echo ''
1203
        HANDLE_COMPSYMLINK=''
1204
        ;;
1205
    esac
1206
  done
1207
}
1208
1209
install_symbolic_link () {
1210
  rm -f ${DESTDIR}${COMPSYMLINK#.} > /dev/null 2>&1
1211
  if [ -L ${DESTDIR}${COMPSYMLINK#.} ]; then
1212
    return 1
1213
  fi
1214
  cp -a ${COMPSYMLINK} ${DESTDIR}${COMPSYMLINK#.} > /dev/null 2>&1
1215
  if [ ! -L ${DESTDIR}${COMPSYMLINK#.} ]; then
1216
    return 1
1217
  fi
1218
  return 0
1219
}
1220
1221
handle_symbolic_link () {
1222
  case ${HANDLE_COMPSYMLINK} in
1223
    [dD])
1224
      rm ${COMPSYMLINK}
1225
      echo ''
1226
      echo "   *** Deleting ${COMPSYMLINK}"
1227
      echo ''
1228
      return 1
1229
      ;;
1230
    [iI])
1231
      echo ''
1232
      if install_symbolic_link; then
1233
        rm ${COMPSYMLINK}
1234
        echo "   *** ${COMPSYMLINK} installed successfully"
1235
        return 2
1236
      else
1237
        echo "   *** Problem installing ${COMPSYMLINK}, it will remain to merge by hand"
1238
        return 3
1239
      fi
1240
      echo ''
1241
      ;;
1242
    '')
1243
      echo ''
1244
      echo "   *** ${COMPSYMLINK} will remain for your consideration"
1245
      echo ''
1246
      return 0
1247
      ;;
1248
  esac
1249
}
1250
1251
# Compare symblic links
1252
for COMPSYMLINK in `find . -type l | sort`; do
1253
  if [ ! -L "${DESTDIR}${COMPSYMLINK#.}" ]; then
1254
    if [ -n "${AUTO_RUN}" -a -z "${AUTO_INSTALL}" ]; then
1255
      echo "   *** ${COMPSYMLINK} will remain for your consideration"
1256
      continue
1257
    else
1258
      echo ''
1259
      echo "  *** There is no installed version of ${COMPSYMLINK}"
1260
      echo ''
1261
      if [ -n "${AUTO_INSTALL}" ]; then
1262
        HANDLE_COMPSYMLINK="i"
1263
      else
1264
        ask_answer_for_symbolic_link
1265
      fi
1266
      handle_symbolic_link
1267
      if [ -n "${AUTO_INSTALL}" -a $? -eq 2 ]; then
1268
        AUTO_INSTALLED_FILES="${AUTO_INSTALLED_FILES}      ${DESTDIR}${COMPSYMLINK#.}
1269
"
1270
      fi
1271
    fi
1272
  elif [ $(readlink ${COMPSYMLINK}) = $(readlink ${DESTDIR}${COMPSYMLINK#.}) ]; then
1273
    echo " *** Temp ${COMPSYMLINK} and installed are the same, deleting"
1274
    rm ${COMPSYMLINK}
1275
  else
1276
    if [ -n "${AUTO_RUN}" -a -z "${AUTO_UPGRADE}" ]; then
1277
      echo "   *** ${COMPSYMLINK} will remain for your consideration"
1278
      continue
1279
    else
1280
      echo ''
1281
      echo " *** Target of temp symbolic link is differnt from that of installed one"
1282
      echo "     Temp (${COMPSYMLINK}): $(readlink ${COMPSYMLINK})"
1283
      echo "     Installed (${DESTDIR}${COMPSYMLINK#.})): $(readlink ${DESTDIR}${COMPSYMLINK#.})"
1284
      echo ''
1285
      if [ -n "${AUTO_UPGRADE}" ]; then
1286
        HANDLE_COMPSYMLINK="i"
1287
      else
1288
        ask_answer_for_symbolic_link
1289
      fi
1290
      handle_symbolic_link
1291
      if [ -n "${AUTO_UPGRADE}" -a $? -eq 2 ]; then
1292
        AUTO_UPGRADED_FILES="${AUTO_UPGRADED_FILES}      ${DESTDIR}${COMPSYMLINK#.}
1293
"
1294
      fi
1295
    fi
1296
  fi
1297
done
1298
1185
echo ''
1299
echo ''
1186
echo "*** Comparison complete"
1300
echo "*** Comparison complete"
1187
1301
Lines 1193-1202 Link Here
1193
1307
1194
echo ''
1308
echo ''
1195
1309
1196
TEST_FOR_FILES=`find ${TEMPROOT} -type f -size +0 2>/dev/null`
1310
TEST_FOR_FILES=`find ${TEMPROOT} -type f -size +0 -or -type l 2>/dev/null`
1197
if [ -n "${TEST_FOR_FILES}" ]; then
1311
if [ -n "${TEST_FOR_FILES}" ]; then
1198
  echo "*** Files that remain for you to merge by hand:"
1312
  echo "*** Files that remain for you to merge by hand:"
1199
  find "${TEMPROOT}" -type f -size +0 | sort
1313
  find "${TEMPROOT}" -type f -size +0 -or -type l | sort
1200
  echo ''
1314
  echo ''
1201
1315
1202
  case "${AUTO_RUN}" in
1316
  case "${AUTO_RUN}" in

Return to bug 242212