Since the Chromium web browser does still not feature a built-in build update mechanism, and since Mac OS X lacks a comprehensive, high-quality package management system, users need to download and install Chromium updates manually at regular intervals. Even though there are both stand-alone applications and browser add-ons that try to help, most of them have seemed to be broken since the last time Google changed their build archive location.
Therefore, I have written a small Common Lisp program that downloads and unpacks the latest Chromium build for me. It's very simple and could easily be replaced by a Perl script, but it works well enough for me.
Note that the program naively unpacks the ZIP file into the /Applications folder, which results in a separate chrome-mac folder being created.
Source code follows.
(eval-when (:compile-toplevel :load-toplevel :execute)
(dolist (module (list "drakma" "alexandria"))
(ql:quickload module)))
(defpackage #:mulk.update-chromium
(:use #:common-lisp #:alexandria))
(in-package #:mulk.update-chromium)
(defparameter *base-uri*
"https://commondatastorage.googleapis.com/chromium-browser-continuous")
(defparameter *os-subdir* "Mac")
(defparameter *filename* "chrome-mac.zip")
(defparameter *target-dir* #p"/Applications/")
(defun latest-version ()
(parse-integer
(drakma:http-request (format nil "~A/~A/LAST_CHANGE" *base-uri* *os-subdir*))))
(defun file-uri (revision)
(format nil "~A/~A/~A/~A" *base-uri* *os-subdir* revision *filename*))
(defun main ()
(let* ((revision (latest-version))
(uri (file-uri revision))
(file #p"/tmp/chrome-update.zip"))
(format t "~&Latest revision: ~A" revision)
(format t "~&Downloading.")
(unwind-protect
(progn
(with-open-file (out file
:direction :output
:if-exists :supersede
:element-type '(unsigned-byte 8))
(write-sequence (drakma:http-request uri) out))
(format t "~&Extracting archive contents.")
(sb-ext:run-program "/usr/bin/unzip"
(list "-o" (namestring file)
"-d" (namestring *target-dir*))
:wait t))
(delete-file file))))
Comments
Submit a comment
Note: This website uses a JavaScript-based spam prevention system. Please enable JavaScript in your browser to post comments. Comment format is plain text. Use blank lines to separate paragraphs.