next question: remote-test / remote-home ?

Andreas Reuleaux rx at a-rx.info
Wed Aug 3 19:23:15 BST 2022


As a followup to my own question - maybe this is it? (I am not sure,
but it seems better at least - and fingers crossed: seems to work):


--8<---------------cut here---------------start------------->8---

(defprop orig-bashrc-saved :posix ()
  (:desc #?"save original ${(get-connattr :remote-home)}.bashrc as ${(get-connattr :remote-home)}.bashrc.orig")
  (:apply
   (let (
	 (bashrc #?"${(get-connattr :remote-home)}/.bashrc")
	 (origfile #?"${(get-connattr :remote-home)}/.bashrc.orig")
	 )
     (unless (remote-exists-p origfile)
       (mrun "cp" bashrc origfile)
       )
     )
   )
  )


(defproplist my-bashrc :posix ()
  
  (:desc #?"${(get-connattr :remote-home)}.bashrc" )

  (orig-bashrc-saved)
  
  (file:has-content (uiop:native-namestring "~/cfg/bash/stamp")
		    `(
		      "case $- in"
		      "    *i*) ;;"
		      "    *) return ;; "
		      "esac"
		      )
		    )

  (file:has-content (uiop:native-namestring "~/.bashrc")
		    `(
		      "# -*- mode: shell-script -*-"
		      "source ~/cfg/bash/stamp"
		      "source <(~/cfg/bash/bashrc.scm)"
		      )
		    )
  
  )
--8<---------------cut here---------------end--------------->8---


I.e. within the defprop save-orig-bashrc I *can* use (get-connattr :remote-home), and
remote-exists-p I have found in
.../consfigurator/src/property/file.lisp in the code for symlinked there.

Is this the way to do it? - Create my own (single) property, wherein I
can use get-connattr etc. - Or is it somehow possible to use
(get-connattr :remote-home) within defproplist directly ?

I assume the other parts are still wrong

--8<---------------cut here---------------start------------->8---
  (file:has-content (uiop:native-namestring "~/cfg/bash/stamp") ...)

  (file:has-content (uiop:native-namestring "~/.bashrc") ...)
--8<---------------cut here---------------end--------------->8---

in that I should avoid using uiop:native-namestring (for resolving "~"),
and rely on (get-connattr :remote-home) instead - in a similar fashion:
create my own properties?


Thanks,
  -A



More information about the sgo-software-discuss mailing list