-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
291 lines (181 loc) · 8.06 KB
/
README
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
287
288
289
290
NAME
dotf - dotfiles manager
VERSION
Version 0.001
SYNOPSIS
dotf [-h <homedir>] help
dotf [-h <homedir>] init <url>
dotf [-h <homedir>] status
dotf [-h <homedir>] update
dotf [-h <homedir>] version
DESCRIPTION
The dotfiles manager dotf helps you synchronize your precious dotfiles
between multiple Unix systems.
Your dotfiles will be maintained in one or multiple git repositories.
These files are then linked with symlinks to your home directory.
If someone or something removes the symlink and replaces it with a copy
of the file, the next run of dotf update will move the file back into
the repository and recreate the symlink.
OPTIONS
-h homedir
Specifies the directory that should be used as your home directory.
This is the directory in which the dotfiles will be managed.
If not specified, dotf defaults to your home directory as returned by
File::HomeDir.
SUBCOMMANDS
dotf help
Prints the help page.
dotf init
The init subcommand is used to initialize dotf on a new account. It
takes a URL as argument which can be cloned with Git. This repository
url will be cloned to ~/.files/.config and the master branch will be
checked out.
dotf expects a file called modules.ini in the root of this repository.
dotf status
The status subcommand can be used to show the changes in all Git
repositories used by dotf. Use this command to see if there are some
uncommitted changes.
dotf update
The update subcommand is used to first update the .config repository.
Then, the ~/.files/.config/modules.ini file is used to find all
required Git repositories. These repositories will either be cloned or
updated, as needed.
Repositories with uncommitted changes are skipped.
The update uses a --ff-only update.
dotf version
Prints the version of dotf and exists.
EXIT STATUS
The dotf utility exits 0 on success, 1 if an error occurs, and 2 if
invalid command line options were specified.
EXAMPLES
Example 1 Initializing dotf on a new system or account
$ dotf init https://github.com/YOUR_ID/dotfiles-config-smartos.git
This clones the mentioned repositories to ~/.files/.config/, parses the
modules.ini file in this repository and then clones all the
repositories configured there.
You will probably use different config repositories for different
operating systems or e.g. for home and work systems.
Example 2 Update your dotfiles
$ dotf update
Example 3 Show uncommitted changes in your dotfiles
$ dotf status
dotf replaces the managed dotfiles in your home directory with
symlinks. The dotfiles are moved into the Git repositories under the
~/.file/ directory. The status subcommand can be used to get a git
status -s of all your repositories.
Example 4 Commit changed files
The dotfiles are managed with Git. dotf does not interfere with this
operation.
$ cd ~/.files/vim
$ git commit .vimrc
$ git push
It is important to push your changes after committing them to be able
to use them on your other system/accounts.
Example 5 Add a new file to be managed by dotf
This example shows how to start managing ~/.vimrc with dotf. You either
need a new repository are use an existing one. To create a new one
please see modules.ini.
$ cd ~/.files/vim/
$ mv ~/.vimrc ./
$ git add .vimrc
$ git commit -m 'initial commit of .vimrc' .vimrc
$ git push
The file is now in the vim Git repository. The last step is to create
the ~/.vimrc symlink which will point to ~/.files/vim/.vimrc. This is
done with:
$ dotf update
Example 6 Manage your own home directory for a shared account
This example shows you how to bootstrap and manage your own home
directory and use your preferred shell for a shared account with dotf
and sshss.
Create your own home directory
We create a directory called .ryah under the home directory of the
shared account. We will configure this as our own home directory and
manage it with dotf.
$ cd ~
$ mkdir .ryah
$ cd .ryah
$ export HOME=$PWD
Install cpanm and local::lib
This will install them to the perl5 directory of your own home
directory defined above.
$ unset PERL5LIB
$ unset PERL_MB_OPT
$ unset PERL_LOCAL_LIB_ROOT
$ unset PERL_MM_OPT
$ curl -L https://cpanmin.us | perl - App::cpanminus -l $HOME/perl5 local::lib
Prepare environment to install dotf
The following command must also be added to your profile.
$ eval "$(perl -I $HOME/perl5/lib/perl5 -Mlocal::lib)"
Install dotf
$ cpanm https://github.com/skirmess/App-Dotfiles.git
Initialize dotf
The -h option is not needed because $HOME was changed above.
$ dotf init https://github.com/YOUR_ID/dotfiles-config-smartos.git
Add sshss to modules.ini
The ~ points to the personal home because $HOME was changed above.
$ vi ~/.files/.config/modules.ini
Add sshss as module.
[sshss]
pull = https://github.com/skirmess/App-SSH-SwitchShell.git
source path prefix = bin
target path prefix = .ssh
Update dotfiles
Create the .ssh directory. We want dotf to only link the sshss script
to the .ssh directory and not the whole directory.
$ mkdir ~/.ssh
$ dotf update
Add entry to .ssh/authorized_keys in the shared accounts home directory
This must be added to the authorized_keys file of the shared account
because sshss only changes your home directory and shell after the
session is authenticated.
$ vi ~/../.ssh/authorized_keys
Add in front of your key:
command=".ryah/.ssh/sshss /usr/bin/ksh93"
Verify that you can login before closing your session
Otherwise remove the command string again. Do not lock yourself out!
ENVIRONMENT
HOME
On UNIX used by File::HomeDir as primary method to identify your home
directory.
The home directory is where dotf places the .files directory which
contains all the managed dotfiles.
RATIONALE
Why another dotfiles manager?
Implemented in Perl, Ksh or Bash
I don't want to compile or install an obscure compiler or virtual
machine on every system I'd like to use my dotfiles manager. Perl is
most likely available on everything I'm interested in.
Support for multiple configuration repositories
I'd like to have my Vim configuration readily available on github,
but the .profile file from my workplace should only be available on
the Git server at my workplace.
The configuration which dotfiles are installed on which system should
also be under version control
And changes to this configuration should automatically show up with
an update. That's why we have the .config repository with the
modules.ini file.
I don't want the dotfiles manager to completely shield me from Git
Git has a very powerful command line interface and you can find a
huge amount of documentation on the Web. I don't want a dotfiles
manager try to handle Git operations like merging, conflict
resolution, etc. If there is a conflict to be resolved or a new file
to be committed it should be done with Git directly. The dotfiles
manager should only be a collection of convenient functions to make
it easy to update changes on multiple system.
I was unable to find an existing dotfile manager that fulfilled these
four requirements.
SEE ALSO
modules.ini
SUPPORT
Bugs / Feature Requests
Please report any bugs or feature requests through the issue tracker at
https://github.com/skirmess/App-Dotfiles/issues. You will be notified
automatically of any progress on your issue.
Source Code
This is open source software. The code repository is available for
public review and contribution under the terms of the license.
https://github.com/skirmess/App-Dotfiles
git clone https://github.com/skirmess/App-Dotfiles.git
AUTHOR
Sven Kirmess <[email protected]>