;;;; ;;;; Patch index for Corman Lisp 3.0 ;;;; (in-package :ccl) (export '(*patches-available*)) (defun auto-update-upgrade-confirm () (let ((result (eq (win:message-box-yes-no (format nil (concatenate 'string "Your AUTO-UPGRADE system is not up to date.~%" "To get the newest updates you need to install the update.~%" "Installing it will create a new CormanLisp.img file, and your " "patch level will revert to 0. ~%" "When you restart Corman Lisp you will be prompted to download " "and install all patches.~%" "Would you like to continue?")) "Upgrade AUTO-UPDATE") 'win:IDYES))) (unless result (win:message-box-ok "After the new CormanLisp.img file is created, please close and restart Corman Lisp." "Information")) result)) (in-package :win) #! (:export t :library "KERNEL32" :pascal "WINAPI") WINAPI BOOL CopyFileExA(LPCTSTR lpExistingFileName, LPCTSTR lpNewFileName, LPVOID lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags); !# (in-package :ccl) (defun copy-file (source dest) (win:CopyFileEx (namestring source) (namestring dest) ct:null ct:null ct:null 0)) (defun move-file (source dest) (win::MoveFile (ct:lisp-string-to-c-string (namestring source)) (ct:lisp-string-to-c-string (namestring dest)))) (defun install-auto-update-1 () ;; backup files (let* ((backup-dir (merge-pathnames "backup/" *cormanlisp-directory*)) (sys-backup-dir (merge-pathnames "sys/" backup-dir))) (ensure-directories-exist sys-backup-dir) (copy-file (merge-pathnames "CormanLisp.img" *cormanlisp-directory*) (merge-pathnames "CormanLisp.img" backup-dir)) (copy-file (merge-pathnames "sys/auto-update.lisp" *cormanlisp-directory*) (merge-pathnames "auto-update.lisp" sys-backup-dir)) (copy-file (merge-pathnames "sys/sockets.lisp" *cormanlisp-directory*) (merge-pathnames "sockets.lisp" sys-backup-dir))) ;; delete patch files (let ((patch-files (sort (directory (merge-pathnames "CormanLisp_3_0_patch_??.lisp" (ccl::local-patches-directory))) #'string< :key 'namestring))) (dolist (file patch-files) (delete-file file))) ;; copy new files (sockets:get-http-file "www.cormanlisp.com" "/CormanLisp/patches/3_0/auto-update/sys/auto-update.lisp" (merge-pathnames "sys/auto-update.lisp" *cormanlisp-directory*)) (sockets:get-http-file "www.cormanlisp.com" "/CormanLisp/patches/3_0/auto-update/sys/sockets.lisp" (merge-pathnames "sys/sockets.lisp" *cormanlisp-directory*)) (compile-cormanlisp-image)) (unless (and (boundp 'ccl::*auto-update-level*) (>= ccl::*auto-update-level* 1)) (if (auto-update-upgrade-confirm) (install-auto-update-1))) (defparameter *patches-available* nil) (defparameter *patch-server* "www.cormanlisp.com") (defparameter *patch-root-directory* "/CormanLisp/patches/3_0/") (defparameter *max-patch-level* 2) (define-patch 1 "CormanLisp_3_0_patch_01.lisp") (define-patch 2 "CormanLisp_3_0_patch_02.lisp") (if (and (boundp 'ccl::*auto-update-level*) (>= ccl::*auto-update-level* 1)) (if (and (> *max-patch-level* *cormanlisp-patch-level*) (patch-upgrade-confirm *max-patch-level*)) (let ((patches (reverse *patches-available*))) (dolist (p patches) (if (> (cormanlisp-patch-level p) *cormanlisp-patch-level*) (install-patch p))))))