├── .github ├── dependabot.yml └── workflows │ ├── containers.yml │ └── go.yml ├── .gitignore ├── CONTRIBUTING.md ├── DCO ├── LICENSE ├── NOTICE ├── README.md ├── activation ├── common_test.go ├── files_test.go ├── files_unix.go ├── files_windows.go ├── listeners.go ├── listeners_test.go ├── packetconns.go └── packetconns_test.go ├── code-of-conduct.md ├── daemon ├── sdnotify.go ├── sdnotify_test.go ├── watchdog.go └── watchdog_test.go ├── dbus ├── dbus.go ├── dbus_test.go ├── methods.go ├── methods_test.go ├── properties.go ├── set.go ├── set_test.go ├── subscription.go ├── subscription_set.go ├── subscription_set_test.go └── subscription_test.go ├── examples ├── activation │ ├── activation.go │ ├── httpserver │ │ ├── README.md │ │ ├── hello.service │ │ ├── hello.socket │ │ └── httpserver.go │ ├── listen.go │ └── udpconn.go └── journal │ ├── main.go │ └── run.sh ├── fixtures ├── enable-disable.service ├── freeze.service ├── image.raw.xz ├── image.tar.xz ├── mask-unmask.service ├── oneshot.service ├── reload.service ├── start-failed.service ├── start-stop.service ├── subscribe-events-set.service └── subscribe-events.service ├── go.mod ├── go.sum ├── import1 ├── dbus.go └── dbus_test.go ├── internal └── dlopen │ ├── dlopen.go │ ├── dlopen_example.go │ └── dlopen_test.go ├── journal ├── journal.go ├── journal_test.go ├── journal_unix.go ├── journal_unix_test.go └── journal_windows.go ├── login1 ├── dbus.go └── dbus_test.go ├── machine1 ├── dbus.go └── dbus_test.go ├── scripts └── ci-runner.sh ├── sdjournal ├── functions.go ├── functions_test.go ├── journal.go ├── journal_test.go └── read.go ├── unit ├── deserialize.go ├── deserialize_test.go ├── end_to_end_test.go ├── escape.go ├── escape_test.go ├── option.go ├── option_test.go ├── section.go ├── serialize.go └── serialize_test.go └── util ├── util.go ├── util_cgo.go ├── util_stub.go └── util_test.go /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Maintained in https://github.com/coreos/repo-templates 2 | # Do not edit downstream. 3 | 4 | version: 2 5 | updates: 6 | - package-ecosystem: gomod 7 | directory: / 8 | schedule: 9 | interval: weekly 10 | open-pull-requests-limit: 10 11 | labels: 12 | - area/dependencies 13 | -------------------------------------------------------------------------------- /.github/workflows/containers.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Containers 3 | 4 | on: 5 | push: 6 | branches: [main] 7 | pull_request: 8 | branches: [main] 9 | 10 | permissions: 11 | contents: read 12 | 13 | env: 14 | GO_TOOLCHAIN: "1.15" 15 | GOPATH: "/opt" 16 | BUILD_DIR: "/opt/src/github.com/coreos/go-systemd" 17 | 18 | jobs: 19 | ditro-test: 20 | name: "Distro test" 21 | runs-on: ubuntu-20.04 22 | strategy: 23 | matrix: 24 | baseimage: ['debian:bullseye', 'ubuntu:20.04', 'ubuntu:22.04'] 25 | steps: 26 | - run: sudo apt-get -qq update 27 | - name: Install libsystemd-dev 28 | run: sudo apt-get install libsystemd-dev 29 | - uses: actions/checkout@v3 30 | - name: Setup go 31 | uses: actions/setup-go@v4 32 | with: 33 | go-version: ${{ env['GO_TOOLCHAIN'] }} 34 | - name: Go build (source) 35 | run: ./scripts/ci-runner.sh build_source 36 | - name: Go build (tests) 37 | run: ./scripts/ci-runner.sh build_tests 38 | - name: Pull base image - ${{ matrix.baseimage }} 39 | run: docker pull ${{ matrix.baseimage }} 40 | - name: Install packages for ${{ matrix.baseimage }} 41 | run: docker run --privileged -e GOPATH=${GOPATH} --cidfile=/tmp/cidfile ${{ matrix.baseimage }} /bin/bash -c "export DEBIAN_FRONTEND=noninteractive; apt-get update && apt-get install -y sudo build-essential git golang dbus libsystemd-dev libpam-systemd systemd-container" 42 | - name: Persist base container 43 | run: docker commit `cat /tmp/cidfile` go-systemd/container-tests 44 | - run: rm -f /tmp/cidfile 45 | - name: Run systemd from ${{ matrix.baseimage }} 46 | run: docker run --shm-size=2gb -d --cidfile=/tmp/cidfile --privileged -e GOPATH=${GOPATH} -v ${PWD}:${BUILD_DIR} go-systemd/container-tests /bin/systemd --system 47 | - name: Wait a bit for the whole system to settle 48 | run: sleep 30s 49 | - name: Run tests 50 | run: docker exec --privileged `cat /tmp/cidfile` /bin/bash -c "cd ${BUILD_DIR} && ./scripts/ci-runner.sh run_tests" 51 | - name: Cleanup 52 | run: docker kill `cat /tmp/cidfile` 53 | -------------------------------------------------------------------------------- /.github/workflows/go.yml: -------------------------------------------------------------------------------- 1 | name: Go 2 | on: 3 | push: 4 | branches: [main] 5 | pull_request: 6 | branches: [main] 7 | 8 | permissions: 9 | contents: read 10 | 11 | env: 12 | # Minimum supported Go toolchain 13 | ACTION_MINIMUM_TOOLCHAIN: "1.12.x" 14 | 15 | jobs: 16 | build: 17 | name: "Build" 18 | runs-on: ubuntu-latest 19 | strategy: 20 | matrix: 21 | go: ['1.17.x', '1.18.x', '1.19.x', '1.20.x'] 22 | steps: 23 | - run: sudo apt-get -qq update 24 | - name: Install libsystemd-dev 25 | run: sudo apt-get install libsystemd-dev 26 | - uses: actions/checkout@v3 27 | - name: Setup go 28 | uses: actions/setup-go@v4 29 | with: 30 | go-version: ${{ matrix.go }} 31 | - name: Go fmt 32 | run: ./scripts/ci-runner.sh go_fmt 33 | - name: Go build (source) 34 | run: ./scripts/ci-runner.sh build_source 35 | - name: Go build (tests) 36 | run: ./scripts/ci-runner.sh build_tests 37 | - name: Go vet 38 | run: ./scripts/ci-runner.sh go_vet 39 | build-minimum: 40 | name: "Build on minimum supported toolchain" 41 | runs-on: ubuntu-latest 42 | steps: 43 | - run: sudo apt-get -qq update 44 | - name: Install libsystemd-dev 45 | run: sudo apt-get install libsystemd-dev 46 | - uses: actions/checkout@v3 47 | - name: Setup go 48 | uses: actions/setup-go@v4 49 | with: 50 | go-version: ${{ env['ACTION_MINIMUM_TOOLCHAIN'] }} 51 | - name: Go fmt 52 | run: ./scripts/ci-runner.sh go_fmt 53 | - name: Go build (source) 54 | run: ./scripts/ci-runner.sh build_source 55 | - name: Go build (tests) 56 | run: ./scripts/ci-runner.sh build_tests 57 | - name: Go vet 58 | run: ./scripts/ci-runner.sh go_vet 59 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | test_bins 2 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to Contribute 2 | 3 | CoreOS projects are [Apache 2.0 licensed](LICENSE) and accept contributions via 4 | GitHub pull requests. This document outlines some of the conventions on 5 | development workflow, commit message formatting, contact points and other 6 | resources to make it easier to get your contribution accepted. 7 | 8 | # Certificate of Origin 9 | 10 | By contributing to this project you agree to the Developer Certificate of 11 | Origin (DCO). This document was created by the Linux Kernel community and is a 12 | simple statement that you, as a contributor, have the legal right to make the 13 | contribution. See the [DCO](DCO) file for details. 14 | 15 | ## Getting Started 16 | 17 | - Fork the repository on GitHub 18 | - Read the [README](README.md) for build and test instructions 19 | - Play with the project, submit bugs, submit patches! 20 | 21 | ## Contribution Flow 22 | 23 | This is a rough outline of what a contributor's workflow looks like: 24 | 25 | - Create a topic branch from where you want to base your work (usually main). 26 | - Make commits of logical units. 27 | - Make sure your commit messages are in the proper format (see below). 28 | - Push your changes to a topic branch in your fork of the repository. 29 | - Make sure the tests pass, and add any new tests as appropriate. 30 | - Submit a pull request to the original repository. 31 | 32 | Thanks for your contributions! 33 | 34 | ### Format of the Commit Message 35 | 36 | We follow a rough convention for commit messages that is designed to answer two 37 | questions: what changed and why. The subject line should feature the what and 38 | the body of the commit should describe the why. 39 | 40 | ``` 41 | scripts: add the test-cluster command 42 | 43 | this uses tmux to setup a test cluster that you can easily kill and 44 | start for debugging. 45 | 46 | Fixes #38 47 | ``` 48 | 49 | The format can be described more formally as follows: 50 | 51 | ``` 52 | : 53 | 54 | 55 | 56 |