Skip to content

Commit 2954eb3

Browse files
lraCopilot
andauthored
Implement Copy Mode and Refactor Backup/Restore Operations (#2085)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 3f8be8c commit 2954eb3

12 files changed

Lines changed: 632 additions & 173 deletions

File tree

.github/workflows/install.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
- "3.11"
2222
- "3.12"
2323
- "3.13"
24+
- "3.14"
2425
runs-on: ${{ matrix.os }}
2526
container: python:${{ matrix.python-version }}
2627
steps:
@@ -34,6 +35,7 @@ jobs:
3435
os:
3536
- macos-14
3637
- macos-15
38+
- macos-15-intel
3739
runs-on: ${{ matrix.os }}
3840
steps:
3941
- uses: actions/checkout@v4

.github/workflows/test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
- "3.11"
1818
- "3.12"
1919
- "3.13"
20+
- "3.14"
2021
steps:
2122
- uses: actions/checkout@v4
2223
- uses: astral-sh/setup-uv@v5

INSTALL.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Detailed install instructions for Mackup
22

3-
There are 2 ways to run mackup
3+
There are 2 ways to run mackup:
44

55
1. Install it with Homebrew (OSX only)
66
2. Install it with PIP (OSX and GNU/Linux)
@@ -19,14 +19,15 @@ mackup -h
1919

2020
### With Homebrew (OSX only) master branch for latest updates
2121

22-
Want to install latest master releases instead of waiting on homebrew package version?
22+
Want to install the latest master release instead of waiting on the homebrew
23+
package version?
2324

2425
[Homebrew reference](https://docs.brew.sh/Manpage#install-options-formulacask)
2526

2627
```bash
2728
# Install master
2829
brew install --HEAD
29-
# Check if are using the master or stale package
30+
# Check if you are using the master or stale package
3031
brew switch mackup <HEAD-XXXX>
3132

3233
mackup -h

README.md

Lines changed: 55 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
# Mackup™
22

3-
Keep your application settings in sync.
3+
Backup and keep your application settings in sync.
44

55
## Table of contents
66

77
- [Mackup](#mackup)
88
- [Table of contents](#table-of-contents)
9-
- [WARNING](#warning)
109
- [Quickstart](#quickstart)
1110
- [Usage](#usage)
1211
- [What does it do](#what-does-it-do)
13-
- [Bullsh\*t, what does it really do to my files](#bullsht-what-does-it-really-do-to-my-files)
14-
- [Backup](#backup)
15-
- [Restore](#restore)
16-
- [Uninstall](#uninstall)
12+
- [Copy mode](#copy-mode)
13+
- [Link mode](#link-mode)
1714
- [Supported Storages](#supported-storages)
1815
- [Unsupported Storages](#unsupported-storages)
1916
- [Supported Applications](#supported-applications)
@@ -24,19 +21,8 @@ Keep your application settings in sync.
2421
- [What's up with the weird name](#whats-up-with-the-weird-name)
2522
- [Where can I find more information](#where-can-i-find-more-information)
2623

27-
## WARNING
28-
29-
⚠️ Mackup does not work correctly in macOS Sonoma and all later versions,
30-
since it does not support symlinked files for preferences. Running this code
31-
will destroy all user preferences without a means for recovery. For more
32-
information, see issues [#1924](https://github.com/lra/mackup/issues/1924)
33-
and [2035](https://github.com/lra/mackup/issues/2035).
34-
3524
## Quickstart
3625

37-
If you have [Dropbox](https://www.dropbox.com) installed and want to use it to
38-
save your config files, that's super easy.
39-
4026
On macOS, if you want an easy install, you can install
4127
[Homebrew](http://brew.sh/) and do:
4228

@@ -50,10 +36,6 @@ mackup backup
5036

5137
If not running macOS, or you don't like Homebrew, you can use [pip](https://pip.pypa.io/en/stable/).
5238

53-
> Note: The below command will check if a previous version of Mackup
54-
> is already installed on your system.
55-
> If this is the case, it will be upgraded to the latest version.
56-
5739
```bash
5840
# Install Mackup with PIP
5941
pip install --upgrade mackup
@@ -62,13 +44,7 @@ pip install --upgrade mackup
6244
mackup backup
6345
```
6446

65-
> On **Ubuntu**, pip will install to the current user's home
66-
> directory rather than system-wide. Because of this, when
67-
> installing pip on **Ubuntu** you will need to run `pip install`
68-
> with the `--system` flag as well (on other platforms this is not
69-
> needed)
70-
71-
You're all set and constantly backed up from now on.
47+
You're all set and can back up from now on.
7248

7349
Next, on any new workstation, do:
7450

@@ -88,15 +64,26 @@ You can find more detailed instructions in [INSTALL.md](INSTALL.md).
8864

8965
`mackup backup`
9066

91-
Backup your application settings.
67+
Back up your application files. Copy your local config files into the Mackup folder.
9268

9369
`mackup restore`
9470

9571
Restore your application settings on a newly installed workstation.
72+
Copy config files from the Mackup folder to your home folder.
73+
74+
`mackup link install`
9675

97-
`mackup uninstall`
76+
Move your local config files into the Mackup folder,
77+
and link them to their original place.
78+
79+
`mackup link`
80+
81+
On another workstation, links local config files from the Mackup folder.
82+
83+
`mackup link uninstall`
9884

9985
Copy back any synced config file to its original place.
86+
Removes the links and copies config files from the Mackup folder back into your home.
10087

10188
`mackup list`
10289

@@ -108,49 +95,73 @@ Get some help, obviously...
10895

10996
## What does it do
11097

111-
- Back ups your application settings in a safe directory (e.g. Dropbox)
112-
- Syncs your application settings among all your workstations
113-
- Restores your configuration on any fresh install in one command line
114-
11598
By only tracking pure configuration files, it keeps the crap out of your
11699
freshly new installed workstation (no cache, temporary and locally specific
117-
files are transfered).
100+
files are transferred).
118101

119-
Mackup makes setting up the environment easy and simple, saving time for your
120-
family, great ideas, and all the cool stuff you like.
102+
Mackup makes setting up the environment easy and simple.
121103

122-
## Bullsh\*t, what does it really do to my files
104+
There are 2 modes of operations: copy mode and link mode.
105+
106+
### Copy mode
107+
108+
Copy mode is used to back up and restore your files.
109+
The files are backed up into the configured Mackup folder,
110+
which can be in Dropbox, iCloud, or wherever you configure it.
111+
112+
It is covered by the 2 commands:
113+
114+
- `mackup backup`
115+
- `mackup restore`
116+
117+
### Link mode
118+
119+
Link mode is used to move your config files into the Mackup folder,
120+
and link them back to their original place.
121+
122+
This mode is useful if you are using multiple workstations,
123+
and want to keep your application settings in sync at all times.
124+
125+
- Backs up your application settings in a safe directory (e.g. Dropbox)
126+
- Syncs your application settings among all your workstations
127+
- Restores your configuration on any fresh install in one command line
123128

124129
Let's take `git` as an example. Your settings for `git` are saved in your home
125130
folder, in the `.gitconfig` file.
126131

127-
### Backup
132+
It is covered by the 3 commands:
133+
134+
- `mackup link install`
135+
- `mackup link`
136+
- `mackup link uninstall`
137+
138+
#### `mackup link install`
128139

129-
If you have Dropbox, these things happen when you launch `mackup backup`:
140+
If you have Dropbox, these things happen when you launch `mackup link install`:
130141

131142
1. `cp ~/.gitconfig ~/Dropbox/Mackup/.gitconfig`
132143
2. `rm ~/.gitconfig`
133144
3. `ln -s ~/Dropbox/Mackup/.gitconfig ~/.gitconfig`
134145

135146
Now your `git` config is always backed up and up to date on all your workstations.
136147

137-
### Restore
148+
#### `mackup link`
138149

139-
When you launch `mackup restore`, here's what it's really doing:
150+
When you launch `mackup link`, here's what it's really doing:
140151

141152
1. `ln -s ~/Dropbox/Mackup/.gitconfig ~/.gitconfig`
142153

143154
That's it, you got your `git` config setup on your new workstation.
144155

145156
`mackup` does the same for any supported application.
146157

147-
### Uninstall
158+
#### `mackup link uninstall`
148159

149160
You can revert all your files to their original state.
150161

151162
```bash
152163
# Just run this
153-
mackup uninstall
164+
mackup link uninstall
154165
```
155166

156167
This will remove the symlinks and copy back the files from the Mackup folder in

doc/README.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,20 @@ engine = google_drive
3939

4040
### iCloud
4141

42-
If you choose the `iCloud` storage engine, Mackup will store store your
42+
If you choose the `iCloud` storage engine, Mackup will store your
4343
configuration files in the `~/Library/Mobile\ Documents/com\~apple\~CloudDocs/` folder.
4444

4545
```ini
4646
[storage]
4747
engine = icloud
4848
```
4949

50+
You can check if your files are synced using:
51+
52+
```sh
53+
brctl monitor com.apple.CloudDocs
54+
```
55+
5056
### File System
5157

5258
If you want to specify another directory, you can use the `file_system` engine
@@ -64,7 +70,7 @@ path = some/folder/in/your/home
6470
```
6571

6672
Note: you don't need to escape spaces or wrap the path in quotes.
67-
For example, the following paths are valid :
73+
For example, the following paths are valid:
6874

6975
```ini
7076
path = some/path in your/home
@@ -73,7 +79,7 @@ path = /some path/in/your/root
7379

7480
### Custom Directory Name
7581

76-
You can customize the directory name in which Mackup stores your file. By
82+
You can customize the directory name in which Mackup stores your files. By
7783
default, if not specified, Mackup creates a `Mackup` directory in the storage
7884
engine you chose, e.g. `~/Dropbox/Mackup`.
7985

@@ -116,7 +122,7 @@ already setup (ex: from `dropbox` to `icloud`), complete the following steps.
116122
### Only sync one or two applications
117123

118124
In your home folder, create a file named `.mackup.cfg` and add the application
119-
names to allow in the `[applications_to_sync]` section, one by line.
125+
names to allow in the `[applications_to_sync]` section, one per line.
120126

121127
```ini
122128
# Example, to only sync SSH and Adium:
@@ -129,7 +135,7 @@ Use `mackup list` to get a list of valid application names. Don't use fancy
129135
names (with spaces) here.
130136

131137
A [sample](.mackup.cfg) of this file is available in this folder. Just copy it
132-
in your home folder:
138+
to your home folder:
133139

134140
```bash
135141
cp mackup/doc/.mackup.cfg ~/
@@ -138,7 +144,7 @@ cp mackup/doc/.mackup.cfg ~/
138144
### Don't sync an application
139145

140146
In your home folder, create a file named `.mackup.cfg` and add the application
141-
names to ignore in the `[applications_to_ignore]` section, one by line.
147+
names to ignore in the `[applications_to_ignore]` section, one per line.
142148

143149
```ini
144150
# Example, to not sync SSH and Adium:
@@ -151,7 +157,7 @@ Use `mackup list` to get a list of valid application names. Don't use fancy
151157
names (with spaces) here.
152158

153159
A [sample](.mackup.cfg) of this file is available in this folder. Just copy it
154-
in your home folder:
160+
to your home folder:
155161

156162
```bash
157163
cp mackup/doc/.mackup.cfg ~/
@@ -172,7 +178,7 @@ to get your Pull Request merged faster.
172178
You can customize the Mackup engine and add support for unsupported
173179
applications or just custom files and directories you'd like to sync.
174180

175-
NOTE: Files and directory to be synced should be rooted at $HOME.
181+
NOTE: Files and directories to be synced should be rooted at $HOME.
176182

177183
Let's say that you'd like to add support for Nethack (config file:
178184
`.nethackrc`) and for the `bin` and `.hidden` directories you keep in your
@@ -187,7 +193,7 @@ touch ~/.mackup/nethack.cfg
187193
touch ~/.mackup/my-files.cfg
188194
```
189195

190-
Edit those files
196+
Edit those files:
191197

192198
```bash
193199
$ nano ~/.mackup/nethack.cfg
@@ -228,7 +234,7 @@ mackup backup
228234
If you override an application config that is already supported by Mackup, your
229235
new config for this application will replace the one provided by Mackup.
230236

231-
You can find some sample config in this directory.
237+
You can find some sample configs in this directory.
232238

233239
### Locally test an application before submitting a Pull Request
234240

@@ -246,14 +252,14 @@ You can add and test an application by following these steps:
246252

247253
### Add support for an application using the XDG directory
248254

249-
For application storing their configuration under the `~/.config` folder, you
255+
For applications storing their configuration under the `~/.config` folder, you
250256
should not hardcode it. The `.config` folder is the default location but it can
251257
be named differently on other users' systems by setting the `XDG_CONFIG_HOME`
252258
environment variable.
253259

254260
See <https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html>
255261

256-
Mackup supports this mechanism and provide a dedicated `xdg_configuration_files`
262+
Mackup supports this mechanism and provides a dedicated `xdg_configuration_files`
257263
section for those applications.
258264

259265
If any path starts with `.config`, remove the `.config` part and move the path

0 commit comments

Comments
 (0)