So I’ve been trying all your suggestions and did my best to create a workaround but I’m pulling my hair out now because I just can’t figure out what I’m doing wrong.
My updated snapcraft.yml:
name: visshous
base: core18
version: '0.1'
summary: magically transport your vim config to remote servers
description: |
ViSSHous is a simple tool which helps you carry your vim profile everywhere across SSH sessions, by embedding your vim configuration within SSH itself.
grade: devel
confinement: devmode
plugs:
vim-files:
interface: personal-files
read:
- $HOME/.vimrc
- $HOME/.vim
- $HOME/.ssh/viSSHous
write:
- $HOME/.vimrc
- $HOME/.vim
- $HOME/.bashrc
- $HOME/.zshrc
- $HOME/.ssh/viSSHous
apps:
visshous:
plugs:
- vim-files
command: sh $SNAP/vissh_snap
daemon: simple
restart-condition: always
parts:
visshous:
stage-packages:
- inotify-tools
source: https://github.com/gWOLF3/viSSHous/archive/v0.0.4.tar.gz
plugin: dump
As you can see, I’ve tried to give it all the permissions that it needs to work, as well as changed the command to a single command which runs inotify inside the shell script.
My shell script that I run looks like this:
if [ ! -f $HOME/.vimrc ]; then touch $HOME/.vimrc; fi;
inotifywait -e modify $HOME/.vimrc;
if ([ -f ~/.bashrc ] && ( ! grep -qR 'alias ssh="ssh -F ~/.ssh/viSSHous"' ~/.bashrc ));
then echo 'alias ssh="ssh -F ~/.ssh/viSSHous"' >> ~/.bashrc && bash
fi
if ([ -f ~/.zshrc ] && ( ! grep -qR 'alias ssh="ssh -F ~/.ssh/viSSHous"' ~/.zshrc ));
then echo 'alias ssh="ssh -F ~/.ssh/viSSHous"' >> ~/.zshrc && zsh
fi
echo "# last updated: $(date)" > ~/.ssh/viSSHous
echo 'Include ~/.ssh/config' >> ~/.ssh/viSSHous
echo "SetEnv LC_MONETARY=$(cat ~/.vimrc | base64)" >> ~/.ssh/viSSHous
echo "RequestTTY yes" >> ~/.ssh/viSSHous
A few things definitely seem to be wrong:
-
snap does not install inotify-tools
, even though it is listed as a dependency in my snapcraft.yml
-
if i run snap interfaces
, i don’t see any plugs attached to personal-files
:
:x11 multipass
- multipass:libvirt
- multipass:lxd
- visshous:vim-files
I see my plug there, but its not attached to anything.
- Finally, I try to debug whats happening with journalctl, and it’s very difficult to tell.
Sep 17 05:46:14 ubuntu-xfce systemd[1]: snap.visshous.visshous.service: Failed with result 'exit-code'.
Sep 17 05:46:14 ubuntu-xfce systemd[1]: snap.visshous.visshous.service: Unit entered failed state.
Sep 17 05:46:14 ubuntu-xfce systemd[1]: snap.visshous.visshous.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Sep 17 05:46:14 ubuntu-xfce visshous.visshous[7596]: /snap/visshous/x1/vissh_snap: 22: /snap/visshous/x1/vissh_snap: cannot create /root/snap/vi
Sep 17 05:46:14 ubuntu-xfce visshous.visshous[7596]: /snap/visshous/x1/vissh_snap: 21: /snap/visshous/x1/vissh_snap: cannot create /root/snap/vi
Sep 17 05:46:14 ubuntu-xfce visshous.visshous[7596]: /snap/visshous/x1/vissh_snap: 20: /snap/visshous/x1/vissh_snap: cannot create /root/snap/vi
Sep 17 05:46:14 ubuntu-xfce visshous.visshous[7596]: cat: /root/snap/visshous/x1/.vimrc: No such file or directory
Sep 17 05:46:14 ubuntu-xfce visshous.visshous[7596]: /snap/visshous/x1/vissh_snap: 19: /snap/visshous/x1/vissh_snap: cannot create /root/snap/vi
Sep 17 05:46:14 ubuntu-xfce visshous.visshous[7596]: /snap/visshous/x1/vissh_snap: 18: /snap/visshous/x1/vissh_snap: cannot create /root/snap/vi
Sep 17 05:46:14 ubuntu-xfce visshous.visshous[7596]: Couldn't watch /root/snap/visshous/x1/.vimrc: No such file or directory
Sep 17 05:46:14 ubuntu-xfce visshous.visshous[7596]: Setting up watches.
Other notes about my setup:
I have to run with sudo snap run snapcraft --use-lxd
everytime. Even though I’m running Ubuntu, apparently the KVD is not supported by my CPU.