Draft of using ConditionNeedsUpdate instead of dropping a file; doesn't work

This commit is contained in:
Nate Graham
2026-04-25 15:07:04 -06:00
parent 95ee2c4930
commit 347c23a307
2 changed files with 9 additions and 30 deletions

View File

@@ -4,36 +4,14 @@
set -eu
. /usr/lib/os-release # gets us IMAGE_VERSION
VERSION_FILE="/var/lib/kde-linux/os-version-last-checked-for-new-preinstalled-apps"
if [ ! -f "$VERSION_FILE" ]; then
echo "$VERSION_FILE does not exist; creating it and doing nothing else."
echo "$IMAGE_VERSION" > "$VERSION_FILE"
exit 0
fi
PREVIOUSLY_CHECKED_OS_VERSION=$(cat "$VERSION_FILE")
echo "Previously checked OS version: $PREVIOUSLY_CHECKED_OS_VERSION"
echo "Currently booted OS version: $IMAGE_VERSION"
if [[ "$PREVIOUSLY_CHECKED_OS_VERSION" == "$IMAGE_VERSION" ]]; then
echo "Already checked for new apps on OS version $IMAGE_VERSION; not doing it again."
exit 0
fi
FACTORY_DIR="/usr/share/factory/var/lib/flatpak/app"
echo "Have not yet checked OS version $IMAGE_VERSION for new pre-installed apps. Looking in $FACTORY_DIR…"
REPO_CONFIG="/usr/share/factory/var/lib/flatpak/repo/config"
DEFAULT_REMOTE="flathub"
INSTALLED_APPS=$(flatpak list --app --columns=application)
CHANGE_HISTORY=$(flatpak history --columns=change,application)
echo "Looking in $FACTORY_DIR for new pre-installed apps that need installing…"
for APP in "$FACTORY_DIR"/*; do
# trim trailing slash
@@ -64,6 +42,3 @@ for APP in "$FACTORY_DIR"/*; do
echo "Installing $APP from $REMOTE…"
flatpak install --system --noninteractive --assumeyes --sideload-repo=/usr/share/factory/var/lib/flatpak/repo "$REMOTE" "$APP"
done
echo "$IMAGE_VERSION" > "$VERSION_FILE"
echo "Recording that we checked for new apps on OS version $IMAGE_VERSION."

View File

@@ -3,10 +3,14 @@
[Unit]
Description=Install any new Flatpak apps added to booted OS version
ConditionPathIsReadWrite=/etc
ConditionNeedsUpdate=|/etc
DefaultDependencies=no
After=local-fs.target
Before=sysinit.target systemd-update-done.service
Conflicts=shutdown.target
Before=shutdown.target
[Service]
Type=oneshot
ExecStart=/usr/lib/install-new-flatpaks
[Install]
WantedBy=multi-user.target