• Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    bug: cacert-update.service

    Scheduled Pinned Locked Moved Mervis
    1 Posts 1 Posters 173 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      ladmanj
      last edited by

      Na našich dvou neuronech jsem opravil tuto chybu. Asi se o ní už ví, ale pro jistotu posílám sem.

      #!/bin/bash
      #
      # get installed version of ca-certificate package
      # write the version into virtual registers 4200-4201
      #
      # if used with --update, try update/upgrade package
      
      CA_REG1=4300
      CA_REG2=4301
      VREG_DIR=/run/unipi-plc/virtual-regs
      
      if [[ "$TRIGGER_UNIT" =~ ".timer" ]]; then
          apt-get update -y -qq || true
          apt-get install -y -q ca-certificates
      fi
      
      CA_VERSION=$(dpkg-query --show --showformat '${Version}' ca-certificates 2>/dev/null)
      
      # OPRAVA: Odřízne vše od prvního znaku, který není číslice (např. ~deb12u2)
      CA_VERSION="${CA_VERSION%%[^0-9]*}"
      
      if [ -z "$CA_VERSION" ]; then
          rm -f "$VREG_DIR/$CA_REG1"
          rm -f "$VREG_DIR/$CA_REG2" # Zde byla dříve chyba s redundantním /virtual-regs/
      else
          mkdir -p "$VREG_DIR"
          if cd "$VREG_DIR"; then
              echo "$((CA_VERSION/10000))" > "$VREG_DIR/$CA_REG1"
              echo "$((CA_VERSION%10000))" > "$VREG_DIR/$CA_REG2"
          fi
      fi
      
      1 Reply Last reply
      Reply Quote 0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • First post
        Last post