diff options
| author | herkulessi <git@herkulessi.de> | 2026-04-30 15:20:20 +0200 |
|---|---|---|
| committer | herkulessi <git@herkulessi.de> | 2026-04-30 15:20:20 +0200 |
| commit | b9f85117b0ded60e424acde5b5fa05fcab103323 (patch) | |
| tree | 1d5fd30bca9515372fc45824c4c6f7a8b2b24ffd | |
| parent | d0b2b663483870a78f3d9e3b8cda5bf1ea2f6f58 (diff) | |
Error on empty Package list
| -rwxr-xr-x | pkgsync-ng-nt | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/pkgsync-ng-nt b/pkgsync-ng-nt index e7a40a5..d8c8d8f 100755 --- a/pkgsync-ng-nt +++ b/pkgsync-ng-nt @@ -47,6 +47,13 @@ if [ "$OLD_VERSION" -ge "$NEW_VERSION" ]; then exit 0 fi +DO_INSTALL="$(< /etc/packages.yaml yq -r '.install | to_entries | map(.value) | add | map(tostring) | join(", ")')" +if [ -z "$DO_INSTALL" ]; then + printf "Package List was empty. Refusing operation for fear of malformed configuration." + exit 1 +fi +DONT_INSTALL="$(< /etc/packages.yaml yq -r '.remove | to_entries | map(.value) | add | map(tostring) | join(", ")')" + cat > "$PACKAGE_NAME" << EOF Section: misc Priority: optional @@ -54,8 +61,8 @@ Standards-Version: 3.9.2 Package: $PACKAGE_NAME Version: $NEW_VERSION -Depends: $(< /etc/packages.yaml yq -r '.install | to_entries | map(.value) | add | map(tostring) | join(", ")'), apt, coreutils, equivs, findutils, yq -Conflicts: $(< /etc/packages.yaml yq -r '.remove | to_entries | map(.value) | add | map(tostring) | join(", ")') +Depends: $DO_INSTALL, apt, coreutils, equivs, findutils, yq +Conflicts: $DONT_INSTALL Description: Metapackage for all needed packages. This is a dummy package, depending on other packages to make Package Management easier. EOF |
