summaryrefslogtreecommitdiff
path: root/man/7/caretaker-setup.pod
blob: 75554cd576aca2960771d301095af92034cf73e0 (plain)
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
=head1 NAME

caretaker - Package root setup

=head1 PACKAGE ROOT

First, you'll need to create a root directory (from now on PKG_ROOT) on the
server which shall from now on host all your packages.
Then you need to put the caretaker git repository into F<PKG_ROOT/caretaker> - it's recommended
to do this via git clone --bare.

Copy the pkglist script (examples/pkglist) to F<PKG_ROOT/pkglist>.

Now you can add your own packages as git repos in PKG_ROOT.

To use caretaker with your packages on a machine, download and execute
the bootstrap script (examples/bootstrap).
On the package root, you can get it from the bare caretaker repository with
C<< git cat-file blob master:examples/pkglist >>

=head1 CREATING A PACKAGE

Example: a vim package

First of all, you'll need to create the package's git repository.  Ideally you do not do
this in the package root itself, since it's recommended to have bare git repos there.

  client ~ > cd /tmp
  client /tmp > mkdir vim; cd vim
  client /tmp/vim > git init
  Initialized empty Git repository in /tmp/vim/.git/
  client /tmp/vim > mkdir etc
  client /tmp/vim > cp $your_fancy_vimrc etc/vimrc
  client /tmp/vim > git add .
  client /tmp/vim > git commit -m 'initial commit. Now with extra cake'
  [master (root-commit) 4359548] initial commit. Now with extra cake
   2 files changed, 51 insertions(+), 0 deletions(-)
   create mode 100644 etc/vimrc
   create mode 100644 links

You now have a working vim package, it just is not accessible to caretaker yet.
So let's fix that.

  server $PKG_ROOT > GIT_DIR=vim git --bare init

  client /tmp/vim > git push server:$PKG_ROOT/vim master

Now you can install the vim package the normal way

  client ~ > ct update
  Updating local package list
  Updating remote package list
  client ~ > ct add vim
  Retrieving package vim...
  [...]
  created   .vimrc          -> packages/vim/etc/vimrc

And that's it. You can safely rm -rf /tmp/vim now.

=head2 THE LINKS FILE

Note that the '$etc' used in this example is a B<relative> symlink.
So if you want to symlink something which is in a subdirectory of your home,
you will have to set the target to C<< ../$etc/something >> (or similar).

Example:

  soft .ssh/config ../$etc/config

=head1 ADDING A CLIENT

Now that you have a package root and some packages, you might start to wonder
how to actually start using them on some machine.

In theory, this is quite trivial. caretaker ships a B<bootstrap> script in
F<examples/bootstrap> (again, you can get it from the bare repo with
C<< git cat-file blob master:examples/bootstrap >>). Execute the script to see
its help message, then execute it again with the proper arguments on the
machine on which you want to use caretaker and watch its output.

With the terminology from the previous sections, in most cases you'll need
C<< ./bootstrap ssh://server/$PKG_ROOT >>.
If you deploy caretaker on the server containing the package root,
C<< ./bootstrap /$PKG_ROOT >> will suffice.

=head1 SEE ALSO

checklinks(1), ct(1), caretaker(7)