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

Collapse All | Expand All

(-)usr.sbin/mergemaster/mergemaster.sh (+111 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
      return 1
1228
      ;;
1229
    [iI])
1230
      if install_symbolic_link; then
1231
        echo "   *** ${COMPSYMLINK} installed successfully"
1232
        echo ''
1233
        return 2
1234
      else
1235
        echo "   *** Problem installing ${COMPSYMLINK}, it will remain to merge by hand"
1236
        echo ''
1237
        return 3
1238
      fi
1239
      ;;
1240
    '')
1241
      echo ''
1242
      echo "   *** ${COMPFILE} will remain for your consideration"
1243
      return 0
1244
      ;;
1245
  esac
1246
}
1247
1248
# Compare symblic links
1249
for COMPSYMLINK in `find . -type l | sort`; do
1250
  if [ ! -L "${DESTDIR}${COMPSYMLINK#.}" ]; then
1251
    if [ -n "${AUTO_RUN}" -a -z "${AUTO_INSTALL}" ]; then
1252
      echo "   *** ${COMPSYMLINK} will remain for your consideration"
1253
      continue
1254
    else
1255
      echo ''
1256
      echo "  *** There is no installed version of ${COMPSYMLINK}"
1257
      echo ''
1258
      if [ -n "${AUTO_INSTALL}" ]; then
1259
        HANDLE_COMPSYMLINK="i"
1260
      else
1261
        ask_answer_for_symbolic_link
1262
      fi
1263
      handle_symbolic_link
1264
      if [ -n "${AUTO_INSTALL}" -a $? -eq 2 ]; then
1265
        AUTO_INSTALLED_FILES="${AUTO_INSTALLED_FILES}      ${DESTDIR}${COMPSYMLINK#.}
1266
"
1267
      fi
1268
    fi
1269
  elif [ $(readlink ${COMPSYMLINK}) = $(readlink ${DESTDIR}${COMPSYMLINK#.}) ]; then
1270
    echo " *** Temp ${COMPSYMLINK} and installed are the same, deleting"
1271
    rm ${COMPSYMLINK}
1272
  else
1273
    if [ -n "${AUTO_RUN}" -a -z "${AUTO_UPGRADE}" ]; then
1274
      echo "   *** ${COMPSYMLINK} will remain for your consideration"
1275
      continue
1276
    else
1277
      echo ''
1278
      echo " *** Target of temp ${COMPSYMLINK} is differnt from that of installed"
1279
      echo "     Temp:$(readlink ${COMPSYMLINK})"
1280
      echo "     Installed: $(readlink ${DESTDIR}${COMPSYMLINK#.})"
1281
      echo ''
1282
      if [ -n "${AUTO_UPGRADE}" ]; then
1283
        HANDLE_COMPSYMLINK="i"
1284
      else
1285
        ask_answer_for_symbolic_link
1286
      fi
1287
      handle_symbolic_link
1288
      if [ -n "${AUTO_UPGRADE}" -a $? -eq 2 ]; then
1289
        AUTO_UPGRADED_FILES="${AUTO_UPGRADED_FILES}      ${DESTDIR}${COMPSYMLINK#.}
1290
"
1291
      fi
1292
    fi
1293
  fi
1294
done
1295
1185
echo ''
1296
echo ''
1186
echo "*** Comparison complete"
1297
echo "*** Comparison complete"
1187
1298

Return to bug 242212