Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Detect that package is being (re)installed

    Scheduled Pinned Locked Moved Development
    4 Posts 2 Posters 991 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.
    • D
      doktornotor Banned
      last edited by

      @pfSense devs: How do I do this? There are multiple packages where certain parts of the code should NOT be done at this phase. Such as, (re)starting the package-provided services zillion times in 15 seconds.

      1 Reply Last reply Reply Quote 0
      • jimpJ
        jimp Rebel Alliance Developer Netgate
        last edited by

        I'm not sure we have a good way to detect that.

        One might be able to leverage the return value from debug_backtrace() to find out how it's being called to make the decision though.

        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        1 Reply Last reply Reply Quote 0
        • D
          doktornotor Banned
          last edited by

          Yuck… @jimp:

          One might be able to leverage the return value from debug_backtrace() to find out how it's being called to make the decision though.

          Yuck…  :-\

          Found a different idea here:

          https://github.com/marcelloc/pfsense-packages/blob/master/config/snort/snort_post_install.php#L70
          https://github.com/marcelloc/pfsense-packages/blob/master/config/snort/snort.inc#L1068

          Not really sure how reliable that is...

          1 Reply Last reply Reply Quote 0
          • jimpJ
            jimp Rebel Alliance Developer Netgate
            last edited by

            If it's properly declared global before use it may be OK…

            Or there's the ever-popular "touch a flag file in /tmp/" style.

            Though if debug_backtrace() shows it being called by the package install code that would be pretty obvious, though I'd have to run some tests to find out how deep that goes. If the info is there it would definitely be the most reliable way. It's not really a bad way to go about it, it just needs some experimentation to derive the required tests/info.

            Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

            Need help fast? Netgate Global Support!

            Do not Chat/PM for help!

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.