File: installation.md

package info (click to toggle)
dotdrop 1.15.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,812 kB
  • sloc: sh: 13,401; python: 8,186; makefile: 3
file content (286 lines) | stat: -rw-r--r-- 7,550 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# Installation

* [As a submodule](#as-a-submodule)
* [As a submodule in a virtualenv](#as-a-submodule-in-a-virtualenv)
* [Submodule upgrade/downgrade](#submodule-upgradedowngrade)
* [PyPI package](#pypi-package)
- [pipx install](#pipx-install)
* [Homebrew package](#homebrew-package)
* [Debian unstable (sid)](#debian)
* [Ubuntu](#ubuntu)
* [AUR packages](#aur-packages)
* [Snap package](#snap-package)
* [From source](#from-source)
* [Pacstall package](https://github.com/pacstall/pacstall-programs/blob/master/packages/dotdrop/dotdrop.pacscript)

## As a submodule

Having dotdrop as a submodule guarantees that anywhere
you are cloning your dotfiles Git tree from you will have dotdrop shipped with it.
Note that when using dotdrop as a submodule you will be tracking the master branch (and not a specific version)

The following will create a Git repository for your dotfiles and
keep dotdrop as a submodule.
```bash
## create the repository
$ mkdir dotfiles; cd dotfiles
$ git init

## install dotdrop as a submodule
$ git submodule add https://github.com/deadc0de6/dotdrop.git
$ pip3 install --user -r dotdrop/requirements.txt
$ ./dotdrop/bootstrap.sh

## use dotdrop
$ ./dotdrop.sh --help
```

For macOS users, make sure to install `realpath` through Homebrew
(part of *coreutils*) and `libmagic`.

Using dotdrop as a submodule will require you to work with dotdrop by
using the generated script `dotdrop.sh` at the root
of your dotfiles repository. Note that this script updates the submodule
automatically unless called with the environment variable `DOTDROP_AUTOUPDATE`
set to `no`.

If you happened to encounter `ModuleNotFoundError` error after an
update, it means the dependencies have changed and you should re-install
dependencies with
```bash
pip3 install --user -r dotdrop/requirements.txt
```

To ease the use of dotdrop, it is recommended to add an alias to it in your
shell with the config file path; for example:
```
alias dotdrop=<absolute-path-to-dotdrop.sh> --cfg=<path-to-your-config.yaml>'
```

## As a submodule in a virtualenv

To install it in a [virtualenv](https://virtualenv.pypa.io):
```bash
## create the repository
$ mkdir dotfiles; cd dotfiles
$ git init

## install dotdrop as a submodule
$ git submodule add https://github.com/deadc0de6/dotdrop.git
$ virtualenv -p python3 env
$ echo 'env' >> .gitignore
$ env/bin/pip install -r dotdrop/requirements.txt
$ ./dotdrop/bootstrap.sh

# add the following in your .bashrc/.zshrc/etc
# or hardcode it in the dotdrop.sh script
$ export DOTDROP_VIRTUALENV=env

## use dotdrop
$ ./dotdrop.sh --help
```

When using a virtualenv, make sure to export the `DOTDROP_VIRTUALENV`
variable with the directory name of your virtualenv:
```bash
$ export DOTDROP_VIRTUALENV=env
$ ./dotdrop.sh --help
```

Then follow the instructions under [As a submodule](#as-a-submodule).

## Submodule upgrade/downgrade

### Upgrade dotdrop submodule

If using dotdrop as a submodule, one can control if dotdrop
is auto-updated through the [dotdrop.sh](https://github.com/deadc0de6/dotdrop/blob/master/dotdrop.sh)
script by defining the environment variable `DOTDROP_AUTOUPDATE=yes`.
If undefined, `DOTDROP_AUTOUPDATE` will take the value `yes`.

If used as a submodule, update it with:
```bash
$ git submodule update --init --recursive
$ git submodule update --remote dotdrop

## install dependencies
$ pip3 install --user -r dotdrop/requirements.txt
```

You will then need to commit the changes with:
```bash
$ git add dotdrop
$ git commit -m 'update dotdrop'
$ git push
```

### Downgrade dotdrop submodule

If you wish to get a specific version of dotdrop when using
it as a submodule, the following operations can be done.

Here dotdrop is downgraded to the latest stable version:
```bash
## enter the repository containing the dotdrop submodule
$ cd my-dotfiles
## enter the dotdrop submodule
$ cd dotdrop
## update the list of tags
$ git fetch --tags
## checkout the latest stable version
$ git checkout `git tag -l | tail -1`
```

If using the `dotdrop.sh` script, make sure it doesn't
automatically update dotdrop back to the latest commit.

## PyPI package

[PyPI package](https://pypi.org/project/dotdrop/)

Install dotdrop:
```bash
$ pip3 install dotdrop --user
```

### PyPI package in a virtualenv

Install dotdrop from PyPI in a virtualenv:
```bash
$ virtualenv -p python3 env
$ source env/bin/activate
$ pip install dotdrop
```

When using a virtualenv, make sure to source the environment
before using dotdrop:
```bash
$ source env/bin/activate
$ dotdrop --help
```

Then follow the instructions under [PyPI package](#pypi-package).

## pipx install

[pipx](https://pipx.pypa.io/) allows to install a package in an isolated
environment.

It is packaged in all main Linux distributions, and macOS.

### PyPI package with pipx

To install the last PyPI package:
```bash
$ pipx install dotdrop
```

To upgrade an installed package to the last version.
```bash
$ pipx upgrade dotdrop
```

### From GitHub with pipx

To install the from the master branch on GitHub

```bash
$ pipx install git+https://github.com/deadc0de6/dotdrop.git
```

You can choose a branch or commit
```bash
$ pipx install git+https://github.com/deadc0de6/dotdrop.git@2c462c3
```

## Homebrew package

[Homebrew package](https://formulae.brew.sh/formula/dotdrop)

Install dotdrop from Homebrew with:
```bash
$ brew install dotdrop
```

## Debian

dotdrop is a
[Debian package](https://packages.debian.org/dotdrop) since bookworm (Debian 12), be
warned that the Debian version is usually behind the last stable release.

Install dotdrop
```bash
$ sudo apt install dotdrop
```

## Ubuntu

[Ubuntu package](https://packages.ubuntu.com/search?keywords=dotdrop)

Install dotdrop
```bash
$ sudo apt install dotdrop
```

## Aur packages

Dotdrop is available on aur:

* Stable: <https://aur.archlinux.org/packages/dotdrop/>
* Git version: <https://aur.archlinux.org/packages/dotdrop-git/>

## Snap package

Dotdrop is available as a snap package: <https://snapcraft.io/dotdrop>.

Install it with:
```bash
$ snap install dotdrop
```

If you encounter warnings like `Warning: using regular magic file`,
try defining the following environment variable:
```bash
export MAGIC=$SNAP/usr/share/file/magic.mgc
```

## From source

Clone the repository:
```bash
$ git clone https://github.com/deadc0de6/dotdrop.git
```

Start using it directly through the `dotdrop.sh` script and
use the `--cfg` switch to make it point to your config file.

```bash
$ cd dotdrop/
$ ./dotdrop.sh --cfg <my-config-file> files
```

## Dependencies

Beside the Python dependencies defined in [requirements.txt](https://github.com/deadc0de6/dotdrop/blob/master/requirements.txt),
dotdrop depends on the following tools:

* `diff` (unless a different tool is used, see [diff_command](config/config-config.md#config-block))
* `git` (only if using the entry point script [dotdrop.sh](https://github.com/deadc0de6/dotdrop/blob/master/dotdrop.sh))

For macOS users, make sure to install the below packages through [Homebrew](https://brew.sh/):

* [libmagic](https://formulae.brew.sh/formula/libmagic) (for python-magic)

For WSL (Windows Subsystem for Linux), make sure to install `python-magic-bin`:
```bash
pip install python-magic-bin
```

## Shell completion

Completion scripts exist for `bash`, `zsh` and `fish`;
see [the related doc](https://github.com/deadc0de6/dotdrop/blob/master/completion/README.md).

## Highlighters

Highlighters for dotdrop templates are available [here](https://github.com/deadc0de6/dotdrop/tree/master/highlighters).