Compare commits
11 Commits
880023c68b
...
v0.0.5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6198ea6b7 | ||
|
|
9ef31866f1 | ||
|
|
77b86dc3fc | ||
|
|
0999303cd3 | ||
|
|
384c4592d1 | ||
|
|
815bdfed80 | ||
|
|
243da39fe3 | ||
|
|
0a1e768dfe | ||
|
|
e66f869752 | ||
|
|
2c0f51422e | ||
|
|
0b34b182a9 |
@@ -91,3 +91,241 @@ jobs:
|
|||||||
done
|
done
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
pkg-aur:
|
||||||
|
needs: release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Publish to AUR
|
||||||
|
env:
|
||||||
|
AUR_SSH_KEY: ${{ secrets.AUR_SSH_KEY }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
VERSION="${{ github.event.inputs.tag || github.ref_name }}"
|
||||||
|
PKGVER="${VERSION#v}"
|
||||||
|
AUR_KEY_PATH="$HOME/.ssh/aur"
|
||||||
|
AUR_KNOWN_HOSTS="$HOME/.ssh/known_hosts"
|
||||||
|
|
||||||
|
# Setup SSH for AUR
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
chmod 700 ~/.ssh
|
||||||
|
|
||||||
|
if [ -z "${AUR_SSH_KEY:-}" ]; then
|
||||||
|
echo "AUR_SSH_KEY is empty"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Support raw multiline keys, escaped \\n secrets, or base64-encoded keys.
|
||||||
|
CLEAN_AUR_SSH_KEY="$(printf '%s' "$AUR_SSH_KEY" | tr -d '\r')"
|
||||||
|
if printf '%s' "$CLEAN_AUR_SSH_KEY" | grep -q "^-----BEGIN .*PRIVATE KEY-----$"; then
|
||||||
|
printf '%s\n' "$CLEAN_AUR_SSH_KEY" > "$AUR_KEY_PATH"
|
||||||
|
elif printf '%s' "$CLEAN_AUR_SSH_KEY" | grep -q '\\n'; then
|
||||||
|
printf '%b\n' "$CLEAN_AUR_SSH_KEY" > "$AUR_KEY_PATH"
|
||||||
|
else
|
||||||
|
if printf '%s' "$CLEAN_AUR_SSH_KEY" | tr -d '[:space:]' | base64 --decode > "$AUR_KEY_PATH" 2>/dev/null; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
printf '%s\n' "$CLEAN_AUR_SSH_KEY" > "$AUR_KEY_PATH"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
chmod 600 "$AUR_KEY_PATH"
|
||||||
|
|
||||||
|
if ! ssh-keygen -y -f "$AUR_KEY_PATH" >/dev/null 2>&1; then
|
||||||
|
echo "AUR_SSH_KEY is not a valid private key."
|
||||||
|
echo "Store it as a raw private key, an escaped private key with \\n, or a base64-encoded private key."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
ssh-keyscan -t rsa,ed25519 aur.archlinux.org >> "$AUR_KNOWN_HOSTS"
|
||||||
|
chmod 644 "$AUR_KNOWN_HOSTS"
|
||||||
|
|
||||||
|
# Clone AUR repo
|
||||||
|
GIT_SSH_COMMAND="ssh -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile=$AUR_KNOWN_HOSTS -i $AUR_KEY_PATH" \
|
||||||
|
git clone ssh://aur@aur.archlinux.org/unitdore.git aur-repo
|
||||||
|
|
||||||
|
CURRENT_PKGVER=$(awk -F= '/^pkgver=/ {print $2; exit}' aur-repo/PKGBUILD | tr -d "[:space:]")
|
||||||
|
CURRENT_PKGREL=$(awk -F= '/^pkgrel=/ {print $2; exit}' aur-repo/PKGBUILD | tr -d "[:space:]")
|
||||||
|
|
||||||
|
if [ "$CURRENT_PKGVER" = "$PKGVER" ]; then
|
||||||
|
case "$CURRENT_PKGREL" in
|
||||||
|
''|*[!0-9]*)
|
||||||
|
echo "Unsupported pkgrel in AUR repo: ${CURRENT_PKGREL}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
PKGREL=$((CURRENT_PKGREL + 1))
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
PKGREL=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Publishing AUR package version ${PKGVER}-${PKGREL}"
|
||||||
|
|
||||||
|
# Compute SHA256 of the source archive from the same URL the PKGBUILD will download.
|
||||||
|
SHA=$(curl -fsSL "https://git.warky.dev/wdevs/unitdore/archive/v${PKGVER}.zip" | sha256sum | cut -d' ' -f1)
|
||||||
|
|
||||||
|
# Update PKGBUILD — keep remote source URL, bump version/checksum, and increment pkgrel for same-version rebuilds.
|
||||||
|
sed -e "s/^pkgver=.*/pkgver=${PKGVER}/" \
|
||||||
|
-e "s/^pkgrel=.*/pkgrel=${PKGREL}/" \
|
||||||
|
-e "s/^sha256sums=.*/sha256sums=('${SHA}')/" \
|
||||||
|
pkg/arch/PKGBUILD > aur-repo/PKGBUILD
|
||||||
|
|
||||||
|
# Generate .SRCINFO inside an Arch container (docker cp avoids DinD volume mount issues)
|
||||||
|
CID=$(docker run -d archlinux:latest sleep infinity)
|
||||||
|
docker cp aur-repo/PKGBUILD $CID:/build/PKGBUILD || (docker exec $CID mkdir -p /build && docker cp aur-repo/PKGBUILD $CID:/build/PKGBUILD)
|
||||||
|
docker exec $CID bash -c "
|
||||||
|
pacman -Sy --noconfirm base-devel &&
|
||||||
|
useradd -m builder &&
|
||||||
|
chown -R builder:builder /build &&
|
||||||
|
runuser -u builder -- bash -c 'cd /build && makepkg --printsrcinfo > .SRCINFO'
|
||||||
|
"
|
||||||
|
docker cp $CID:/build/.SRCINFO aur-repo/.SRCINFO
|
||||||
|
docker rm -f $CID
|
||||||
|
|
||||||
|
# Commit and push to AUR master
|
||||||
|
cd aur-repo
|
||||||
|
git config user.email "hein@warky.dev"
|
||||||
|
git config user.name "Hein"
|
||||||
|
git add PKGBUILD .SRCINFO
|
||||||
|
git commit -m "Update to v${PKGVER}-${PKGREL}"
|
||||||
|
GIT_SSH_COMMAND="ssh -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile=$AUR_KNOWN_HOSTS -i $AUR_KEY_PATH" \
|
||||||
|
git push origin HEAD:master
|
||||||
|
|
||||||
|
pkg-deb:
|
||||||
|
needs: release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: go.mod
|
||||||
|
|
||||||
|
- name: Build Debian packages
|
||||||
|
run: |
|
||||||
|
VERSION="${{ github.event.inputs.tag || github.ref_name }}"
|
||||||
|
PKGVER="${VERSION#v}"
|
||||||
|
|
||||||
|
for GOARCH in amd64 arm64; do
|
||||||
|
GOOS=linux GOARCH=$GOARCH go build \
|
||||||
|
-trimpath \
|
||||||
|
-ldflags "-X main.version=${PKGVER}" \
|
||||||
|
-o unitdore .
|
||||||
|
|
||||||
|
PKGDIR="unitdore_${PKGVER}_${GOARCH}"
|
||||||
|
mkdir -p "${PKGDIR}/DEBIAN"
|
||||||
|
mkdir -p "${PKGDIR}/usr/bin"
|
||||||
|
mkdir -p "${PKGDIR}/usr/share/man/man1"
|
||||||
|
mkdir -p "${PKGDIR}/etc/unitdore"
|
||||||
|
|
||||||
|
install -m755 unitdore "${PKGDIR}/usr/bin/unitdore"
|
||||||
|
install -m644 docs/unitdore.1 "${PKGDIR}/usr/share/man/man1/unitdore.1"
|
||||||
|
|
||||||
|
sed -e "s/VERSION/${PKGVER}/" \
|
||||||
|
-e "s/ARCH/${GOARCH}/" \
|
||||||
|
pkg/debian/control > "${PKGDIR}/DEBIAN/control"
|
||||||
|
|
||||||
|
dpkg-deb --build --root-owner-group "${PKGDIR}"
|
||||||
|
echo "Built ${PKGDIR}.deb"
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Upload to release
|
||||||
|
run: |
|
||||||
|
TAG="${{ github.event.inputs.tag || github.ref_name }}"
|
||||||
|
RELEASE=$(curl -s "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/tags/${TAG}" \
|
||||||
|
-H "Authorization: token ${GITHUB_TOKEN}")
|
||||||
|
UPLOAD_URL=$(echo "$RELEASE" | grep -o '"upload_url":"[^"]*"' | cut -d'"' -f4)
|
||||||
|
for f in *.deb; do
|
||||||
|
FNAME=$(basename "$f")
|
||||||
|
echo "Uploading $FNAME..."
|
||||||
|
curl -s -X POST "${UPLOAD_URL}?name=${FNAME}" \
|
||||||
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||||
|
-H "Content-Type: application/octet-stream" \
|
||||||
|
--data-binary "@${f}" > /dev/null
|
||||||
|
done
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
pkg-rpm:
|
||||||
|
needs: release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Build RPM
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
VERSION="${{ github.event.inputs.tag || github.ref_name }}"
|
||||||
|
PKGVER="${VERSION#v}"
|
||||||
|
GO_VER="$(awk '/^go / { print $2; exit }' go.mod)"
|
||||||
|
|
||||||
|
if [ -z "${GO_VER}" ]; then
|
||||||
|
echo "Failed to determine Go version from go.mod"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Source tarball — prefix=unitdore-VERSION/ matches RPM %autosetup convention
|
||||||
|
git archive --format=tar.gz --prefix=unitdore-${PKGVER}/ HEAD \
|
||||||
|
> unitdore-${PKGVER}.tar.gz
|
||||||
|
|
||||||
|
# Patch spec version
|
||||||
|
sed -i "s/^Version:.*/Version: ${PKGVER}/" pkg/centos/unitdore.spec
|
||||||
|
|
||||||
|
mkdir -p pkg/centos/out
|
||||||
|
CID=$(docker create \
|
||||||
|
-e GO_VER="${GO_VER}" \
|
||||||
|
-e PKGVER="${PKGVER}" \
|
||||||
|
-w /build \
|
||||||
|
rockylinux:9 \
|
||||||
|
bash -lc "
|
||||||
|
set -euo pipefail
|
||||||
|
# Rocky 9 images already ship curl-minimal, which is enough for the Go tarball download.
|
||||||
|
dnf install -y rpm-build git &&
|
||||||
|
curl -fsSL https://go.dev/dl/go\${GO_VER}.linux-amd64.tar.gz | tar -C /usr/local -xz &&
|
||||||
|
export PATH=\$PATH:/usr/local/go/bin &&
|
||||||
|
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} &&
|
||||||
|
cp unitdore-${PKGVER}.tar.gz ~/rpmbuild/SOURCES/ &&
|
||||||
|
cp pkg/centos/unitdore.spec ~/rpmbuild/SPECS/ &&
|
||||||
|
rpmbuild --nodeps -ba ~/rpmbuild/SPECS/unitdore.spec
|
||||||
|
")
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
docker rm -f "$CID" >/dev/null 2>&1 || true
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
# Avoid bind mounts here because DinD runners may not expose the checkout path to the Docker daemon.
|
||||||
|
docker cp unitdore-${PKGVER}.tar.gz "$CID:/build/unitdore-${PKGVER}.tar.gz"
|
||||||
|
docker cp pkg "$CID:/build/pkg"
|
||||||
|
|
||||||
|
docker start -a "$CID"
|
||||||
|
docker cp "$CID:/root/rpmbuild/RPMS/." pkg/centos/out/
|
||||||
|
|
||||||
|
trap - EXIT
|
||||||
|
cleanup
|
||||||
|
|
||||||
|
- name: Upload to release
|
||||||
|
run: |
|
||||||
|
TAG="${{ github.event.inputs.tag || github.ref_name }}"
|
||||||
|
RELEASE=$(curl -s "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/tags/${TAG}" \
|
||||||
|
-H "Authorization: token ${GITHUB_TOKEN}")
|
||||||
|
UPLOAD_URL=$(echo "$RELEASE" | grep -o '"upload_url":"[^"]*"' | cut -d'"' -f4)
|
||||||
|
for f in pkg/centos/out/*.rpm; do
|
||||||
|
FNAME=$(basename "$f")
|
||||||
|
echo "Uploading $FNAME..."
|
||||||
|
curl -s -X POST "${UPLOAD_URL}?name=${FNAME}" \
|
||||||
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||||
|
-H "Content-Type: application/octet-stream" \
|
||||||
|
--data-binary "@${f}" > /dev/null
|
||||||
|
done
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
unitdore
|
unitdore
|
||||||
*.exe
|
*.exe
|
||||||
|
.codex
|
||||||
|
|||||||
6
Makefile
6
Makefile
@@ -12,16 +12,18 @@ all: build
|
|||||||
build:
|
build:
|
||||||
go build $(LDFLAGS) -o $(BINARY) .
|
go build $(LDFLAGS) -o $(BINARY) .
|
||||||
|
|
||||||
## install: install binary and create config dir
|
## install: install binary, man page, and create config dir
|
||||||
install: build
|
install: build
|
||||||
install -Dm755 $(BINARY) $(INSTALL_DIR)/$(BINARY)
|
install -Dm755 $(BINARY) $(INSTALL_DIR)/$(BINARY)
|
||||||
|
install -Dm644 docs/unitdore.1 /usr/share/man/man1/unitdore.1
|
||||||
mkdir -p $(CONFIG_DIR)
|
mkdir -p $(CONFIG_DIR)
|
||||||
@echo "Installed to $(INSTALL_DIR)/$(BINARY)"
|
@echo "Installed to $(INSTALL_DIR)/$(BINARY)"
|
||||||
@echo "Config dir: $(CONFIG_DIR)"
|
@echo "Config dir: $(CONFIG_DIR)"
|
||||||
|
|
||||||
## uninstall: remove binary
|
## uninstall: remove binary and man page
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(INSTALL_DIR)/$(BINARY)
|
rm -f $(INSTALL_DIR)/$(BINARY)
|
||||||
|
rm -f /usr/share/man/man1/unitdore.1
|
||||||
@echo "Removed $(INSTALL_DIR)/$(BINARY)"
|
@echo "Removed $(INSTALL_DIR)/$(BINARY)"
|
||||||
|
|
||||||
## test: run all unit tests
|
## test: run all unit tests
|
||||||
|
|||||||
143
docs/unitdore.1
Normal file
143
docs/unitdore.1
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
.TH UNITDORE 1 "2026-04-08" "0.1.0" "User Commands"
|
||||||
|
.SH NAME
|
||||||
|
unitdore \- manage container units via systemd
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B unitdore
|
||||||
|
[\fB\-\-config\fR \fIpath\fR]
|
||||||
|
\fIcommand\fR
|
||||||
|
[\fIarguments\fR]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.B unitdore
|
||||||
|
bridges your container runtime (Podman, Docker) and systemd.
|
||||||
|
It discovers running containers, stores them in a config file, and generates
|
||||||
|
and manages systemd \fI.service\fR units for each one.
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
.BR \-\-config " " \fIpath\fR
|
||||||
|
Path to the units config file. Default: \fI/etc/unitdore/units.yaml\fR
|
||||||
|
.SH COMMANDS
|
||||||
|
.TP
|
||||||
|
.B syncup
|
||||||
|
Query all available runtimes for running containers and add any new ones to
|
||||||
|
the config. Reconciles existing entries: if a configured unit's container no
|
||||||
|
longer exists it is marked disabled with a reason.
|
||||||
|
.TP
|
||||||
|
.B install
|
||||||
|
Generate \fI.service\fR files for all enabled units and write them to the
|
||||||
|
appropriate systemd directory. Use \fB\-\-dry\-run\fR to preview without writing.
|
||||||
|
.TP
|
||||||
|
.B uninstall \fIname\fR
|
||||||
|
Disable, stop, and remove the service file for a specific unit.
|
||||||
|
.TP
|
||||||
|
.B startall
|
||||||
|
Run \fBsystemctl enable \-\-now\fR for all enabled, installed units in startup
|
||||||
|
order.
|
||||||
|
.TP
|
||||||
|
.B stopall
|
||||||
|
Run \fBsystemctl disable \-\-now\fR for all installed units in reverse startup
|
||||||
|
order.
|
||||||
|
.TP
|
||||||
|
.B start \fIname\fR
|
||||||
|
Start a specific unit by name (\fBsystemctl start\fR).
|
||||||
|
.TP
|
||||||
|
.B stop \fIname\fR
|
||||||
|
Stop a specific unit by name (\fBsystemctl stop\fR).
|
||||||
|
.TP
|
||||||
|
.B update \fIname\fR
|
||||||
|
Update a unit's config and recreate its service file.
|
||||||
|
.RS
|
||||||
|
.TP
|
||||||
|
.BR \-\-order " " \fIn\fR
|
||||||
|
Set the startup order.
|
||||||
|
.TP
|
||||||
|
.B \-\-enable
|
||||||
|
Enable the unit.
|
||||||
|
.TP
|
||||||
|
.B \-\-disable
|
||||||
|
Disable the unit.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
.B status
|
||||||
|
Print a summary table of all managed units showing runtime, user, enabled
|
||||||
|
state, installed state, systemd active state, and disabled reason.
|
||||||
|
.TP
|
||||||
|
.B list
|
||||||
|
Print a table of all tracked units including the path to each service file.
|
||||||
|
.TP
|
||||||
|
.B edit
|
||||||
|
Open the units config file in \fB$EDITOR\fR. Falls back to \fBnvim\fR,
|
||||||
|
\fBnano\fR, \fBvi\fR in that order.
|
||||||
|
.SH CONFIG FILE
|
||||||
|
.B Location:
|
||||||
|
\fI/etc/unitdore/units.yaml\fR
|
||||||
|
.PP
|
||||||
|
.nf
|
||||||
|
prefix: "" # prepended to all service names, e.g. "prod-"
|
||||||
|
suffix: "" # appended to all service names, e.g. "-svc"
|
||||||
|
service_user: "" # User= in [Service]; defaults to current OS user
|
||||||
|
|
||||||
|
units:
|
||||||
|
- name: nginx
|
||||||
|
runtime: podman # podman | docker
|
||||||
|
user: "" # empty = system unit; set for rootless user unit
|
||||||
|
command: "" # optional: override ExecStart
|
||||||
|
order: 1 # startup order (lower = earlier)
|
||||||
|
delay: 0s # delay after previous order group
|
||||||
|
enabled: true
|
||||||
|
disabled_reason: "" # auto-set by syncup reconciliation
|
||||||
|
.fi
|
||||||
|
.SH GENERATED SERVICE FILES
|
||||||
|
System units are written to \fI/etc/systemd/system/\fR and user units to
|
||||||
|
\fI~/.config/systemd/user/\fR.
|
||||||
|
Service names follow the pattern:
|
||||||
|
.PP
|
||||||
|
.RS
|
||||||
|
\fBunitdore-\fR[\fIprefix\fR]\fIname\fR[\fIsuffix\fR]\fB.service\fR
|
||||||
|
.RE
|
||||||
|
.SH EXAMPLES
|
||||||
|
Discover containers and install their service files:
|
||||||
|
.PP
|
||||||
|
.RS
|
||||||
|
.nf
|
||||||
|
sudo unitdore syncup
|
||||||
|
sudo unitdore install
|
||||||
|
sudo unitdore startall
|
||||||
|
.fi
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
Preview generated service files without writing:
|
||||||
|
.PP
|
||||||
|
.RS
|
||||||
|
sudo unitdore install \-\-dry\-run
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
Start a single container unit:
|
||||||
|
.PP
|
||||||
|
.RS
|
||||||
|
sudo unitdore start nginx
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
Change startup order and re\-apply service file:
|
||||||
|
.PP
|
||||||
|
.RS
|
||||||
|
sudo unitdore update nginx \-\-order 2
|
||||||
|
.RE
|
||||||
|
.SH FILES
|
||||||
|
.TP
|
||||||
|
.I /etc/unitdore/units.yaml
|
||||||
|
Default configuration file.
|
||||||
|
.TP
|
||||||
|
.I /etc/systemd/system/unitdore-*.service
|
||||||
|
Generated system unit files.
|
||||||
|
.TP
|
||||||
|
.I ~/.config/systemd/user/unitdore-*.service
|
||||||
|
Generated rootless user unit files.
|
||||||
|
.SH REQUIREMENTS
|
||||||
|
systemd; Podman and/or Docker (only installed runtimes are used).
|
||||||
|
Root is required for system units; the relevant user for rootless units.
|
||||||
|
.SH SEE ALSO
|
||||||
|
.BR systemctl (1),
|
||||||
|
.BR podman (1),
|
||||||
|
.BR docker (1)
|
||||||
|
.SH AUTHORS
|
||||||
|
Hein (Warky Devs) \(em https://warky.dev
|
||||||
2
go.mod
2
go.mod
@@ -1,6 +1,6 @@
|
|||||||
module github.com/warkanum/unitdore
|
module github.com/warkanum/unitdore
|
||||||
|
|
||||||
go 1.26.1
|
go 1.23.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||||
|
|||||||
43
pkg/arch/PKGBUILD
Normal file
43
pkg/arch/PKGBUILD
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# Maintainer: Hein (Warky Devs) <hein@warky.dev>
|
||||||
|
pkgname=unitdore
|
||||||
|
pkgver=0.0.4
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="A door you open and close for container units — manage containers via systemd"
|
||||||
|
arch=('x86_64' 'aarch64')
|
||||||
|
url="https://git.warky.dev/wdevs/unitdore"
|
||||||
|
license=('MIT')
|
||||||
|
depends=('systemd')
|
||||||
|
optdepends=(
|
||||||
|
'podman: Podman container runtime support'
|
||||||
|
'docker: Docker container runtime support'
|
||||||
|
)
|
||||||
|
makedepends=('go')
|
||||||
|
source=("$pkgname-$pkgver.zip::$url/archive/v$pkgver.zip")
|
||||||
|
sha256sums=('SKIP')
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd "$pkgname"
|
||||||
|
export CGO_ENABLED=0
|
||||||
|
go build \
|
||||||
|
-trimpath \
|
||||||
|
-ldflags "-X main.version=$pkgver" \
|
||||||
|
-o "$pkgname" .
|
||||||
|
}
|
||||||
|
|
||||||
|
check() {
|
||||||
|
cd "$pkgname"
|
||||||
|
go test ./...
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "$pkgname"
|
||||||
|
|
||||||
|
# Binary
|
||||||
|
install -Dm755 "$pkgname" "$pkgdir/usr/bin/$pkgname"
|
||||||
|
|
||||||
|
# Man page
|
||||||
|
install -Dm644 docs/unitdore.1 "$pkgdir/usr/share/man/man1/unitdore.1"
|
||||||
|
|
||||||
|
# Default config dir
|
||||||
|
install -dm755 "$pkgdir/etc/unitdore"
|
||||||
|
}
|
||||||
45
pkg/centos/unitdore.spec
Normal file
45
pkg/centos/unitdore.spec
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
Name: unitdore
|
||||||
|
Version: 0.1.0
|
||||||
|
Release: 1%{?dist}
|
||||||
|
Summary: Manage container units via systemd
|
||||||
|
|
||||||
|
License: MIT
|
||||||
|
URL: https://git.warky.dev/wdevs/unitdore
|
||||||
|
Source0: %{name}-%{version}.tar.gz
|
||||||
|
|
||||||
|
BuildRequires: golang >= 1.23
|
||||||
|
Requires: systemd
|
||||||
|
|
||||||
|
%description
|
||||||
|
Unitdore bridges your container runtime (Podman, Docker) and systemd.
|
||||||
|
It discovers running containers, stores them in a config file, and generates
|
||||||
|
and manages systemd .service units for each one.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup
|
||||||
|
|
||||||
|
%build
|
||||||
|
export CGO_ENABLED=0
|
||||||
|
go build \
|
||||||
|
-trimpath \
|
||||||
|
-ldflags "-X main.version=%{version}" \
|
||||||
|
-o %{name} .
|
||||||
|
|
||||||
|
%install
|
||||||
|
# Binary
|
||||||
|
install -Dm755 %{name} %{buildroot}%{_bindir}/%{name}
|
||||||
|
|
||||||
|
# Man page
|
||||||
|
install -Dm644 docs/unitdore.1 %{buildroot}%{_mandir}/man1/unitdore.1
|
||||||
|
|
||||||
|
# Config dir
|
||||||
|
install -dm755 %{buildroot}%{_sysconfdir}/unitdore
|
||||||
|
|
||||||
|
%files
|
||||||
|
%{_bindir}/%{name}
|
||||||
|
%{_mandir}/man1/unitdore.1*
|
||||||
|
%dir %{_sysconfdir}/unitdore
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Tue Apr 08 2026 Hein (Warky Devs) <hein@warky.dev> - 0.1.0-1
|
||||||
|
- Initial package
|
||||||
10
pkg/debian/control
Normal file
10
pkg/debian/control
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
Package: unitdore
|
||||||
|
Version: VERSION
|
||||||
|
Architecture: ARCH
|
||||||
|
Maintainer: Hein (Warky Devs) <hein@warky.dev>
|
||||||
|
Depends: systemd
|
||||||
|
Recommends: podman | docker.io
|
||||||
|
Description: A door you open and close for container units
|
||||||
|
Unitdore bridges your container runtime (Podman, Docker) and systemd.
|
||||||
|
It discovers running containers, stores them in a config file, and generates
|
||||||
|
and manages systemd .service units for each one.
|
||||||
Reference in New Issue
Block a user