umorpha-boxes/modules/service-eclipse-follower.sh

60 lines
1.5 KiB
Bash
Raw Normal View History

2024-01-22 19:01:35 +00:00
#!/hint/bash -euE
# Copyright (C) 2024 Umorpha Systems
# SPDX-License-Identifier: AGPL-3.0-or-later
packages+=(
make
pandoc-cli
wdiff
git
lua
)
post_install+=(20:eclipse-follower:post_install)
eclipse-follower:post_install() {
local arg_mountpoint=$1
2024-01-22 21:48:37 +00:00
install -d "$arg_mountpoint/var/lib/eclipse/.ssh"
ln -s /etc/umorpha-secrets/eclipse-sshkey.priv "$arg_mountpoint/var/lib/eclipse/.ssh/id_ed25519"
ln -s /etc/umorpha-secrets/eclipse-sshkey.pub "$arg_mountpoint/var/lib/eclipse/.ssh/id_ed25519.pub"
install -Dm644 /dev/stdin "$arg_mountpoint/etc/tmpfiles.d/eclipse-ssh.conf" <<-'EOF'
# Copyright (C) 2024 Umorpha Systems
# SPDX-License-Identifier: AGPL-3.0-or-later
Z /var/lib/eclipse - eclipse eclipse
EOF
2024-01-22 19:01:35 +00:00
install -Dm755 /dev/stdin "$arg_mountpoint/etc/eclipse/follower.sh" <<-'EOF'
#!/bin/sh
# Copyright (C) 2024 Umorpha Systems
# SPDX-License-Identifier: AGPL-3.0-or-later
set -ex
job=$(eclipse-pick)
eclipse-run "$job"
EOF
install -Dm755 /dev/stdin "$arg_mountpoint/etc/systemd/system/eclipse-follower.service" <<-'EOF'
# Copyright (C) 2024 Umorpha Systems
# SPDX-License-Identifier: AGPL-3.0-or-later
[Unit]
Description=Eclipse CI follower process
Wants=network-online.target
After=network-online.target
[Service]
User=eclipse
Group=eclipse
Type=oneshot
2024-01-22 19:18:56 +00:00
Environment="GIT_SSH_COMMAND=ssh -i /etc/umorpha-secrets/eclipse-sshkey.priv"
2024-01-22 19:01:35 +00:00
ExecStart=/etc/eclipse/follower.sh
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl --root="$arg_mountpoint" enable eclipse-follower.service
}