#! /bin/sh -e . /usr/share/debconf/confmodule db_capb backup ## Main state machine. state=0 while :; do case $state in 0) db_input medium runlisp/dump-custom-images || : ;; 1) db_get runlisp/dump-custom-images case $RET in select) ;; *) state=2; continue ;; esac ## Determine the configured Lisp systems. sects=$(query-runlisp-config -LM) unset lisps for s in $sects; do case $s in @*) continue ;; esac if ! query-runlisp-config -M -p$s:dump-image >/dev/null 2>&1 then continue; fi lisps=${lisps+$lisps, }$s done db_subst runlisp/selected-implementations lisps "$lisps" ## See if the list has changed recently. db_get runlisp/available-implementations case $RET in "$lisps") ch=nil prio=medium ;; *) ch=t prio=high db_set runlisp/available-implementations "$lisps" ;; esac ## Filter nonexistent implementations from the active list. db_get runlisp/selected-implementations case $RET in -) v=$lisps ;; *) unset v for i in $(echo "$RET" | tr , " "); do case " $lisps," in *" $i,"*) v=${v+$v, }$i ;; esac done ;; esac db_set runlisp/selected-implementations "$v" case $ch in t) db_fset runlisp/selected-implementations seen false ;; esac db_input $prio runlisp/selected-implementations || : ;; -1) exit 10 ;; *) break ;; esac set +e; db_go; rc=$?; set -e case $rc in 0) state=$(( $state + 1 )) ;; 30) state=$(( $state - 1 )) ;; *) exit $rc ;; esac done