Skip to content

Instantly share code, notes, and snippets.

@snmsts
Created May 21, 2015 11:00
Show Gist options
  • Save snmsts/96a66caaaf4ce4c23269 to your computer and use it in GitHub Desktop.
Save snmsts/96a66caaaf4ce4c23269 to your computer and use it in GitHub Desktop.
qlot.ros
#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -L sbcl-bin -Q -- $0 "$@"
|#
(defun main (&optional $1 &rest argv)
(declare (ignorable argv))
(cond ((equal "install" $1)
(ros:exec '("ros" "-Q" "-s" "qlot" "-e" "(qlot:install)")))
((equal "update" $1)
(ros:exec '("ros" "-Q" "-s" "qlot" "-e" "(qlot:update")))
((equal "exec" $1)
(unless (ros:getenv "QUICKLISP_HOME")
(ros:setenv "QUICKLISP_HOME" "quicklisp/"))
(let ((path (or (probe-file (ros:getenv "QUICKLISP_HOME"))
(merge-pathnames (ros:getenv "QUICKLISP_HOME")
(make-pathname :defaults *load-pathname* :name nil :type nil)))))
(unless (probe-file path)
(format t "Error: '~A' does not exist.~%" (ros:getenv "QUICKLISP_HOME"))
(ros:quit 1))
(unless (probe-file (merge-pathnames "setup.lisp" path))
(format t "Error: Invalid Quicklisp directory: '~A'~%" (ros:getenv "QUICKLISP_HOME"))
(ros:quit 1)))
(ros:exec argv))
(t (format t "Usage: ~A [install | update | exec shell-args..]~%" (namestring *load-pathname*))
(ros:quit 1))))
@fukamachi
Copy link

Looks perfect!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment