cddistupgrader 619 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/sh
  2. #
  3. CDROM_MOUNT="$1"
  4. for d in "$CDROM_MOUNT"/dists/*/main/dist-upgrader/binary-all/; do
  5. if [ -d "$d" ]; then
  6. UPGRADER_DIR="$d"
  7. break
  8. fi
  9. done
  10. TAR=$(basename "$UPGRADER_DIR"/*.tar.gz)
  11. CODENAME=${TAR%.tar.gz}
  12. # get a tempdir
  13. TMPDIR=$(mktemp -t -d distupgrade.XXXXXX)
  14. cd $TMPDIR
  15. # extract the tar
  16. tar xzf "$UPGRADER_DIR"/"$TAR"
  17. # apply any patches needed before running the upgrade
  18. for apatch in /usr/share/update-notifier/upgrader-patches/*.diff; do
  19. if patch --dry-run < "$apatch"; then
  20. patch < "$apatch"
  21. fi
  22. done
  23. # run it
  24. "$TMPDIR"/"$CODENAME" --cdrom "$CDROM_MOUNT"