Compare commits

..

No commits in common. "1bca4ee0f5335a47d8723342bd90b069e8152320" and "8bef7dc91751707a32263e64414e5b87ee9d18c2" have entirely different histories.

2 changed files with 42 additions and 55 deletions

View file

@ -1,32 +0,0 @@
#!/bin/env bash
set -euxo pipefail
# Clean
incus exec "$CNAME" -- \
rm -rf \
/etc/machine-id \
/var/cache/apt \
/var/log/journal
# Publish
incus stop "$CNAME"
incus config metadata show "$CNAME" > "$ARCHIVE"/metadata.yaml
# Get the current Unix timestamp
current_timestamp=$(date +%s)
# Calculate expiry date as current timestamp + 1 week (604800 seconds)
expiry_date=$((current_timestamp + 604800))
# Update metadata values
sed -i \
-e "s/creation_date: .*/creation_date: $current_timestamp/" \
-e "s/expiry_date: .*/expiry_date: $expiry_date/" \
-e "s#description: .*#description: $UPSTREAM_NAME v$UPSTREAM_VER on $IMAGE release $SERIAL#" \
-e "s/name: .*/name: $CNAME/" \
-e "s/serial: .*/serial: $SERIAL/" \
"$ARCHIVE"/metadata.yaml
incus config metadata edit "$CNAME" < "$ARCHIVE"/metadata.yaml
incus publish "$CNAME" \
--alias "$ALIAS" \
--public \
--quiet
incus rm "$CNAME"

View file

@ -14,36 +14,55 @@ SERIAL="1benoitjpnet"
CNAME="$UPSTREAM_NAME-$UPSTREAM_VER_DASH-$SERIAL-$DIST-$VER" CNAME="$UPSTREAM_NAME-$UPSTREAM_VER_DASH-$SERIAL-$DIST-$VER"
ALIAS="$UPSTREAM_NAME-$UPSTREAM_VER-$SERIAL" ALIAS="$UPSTREAM_NAME-$UPSTREAM_VER-$SERIAL"
cd "$WORKSPACE" cd $WORKSPACE
incus launch images:$IMAGE "$CNAME" --quiet incus launch images:$IMAGE $CNAME --quiet
wait_network "$CNAME" wait_network $CNAME
# Navidrome # Navidrome
incus exec "$CNAME" -- bash -c "apt update && \ incus exec $CNAME -- apt update
apt upgrade -y && \ incus exec $CNAME -- apt upgrade -y
apt install -y --no-install-recommends ffmpeg wget && \ incus exec $CNAME -- apt install -y --no-install-recommends ffmpeg wget
useradd -m -s /sbin/nologin -d /var/lib/navidrome navidrome && \ incus exec $CNAME -- useradd -m -s /sbin/nologin -d /var/lib/navidrome navidrome
install -d -o navidrome -g navidrome /opt/navidrome && \ incus exec $CNAME -- install -d -o navidrome -g navidrome /opt/navidrome
wget -q https://github.com/navidrome/navidrome/releases/download/v${UPSTREAM_VER}/navidrome_${UPSTREAM_VER}_linux_amd64.tar.gz \ incus exec $CNAME -- wget -q \
-O /tmp/Navidrome.tar.gz && \ "https://github.com/navidrome/navidrome/releases/download/v${UPSTREAM_VER}/navidrome_${UPSTREAM_VER}_linux_amd64.tar.gz" \
tar -xvzf /tmp/Navidrome.tar.gz -C /opt/navidrome/ && \ -O /tmp/Navidrome.tar.gz
chown -R navidrome:navidrome /opt/navidrome incus exec $CNAME -- tar -xvzf /tmp/Navidrome.tar.gz -C /opt/navidrome/
" incus exec $CNAME -- chown -R navidrome:navidrome /opt/navidrome
# Syncthing # Syncthing
incus exec "$CNAME" -- apt install -y --no-install-recommends syncthing incus exec $CNAME -- apt install -y --no-install-recommends syncthing
incus exec "$CNAME" -- cp /lib/systemd/system/syncthing\@.service /etc/systemd/system/ incus exec $CNAME -- cp /lib/systemd/system/syncthing\@.service /etc/systemd/system/
incus exec "$CNAME" -- sed -i \ incus exec $CNAME -- sed -i \
's/\(ExecStart=\/usr\/bin\/syncthing serve --no-browser --no-restart --logflags=0\)/\1 --gui-address=0.0.0.0:8384/' \ 's/\(ExecStart=\/usr\/bin\/syncthing serve --no-browser --no-restart --logflags=0\)/\1 --gui-address=0.0.0.0:8384/' \
/etc/systemd/system/syncthing\@.service /etc/systemd/system/syncthing\@.service
# Next manual steps https://www.navidrome.org/docs/installation/linux/#create-configuration-file # Next manual steps https://www.navidrome.org/docs/installation/linux/#create-configuration-file
laminarc run incus_publish \ # Clean
CNAME="$CNAME" \ incus exec $CNAME -- \
UPSTREAM=$UPSTREAM_NAME \ rm -rf \
UPSTREAM_VER=$UPSTREAM_VER \ /etc/machine-id \
IMAGE=$IMAGE \ /var/cache/apt \
SERIAL=$SERIAL \ /var/log/journal
ALIAS=$ALIAS
# Publish
incus stop $CNAME
incus config metadata show $CNAME > metadata.yaml
# Get the current Unix timestamp
current_timestamp=$(date +%s)
# Calculate expiry date as current timestamp + 1 week (604800 seconds)
expiry_date=$(($current_timestamp + 604800))
# Update metadata values
sed -i \
-e "s/creation_date: .*/creation_date: $current_timestamp/" \
-e "s/expiry_date: .*/expiry_date: $expiry_date/" \
-e "s#description: .*#description: $UPSTREAM_NAME v$UPSTREAM_VER on $IMAGE release $SERIAL#" \
-e "s/name: .*/name: $CNAME/" \
-e "s/serial: .*/serial: $SERIAL/" \
metadata.yaml
incus config metadata edit $CNAME < metadata.yaml
incus publish $CNAME --alias $ALIAS --public
incus rm $CNAME