Comments (10)
More sketching:
What if we instead moved the backup files into a designated backup directory that mirrors directory structure in the same way that stow packages do. E.g.
$ tree -a --charset ascii
.
|-- .git
|-- .gitignore
`-- my-configs
`-- etc
`-- ntp.conf
$ cat .gitignore
/defaults/
$ stow my-configs -vvt / --backupdir defaults
...
MKDIR: defaults # because it didn't exist already
MKDIR: defaults/etc # because it didn't exist already
COPY: /etc/ntp.conf => defaults/etc/ntp.conf # or this could be a rename...
REMOVE: /etc/ntp.conf # ...if file system boundaries are not crossed
LINK: etc/ntp.conf => /etc/ntp.conf
...
$ tree -a --charset ascii
.
|-- defaults
| `-- etc
| `-- ntp.conf
|-- .git
|-- .gitignore
`-- my-configs
`-- etc
`-- ntp.conf
If the user wanted to, they could also append a filename extension of their choice to all backup files. If they didn't give such an extension, nothing would be appended. E.g.:
$ stow my-configs -vvt / --backupext .orig
...
RENAME: /etc/ntp.conf => /etc/ntp.conf.orig
LINK: etc/ntp.conf => /etc/ntp.conf
...
It would also be possible to combine --backupdir
and --backupext
in a natural way:
$ stow my-configs -vvt / --backupdir defaults --backupext .orig
...
COPY: /etc/ntp.conf => defaults/etc/ntp.conf.orig
REMOVE: /etc/ntp.conf
LINK: etc/ntp.conf => /etc/ntp.conf
...
from stow.
Great work in outlining this, lassik! This feature would be reeeeally useful.
from stow.
👍
from stow.
Yes thanks, this is a good feature request. Please look at patch(1)
for ideas on how to define options which control the algorithm for choosing where to back up to.
from stow.
Thanks for the interest!
Good tip on patch(1)
. The above proposed --backupdir
and --backupext
seem equivalent to patch
's --prefix
and --suffix
, respectively. (Except that patch
's --prefix
need not be a directory if it doesn't end in a slash.)
patch
's naming scheme support seems very comprehensive with the --basename-prefix
and --version-control
options (numbered backup files, etc.) in addition to the above. Do you think anyone would find these useful in stow
's context? My personal intuition is that they would be over the top.
from stow.
Yeah, that seems like overkill.
from stow.
This would be a nice feature. Did it make it in?
from stow.
Nope, someone has to code it first ;-)
from stow.
Would be really cool if it would be possible to overwrite existing files.
from stow.
If someone badly needs this (like I do!) and can't wait for this to be merged into upstream, and is on Arch, you're welcome to my PKGBUILD in the meantime.
from stow.
Related Issues (20)
- How to know that `stow` skip pointing symlink to destination since it already exists?
- make it possible to stow to a "flattened" file hierarchy (containing symlinks) HOT 2
- What changes cwd to the target directory during init of Stow? HOT 4
- Stow needs a co-maintainer HOT 1
- New files in a directory managed by stow HOT 4
- Dotfiles doesn't work with adopt
- --dotfiles missing from usage()
- [[email protected]] An error is reported during the execution of self-test cases. HOT 3
- `stow --simulate` should show `--adopt` actions HOT 2
- `stow --simulate` should warn when `-v` is not specified HOT 6
- Can GNU Stow use a stow target directory that is a symbolic link? HOT 2
- Investigate ditching Stow's pre-processing phase of installation HOT 1
- ~/.stow-global-ignore doesn't work HOT 15
- .stow-local-ignore: stow does not ignore file when parent directory does not exist
- Why was the no-folding-per-pkg branch abandoned?
- Failed to install because ls HOT 1
- make install fails | installation in docker container HOT 2
- Request build flag to turn off docs creation HOT 2
- Docs build error HOT 1
- --override not working HOT 1
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 stow.