-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME
146 lines (111 loc) · 5.02 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
sxxu - siteXX utility
=====================
## a tool to help build OpenBSD siteXX files ##
This was inspired by siteXYtools from mongers.org, but it seemed like it
needed a few additional features to make it easier to do more common tasks.
For more information on siteXX files see:
http://www.openbsd.org/faq/faq4.html#site
The goals of sxxu are to help you:
* Keep configuration for your systems in a source control
* Recover from a disaster more quickly
* Do a matching install on a secondary system so you can
* Upgrade between versions of OpenBSD with the ability to revert
* Replace aging hardware
* Build a test environment before pushing changes to a production system
sxxu is meant to be a simple utility for installing systems. It does not have
the ability to continue to push changes out to already installed systems. For
that functionality there are many more powerful solutions. I do wonder if it
would be possible to patch sysmerge to support some way of migrating these
files.
Some of the problems sxxu tries to solve:
* duplication of common configuration for each system
* permissions easily get broken when configuration is in source control
### USAGE ###
sxxu [-kmR] [-w WRKDIR] [machine1 [machine2 [...]]]
-k : Keep WRKDIR
-m : rebuild mtree files
-R : don't Recurse into Roles
-w : specify the WRKDIR
### DETAILS ###
In the basedir, each directory is considered a "role", the common directory is
merged into each role by default and any directory named role-* does not
generate a tgz by default.
Any of the directory structure not in the siteXX directory is treated as a
normal siteXX that will extract to the root of your system after the install.
Special files are kept in the siteXX directories. These special files are
processed by the install.sxxu after install.
If a role/install.site exists, this **WILL** overwrite the `install.sxxu` that
would have processed these special files.
Create a directory structure for your system:
basedir/
|-common/
|---siteXX
|------roles
|------mtree
|------siteXXrc
|------pkg_add_list
|------install_list
|------patches/
|------packages/
|------install.site
|-machine1/
|---siteXX/
|-machine2/
|---etc/
|------my_app.conf
|---siteXX/
|-role-imap/
|---siteXX/
|---var/
|-----sendmail/
Special files and directories inside the siteXX directory:
* roles
* Contains a list of "roles" (directories in the basedir) to merge into
this configuration. The common directory is automatically included in
all configurations.
* mtree
* An [mtree(8)](http://www.openbsd.org/cgi-bin/man.cgi?query=mtree&sektion=8)
spec file for permissions on the files in this role. It gets
applied before the files are put into the archive. See below
for notes on how to create and update.
* siteXXrc
* A ksh script that is included before running the `*_list` commands and
the individual `install.site` files for each role.
* pkg_path
* A list (one per line) of sites to add to the `PKG_PATH` environment.
Can also be colon separated the same as a normal `PKG_PATH`.
* *_list
* A list of arguments to commands to be run. For example if `pkg_add_list`
containing "rsync nrpe check_hw_sensors" will attempt to run
`pkg_add rsync nrpe check_hw_sensors`.
The command is executed for each line of the file.
You can set environment variables in the siteXXrc file for arguments.
Setting "`pkg_add_args='-i'`" in a siteXXrc would make the above command
`pkg_add -i rsync nrpe check_hw_sensors`
* patches/
* All patches in this dir need to be relative to the root of the system
where the tgz was extracted.
* packages/
* Package files that will get installed. Completely separate from
pkg_add_list above. It does inherit `pkg_path` and `pkg_add_args`.
* install.site
* Your script that gets run after all the above things have been done.
/etc/hostname.if files
If you create /etc/hostname files with generic interfaces, then set
${interface}_if in siteXXrc to the name of the interface, sxxu will
rename the hostname file to the interface you specified.
If you create `/etc/hostname.egress` and in siteXX/siteXXrc set
`egress_if=em0` then after other processing, the `/etc/hostname.egress` file
will be renamed to `/etc/hostname.em0`
### MTREE ###
You can use `sxxu -m` to generate mtree spec files. This will generate the
spec files with the permissions the files have after copying and applying the
existing mtree file.
You can get some more advanced features with some other switches.
# sxxu -kRw /tmp/sxxu-work
will extract all roles including those named role-* into /tmp/sxxy-work
without following the included roles. At that point you can change
permissions in the work directory as you see fit, then when you are ready,
from the place where your source files are you would run
$ sxxu -mw /tmp/sxxu-work
which will regenerate the mtree specs with the permissions you have set.