Comments (5)
For anyone else with similar goals, but unwilling to run facebook's 50k loc monstrosity for it:
i imagine most linux distributions have inotify-tools available, offering inotifywait as a much simpler way of doing this.
i wrote a short shell script to do what i need:
#!/bin/bash
WATCHED_DIR="$HOME/.local/share/remmina"
while inotifywait -e create -e modify "$WATCHED_DIR"; do
chezmoi add "$WATCHED_DIR"
done
echo "inotifywait encountered an error, exiting the script"
exit 1
note: this currently also automatically adds it on editing the connections. i'll use it for now, but if there's too many commits happening due to autocommit i'll likely remove the -e modify and sync it manually again. in my case the connections don't change too often though. i just need to have all of them in there.
from chezmoi.
You can use Watchman for this. There's an example that's the opposite to what you want in chezmoi's documentation, but you should be able to adapt this to run chezmoi add --force
whenever your Remmina config directory changes.
from chezmoi.
thanks. not sure if i want to run a massive facebook service on all my machines, but i'll check it out.
from chezmoi.
Thank you, that's a much better solution than using Watchman, and documenting it here will help lots of people in the future.
from chezmoi.
glad you like it.
of course it does have some limitations, mainly not being cross platform, so documenting watchman might still make sense. although syncing home directories is a very linux thing to do imo, i still get that people might want their configs on other systems.
also, a way to reliably run that script is needed. a simple way is to add it to something like .bash_profile, but i'm never exactly sure when and how often that file gets ran, so i made a systemd user unit:
~/.config/systemd/user/watch-remmina.sh
[Unit]
Description=Watch directory for file changes, add to chezmoi on change
[Service]
Type=simple
# Use %h for the home directory path in systemd service files, here the script is in ~/scripts/
ExecStart=/bin/bash %h/scripts/watch-remmina.sh
[Install]
WantedBy=default.target
and a chezmoi run once file to enable it: run_once_after_enable-watch-remmina.sh (in the chezmoi dir)
#!/bin/bash
systemctl --user daemon-reload
systemctl --user enable watch-remmina.service
systemctl --user start watch-remmina.service
from chezmoi.
Related Issues (20)
- Make accidental removal harder
- forced update says "Already up to date." HOT 1
- Ability to dry-run / diff scripts HOT 5
- Local repository. HOT 7
- Documentation update "Why do I get a blank buffer or empty file when running chezmoi edit" HOT 2
- Import/merge separate source directories? HOT 2
- Set command line options via environment variables HOT 1
- Precedence of .chezmoiremove vs. exact_ attributes? HOT 2
- SOPS Support HOT 7
- Config variables `autoAdd = true` and `autoCommit = true` don't seem to add or commit changes HOT 2
- bitwarden and bitwardenFields template functions seems not working HOT 2
- Optional speed up to chezmoi doctor
- Chezmoi cd exits git bash in windows terminal HOT 2
- promptString is not yielding the expected result HOT 7
- Raspberry Pi Illegal Operation HOT 4
- Flag --managed to `add` all managed files HOT 4
- Release appears to be corrupt HOT 2
- Adding .local/bin hangs HOT 3
- `chezmoi edit <target file>` hardlink functionality breaks across btrfs subvolumes HOT 1
- tests hang when umask is 027
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chezmoi.