Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme committed Sep 17, 2021
0 parents commit 17a06c3
Show file tree
Hide file tree
Showing 12 changed files with 171 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: release

on:
push:
tags:
- v*

jobs:
build:
name: release

runs-on: ubuntu-latest

container:
image: debian:latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install Dependencies
run: |-
apt update
apt install -y devscripts
- name: Build
run: |-
debuild --build=all --no-sign
- name: Get Release Asset
id: get_release_asset
run: |-
echo "::set-output name=asset_path::$(echo ../*_all.deb)"
echo "::set-output name=asset_name::$(basename ../*_all.deb)"
echo "::set-output name=asset_content_type::$(file --brief --mime-type ../*_all.deb)"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.get_release_asset.outputs.asset_path }}
asset_name: ${{ steps.get_release_asset.outputs.asset_name }}
asset_content_type: ${{ steps.get_release_asset.outputs.asset_content_type }}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 なつき

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# unifi-systemd

Systemd Service for UniFi OS

## Installation

``` sh
podman exec unifi-os sh -c "curl -fsSLo /tmp/unifi-systemd_1.0.0_all.deb https://github.com/ntkme/unifi-systemd/releases/download/v1.0.0/unifi-systemd_1.0.0_all.deb && dpkg -i /tmp/unifi-systemd_1.0.0_all.deb && rm /tmp/unifi-systemd_1.0.0_all.deb"
```

## Uninstallation

``` sh
podman exec unifi-os sh -c "dpkg -P unifi-systemd"
```

## Usage

Put `systemd` units in `/mnt/data/etc/systemd/system`, which will be loaded by `unifi-systemd` container.
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
unifi-systemd (1.0.0) stable; urgency=medium

* Initial release.

-- Natsume Natsuki <i@ntk.me> Fri, 01 Jan 2021 18:00:00 -0700
14 changes: 14 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Source: unifi-systemd
Section: contrib/utils
Priority: optional
Maintainer: Natsume Natsuki <i@ntk.me>
Build-Depends: debhelper-compat (= 12)
Standards-Version: 4.3.0
Homepage: https://github.com/ntkme/unifi-systemd
#Vcs-Browser: https://github.com/ntkme/unifi-systemd
#Vcs-Git: https://github.com/ntkme/unifi-systemd.git

Package: unifi-systemd
Architecture: all
Depends: ${misc:Depends}
Description: Unifi systemd service.
26 changes: 26 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: unifi-systemd
Source: <https://github.com/ntkme/unifi-systemd>

Files: *
Copyright: 2021 なつき <i@ntk.me>
License: MIT

License: MIT
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 change: 1 addition & 0 deletions debian/install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lib/systemd/system/unifi-systemd.service
4 changes: 4 additions & 0 deletions debian/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
set -e
alias deb-systemd-invoke=systemctl
#DEBHELPER#
4 changes: 4 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/make -f

%:
dh $@
1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (native)
15 changes: 15 additions & 0 deletions lib/systemd/system/unifi-systemd.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[Unit]
Description=Podman unifi-systemd.service
Wants=network-online.target
After=network-online.target

[Service]
ExecStartPre=-/sbin/ssh-proxy 'printf '\''%%s\\n'\'' '\''#!/bin/sh'\'' '\''case "$1" in status) if [ "$(/usr/bin/podman inspect -f "{{.State.Running}}" %N 2>&1)" = "true" ]; then echo "%N: $(/usr/bin/podman exec %N systemctl is-system-running 2>/dev/null)"; else echo "%N: stopped"; fi;; start|stop|reload|restart) exec /usr/bin/podman exec unifi-os systemctl "$1" %n | logger -st %N;; shell) exec /usr/bin/podman exec -it %N /bin/bash;; *) echo "Usage: $0 [status start stop reload restart shell]";; esac'\'' >/usr/sbin/%N && chmod 0755 /usr/sbin/%N'
ExecStart=/sbin/ssh-proxy 'mkdir -p /mnt/data/etc/systemd/system /mnt/data/var/lib/containers && if ! /usr/bin/podman container exists %N; then /usr/bin/podman create --rm --name %N --privileged --net host --hostname "unifi.$(podman exec unifi-os domainname)" --volume /lib/modules:/lib/modules:ro --volume /sys/fs/cgroup:/sys/fs/cgroup:ro --volume /var/run/ssh_proxy_port:/var/run/ssh_proxy_port:ro --volume /mnt/data/podman/storage:/usr/local/share/containers/storage:ro --volume /root:/root --volume /mnt:/mnt --volume /mnt/data/etc/systemd/system:/etc/systemd/system --volume /mnt/data/var/lib/containers:/var/lib/containers ghcr.io/ntkme/systemd-podman:edge; fi && /usr/bin/podman start %N'
ExecStop=/sbin/ssh-proxy 'if /usr/bin/podman container exists %N; then /usr/bin/podman stop %N; fi'
ExecReload=/sbin/ssh-proxy 'if /usr/bin/podman container exists %N; then /usr/bin/podman exec %N systemctl daemon-reload; fi'
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

0 comments on commit 17a06c3

Please sign in to comment.