Skip to content

Instantly share code, notes, and snippets.

@svetlyak40wt
Created March 11, 2021 10:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save svetlyak40wt/00ceaa4118609555d1630e3d500050b6 to your computer and use it in GitHub Desktop.
Save svetlyak40wt/00ceaa4118609555d1630e3d500050b6 to your computer and use it in GitHub Desktop.
Example how to restore SBCL_HOME and be able to (REQUIRE :SB-INTROSPECT)

To check, use Roswell to build the script:

ros build foo.ros

and run it

./foo

root@0abe81b77f83:/tmp/test# ./foo
 - ASDF
 - SB-BSD-SOCKETS
 - SB-INTROSPECT
 - SB-POSIX
 - UIOP
 - asdf
 - uiop
#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#
(defpackage :ros.script.foo
(:use :cl))
(in-package :ros.script.foo)
(defvar *home*
(sb-int:sbcl-homedir-pathname))
(defun restore-home ()
(setf sb-sys::*sbcl-homedir-pathname*
*home*))
(pushnew 'restore-home sb-ext:*init-hooks*)
(defun main (&rest argv)
(declare (ignorable argv))
(require :sb-introspect)
(loop for m in (sort (copy-list *modules*) #'string<)
do (format t " - ~A~%" m)))
;;; vim: set ft=lisp lisp:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment