]> ruderich.org/simon Gitweb - safcm/safcm.git/log
safcm/safcm.git
3 years agoci: also run tests with strict umask
Simon Ruderich [Sat, 17 Apr 2021 06:36:05 +0000 (08:36 +0200)]
ci: also run tests with strict umask

3 years agoAdd basic support for FreeBSD
Simon Ruderich [Sat, 17 Apr 2021 06:10:17 +0000 (08:10 +0200)]
Add basic support for FreeBSD

Installing packages and starting/enabling services is not yet supported.
There are minor limitations when handling symlinks (see README.adoc).

3 years agorpc: prepare to support more operating systems
Simon Ruderich [Wed, 14 Apr 2021 11:47:28 +0000 (13:47 +0200)]
rpc: prepare to support more operating systems

3 years agoAdd build manifest for build.sr.ht
Simon Ruderich [Thu, 15 Apr 2021 21:23:06 +0000 (23:23 +0200)]
Add build manifest for build.sr.ht

3 years agoREADME.adoc: improve list of supported operating systems
Simon Ruderich [Wed, 14 Apr 2021 12:33:23 +0000 (14:33 +0200)]
README.adoc: improve list of supported operating systems

3 years agorpc: document ConnEventType constants
Simon Ruderich [Wed, 14 Apr 2021 07:06:19 +0000 (09:06 +0200)]
rpc: document ConnEventType constants

3 years agoREADME.adoc: mention full file content is sent to remote
Simon Ruderich [Wed, 14 Apr 2021 06:59:11 +0000 (08:59 +0200)]
README.adoc: mention full file content is sent to remote

3 years agotestutil: show file/line of caller in messages
Simon Ruderich [Wed, 14 Apr 2021 06:54:20 +0000 (08:54 +0200)]
testutil: show file/line of caller in messages

3 years agoconfig: forbid ":remove" groups which conflict with hosts
Simon Ruderich [Tue, 13 Apr 2021 06:17:09 +0000 (08:17 +0200)]
config: forbid ":remove" groups which conflict with hosts

Defining these groups had no effect but might confuse the user. As they
don't make any sense forbid them.

3 years agosafcm: forbid syncing groups which depend on "detected" groups
Simon Ruderich [Tue, 13 Apr 2021 06:04:03 +0000 (08:04 +0200)]
safcm: forbid syncing groups which depend on "detected" groups

3 years agoconfig: add newline between error message and explanation
Simon Ruderich [Tue, 13 Apr 2021 05:47:06 +0000 (07:47 +0200)]
config: add newline between error message and explanation

This makes the result more readable.

3 years agochanges: shorten output to one line with quiet and only silent commands
Simon Ruderich [Sat, 10 Apr 2021 18:24:03 +0000 (20:24 +0200)]
changes: shorten output to one line with quiet and only silent commands

3 years agochanges: hide commands if quiet and dry-run is active
Simon Ruderich [Sat, 10 Apr 2021 18:16:06 +0000 (20:16 +0200)]
changes: hide commands if quiet and dry-run is active

The goal of quiet is to get a quick overview what is happening or what
is going to happen (when combined with dry-run). While quiet worked fine
for non dry-run syncs it was not very helpful for dry-runs. This change
makes the output much more compact and readable with many commands and
hosts.

3 years agochanges: refactor into separate function and add basic tests
Simon Ruderich [Sat, 10 Apr 2021 17:53:05 +0000 (19:53 +0200)]
changes: refactor into separate function and add basic tests

3 years agoREADME.adoc: mention quoted strings in limitations
Simon Ruderich [Sat, 10 Apr 2021 17:52:02 +0000 (19:52 +0200)]
README.adoc: mention quoted strings in limitations

3 years agoMakefile: add test target
Simon Ruderich [Fri, 9 Apr 2021 05:27:51 +0000 (07:27 +0200)]
Makefile: add test target

3 years agoconfig: permit "all" and host group in .InGroup of templates
Simon Ruderich [Thu, 8 Apr 2021 17:02:51 +0000 (19:02 +0200)]
config: permit "all" and host group in .InGroup of templates

These special groups were not handled properly.

3 years agoAdd README.adoc
Simon Ruderich [Thu, 8 Apr 2021 06:35:05 +0000 (08:35 +0200)]
Add README.adoc

3 years agoconfig: forbid duplicate host names
Simon Ruderich [Wed, 7 Apr 2021 17:11:45 +0000 (19:11 +0200)]
config: forbid duplicate host names

3 years agosync: abort if stdin/stdout is a terminal
Simon Ruderich [Tue, 6 Apr 2021 09:50:58 +0000 (11:50 +0200)]
sync: abort if stdin/stdout is a terminal

Notify the user that is probably not what they intended to do.

3 years agoremote: go fmt
Simon Ruderich [Tue, 6 Apr 2021 09:47:55 +0000 (11:47 +0200)]
remote: go fmt

3 years agoremote: add "sync" sub-command to perform changes
Simon Ruderich [Tue, 6 Apr 2021 09:44:47 +0000 (11:44 +0200)]
remote: add "sync" sub-command to perform changes

Performing the changes when no command line arguments were given became
problematic in ddd21f0 (remote: add ainsl sub-command ("append if no
such line"), 2021-04-04). With "ainsl" as sub-command a user might be
tempted to run the helper manually to test it. But running it without
any arguments causes it to hang (waiting for commands from stdin) which
is confusing. Instead, use the new separate "sync" sub-command to
perform the changes and abort when no sub-command is given.

3 years agosafcm: add tests for logEvent()
Simon Ruderich [Tue, 6 Apr 2021 09:27:32 +0000 (11:27 +0200)]
safcm: add tests for logEvent()

3 years agosafcm: add "version" sub-command
Simon Ruderich [Tue, 6 Apr 2021 08:57:57 +0000 (10:57 +0200)]
safcm: add "version" sub-command

Embed current Git and Go version at build time.

3 years agochanges: remove unused code
Simon Ruderich [Mon, 5 Apr 2021 10:06:14 +0000 (12:06 +0200)]
changes: remove unused code

3 years agochanges: add tests for output with terminal
Simon Ruderich [Mon, 5 Apr 2021 10:05:56 +0000 (12:05 +0200)]
changes: add tests for output with terminal

3 years agotests: add and use testutil package to reduce duplication
Simon Ruderich [Mon, 5 Apr 2021 09:20:02 +0000 (11:20 +0200)]
tests: add and use testutil package to reduce duplication

This is not as explicit as the previous code but still good enough. And
it gets rid of quite some boilerplate.

3 years agoconfig: remove unnecessary os.Chdir in test
Simon Ruderich [Mon, 5 Apr 2021 08:47:40 +0000 (10:47 +0200)]
config: remove unnecessary os.Chdir in test

3 years agotests: go fmt and rewrap
Simon Ruderich [Mon, 5 Apr 2021 08:44:52 +0000 (10:44 +0200)]
tests: go fmt and rewrap

3 years agotests: use subtests
Simon Ruderich [Mon, 5 Apr 2021 08:36:02 +0000 (10:36 +0200)]
tests: use subtests

This removes the need to print the name of the test in each t.Errorf()
call which reduces unnecessary code. It also permits skipping tests
which will be used in the future.

3 years agosafcm: add -q (quiet) command line option
Simon Ruderich [Mon, 5 Apr 2021 07:35:37 +0000 (09:35 +0200)]
safcm: add -q (quiet) command line option

3 years agoremote: add ainsl sub-command ("append if no such line")
Simon Ruderich [Sun, 4 Apr 2021 21:35:50 +0000 (23:35 +0200)]
remote: add ainsl sub-command ("append if no such line")

It is preferred to deploy complete files by putting them in the files/
directory of a group. However, sometimes this is not possible because
parts of the file's content are unknown or managed by other programs or
users. An example is .ssh/authorized_keys which should contain certain
keys but which is also managed manually. `ainsl` permits adding a key to
the file without rewriting it completely.

`ainsl` can be used by specifying the following command:

    $SAFCM_HELPER ainsl /path/to/file line-to-add

Per default non-existent files are an error. To create the file if
necessary use:

    $SAFCM_HELPER ainsl -create /path/to/file line-to-add

The environment variable $SAFCM_HELPER is set when executing commands
and contains the absolute path to the remote helper.

3 years agosync: add SAFCM_HELPER environment variable to commands
Simon Ruderich [Sun, 4 Apr 2021 19:27:31 +0000 (21:27 +0200)]
sync: add SAFCM_HELPER environment variable to commands

Contains the absolute path to the remote helper binary. Will be useful
in the future when the remote helper gets additional subcommands.

3 years agosync: move file related test functions to new package filetest
Simon Ruderich [Sun, 4 Apr 2021 19:25:14 +0000 (21:25 +0200)]
sync: move file related test functions to new package filetest

They will be used by other packages in the near future.

3 years agoremote: remove duplicate call to log.SetFlags()
Simon Ruderich [Sun, 4 Apr 2021 10:36:44 +0000 (12:36 +0200)]
remote: remove duplicate call to log.SetFlags()

3 years agosync: refactor temporary file creation into WriteTemp()
Simon Ruderich [Sun, 4 Apr 2021 08:50:05 +0000 (10:50 +0200)]
sync: refactor temporary file creation into WriteTemp()

Make it public because it will be used by other packages in the near
future.

3 years agosync: remove duplication when setting path to temporary file
Simon Ruderich [Sun, 4 Apr 2021 08:43:19 +0000 (10:43 +0200)]
sync: remove duplication when setting path to temporary file

3 years agofixperms: use safcm-remote.sync's OpenFileNoFollow()
Simon Ruderich [Sun, 4 Apr 2021 08:40:13 +0000 (10:40 +0200)]
fixperms: use safcm-remote.sync's OpenFileNoFollow()

3 years agosync: refactor file opening into OpenFileNoFollow()
Simon Ruderich [Sun, 4 Apr 2021 08:35:22 +0000 (10:35 +0200)]
sync: refactor file opening into OpenFileNoFollow()

Make it public because it will be used by other packages in the next
commit.

3 years agoci: run go vet
Simon Ruderich [Sun, 4 Apr 2021 06:47:40 +0000 (08:47 +0200)]
ci: run go vet

3 years agoconfig: forbid host names which conflict with special groups
Simon Ruderich [Sun, 4 Apr 2021 06:46:00 +0000 (08:46 +0200)]
config: forbid host names which conflict with special groups

3 years agofixperms: don't follow symlinks
Simon Ruderich [Sun, 4 Apr 2021 06:25:57 +0000 (08:25 +0200)]
fixperms: don't follow symlinks

This prevents a possible TOCTOU when chmodding files.

3 years agoconfig: add Host option "ssh_user"
Simon Ruderich [Sat, 3 Apr 2021 13:57:54 +0000 (15:57 +0200)]
config: add Host option "ssh_user"

If it's empty or not present the default user of `ssh` is used. This is
either the current user or the user configured in ~/.ssh/config.

3 years agoAdd support for armv7l SoCs like Raspberry Pi 2 and newer
Markus [Fri, 2 Apr 2021 20:39:26 +0000 (22:39 +0200)]
Add support for armv7l SoCs like Raspberry Pi 2 and newer

3 years agoAdd .gitlab-ci.yml
Simon Ruderich [Sat, 3 Apr 2021 13:06:54 +0000 (15:06 +0200)]
Add .gitlab-ci.yml

3 years agoFirst working version
Simon Ruderich [Sat, 3 Apr 2021 13:02:39 +0000 (15:02 +0200)]
First working version

3 years agoInitial commit
Simon Ruderich [Fri, 19 Mar 2021 17:52:52 +0000 (18:52 +0100)]
Initial commit