Skip to content
6 changes: 5 additions & 1 deletion packages/astroarch-bridge/PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
# Maintainer: Mattia matto.astro@gmail.com
pkgname=astroarch-bridge
pkgver=0.3.15
pkgver=0.3.16
pkgrel=1
pkgdesc="Backend daemon per Astroarch Interface Android app - clone live INDI/Ekos/PHD2"
arch=('any')
url="https://github.com/Johannes1979I/astroarch-bridge"
license=('MIT')
# Post-installation script
install=astroarch-bridge.install
depends=(
tk
python-astropy
python-fastapi
python-numpy
python-pillow
python-pydantic
python-pydantic-settings
python-qrcode
python-watchdog
python-websockets
uvicorn
Expand Down
53 changes: 53 additions & 0 deletions packages/astroarch-bridge/astroarch-bridge.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Installation file for the astronaut and astronaut-kiosk users

post_install() {
USERS=("astronaut" "astronaut-kiosk")
PORTS=("8765" "8766")

for i in "${!USERS[@]}"; do
USERNAME="${USERS[$i]}"
PORT="${PORTS[$i]}"

# Check if the user exists
if ! id "$USERNAME" &>/dev/null; then
echo "==> The user $USERNAME does not exist, configuration ignored."
continue
fi

echo "==> Configuring astroarch-bridge for the user $USERNAME..."

HOME_DIR="/home/$USERNAME"

# 1. Folders
mkdir -p "$HOME_DIR/.config/astroarch-bridge"
mkdir -p "$HOME_DIR/Pictures/Ekos"

# 2. Enable the Systemd Linger
mkdir -p /var/lib/systemd/linger
touch "/var/lib/systemd/linger/${USERNAME}"

# 3. Network port (Systemd drop-in)
DROPIN_DIR="$HOME_DIR/.config/systemd/user/astroarch-bridge.service.d"
mkdir -p "$DROPIN_DIR"
cat <<EOF > "$DROPIN_DIR/override.conf"
[Service]
Environment=ASTROARCH_PORT=$PORT
EOF

# 4. Desktop Shortcut
mkdir -p "$HOME_DIR/Desktop"
ln -sf /usr/share/astroarch-bridge/desktop_dashboard/AstroarchBridge.desktop \
"$HOME_DIR/Desktop/AstroarchBridge.desktop"


chown -R "$USERNAME":"$USERNAME" "$HOME_DIR/.config"
chown -R "$USERNAME":"$USERNAME" "$HOME_DIR/Pictures/Ekos"

chown "$USERNAME":"$USERNAME" "$HOME_DIR/Desktop"
chown "$USERNAME":"$USERNAME" "$HOME_DIR/Desktop/AstroarchBridge.desktop"
done
}

post_upgrade() {
post_install
}