Execute command after dpkg installation?











up vote
0
down vote

favorite
1












I just got inspired of this project:




http://www.opendesktop.org/content/show.php?content=145633




Well , i wanted to do a similar thing , after dpkg places something new in /usr/share/applications directory , but where should my script point to , and the parameter to pass in ?










share|improve this question




























    up vote
    0
    down vote

    favorite
    1












    I just got inspired of this project:




    http://www.opendesktop.org/content/show.php?content=145633




    Well , i wanted to do a similar thing , after dpkg places something new in /usr/share/applications directory , but where should my script point to , and the parameter to pass in ?










    share|improve this question


























      up vote
      0
      down vote

      favorite
      1









      up vote
      0
      down vote

      favorite
      1






      1





      I just got inspired of this project:




      http://www.opendesktop.org/content/show.php?content=145633




      Well , i wanted to do a similar thing , after dpkg places something new in /usr/share/applications directory , but where should my script point to , and the parameter to pass in ?










      share|improve this question















      I just got inspired of this project:




      http://www.opendesktop.org/content/show.php?content=145633




      Well , i wanted to do a similar thing , after dpkg places something new in /usr/share/applications directory , but where should my script point to , and the parameter to pass in ?







      installation dpkg






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 18 '12 at 17:48









      Bruno Pereira

      58.9k26177203




      58.9k26177203










      asked Sep 30 '11 at 12:09









      daisy

      2,796124171




      2,796124171






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          5
          down vote



          accepted










          If the script do not takes parameters, add a file in /etc/apt/apt.conf.d/, for example 92local (numbers are used to force execution order of scripts in that directory), with the following content:



          DPkg::Post-Invoke { "/path-to/my-script"; };


          and remember to make it executable.



          Cannot find right now information on how to pass parameter or input to the script.

          If can be of help, when running apt on command line, you should find the command line in the environment variable SUDO_COMMAND.






          share|improve this answer





















          • i modified that script to find all the .desktop files automatically , so far my problem is resolved , thanks !
            – daisy
            Sep 30 '11 at 23:44


















          up vote
          0
          down vote













          I have found a way to get the commandline of the APT command executed:



          Create a file /etc/apt/apt.conf.d/90my_dpkg_post_invoke with content



          DPkg::Post-Invoke { "/usr/local/lib/my_dpkg_post_invoke.sh"; }


          Create an executable file /usr/local/lib/my_dpkg_post_invoke.sh with content



          #!/bin/bash
          APTPID=$( ps -ho ppid "${PPID}" )
          APTPID="${APTPID## }" # trim leading spaces
          APTCMD=$( ps -ho args "${APTPID}" )
          APTCMD="${APTCMD## }" # trim leading spaces
          echo "#### APT Command: ${APTCMD}"


          Now you can extend the executable file with a test if the ${APTCMD} contains a string you want to trigger an action for.






          share|improve this answer





















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f63717%2fexecute-command-after-dpkg-installation%23new-answer', 'question_page');
            }
            );

            Post as a guest
































            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            5
            down vote



            accepted










            If the script do not takes parameters, add a file in /etc/apt/apt.conf.d/, for example 92local (numbers are used to force execution order of scripts in that directory), with the following content:



            DPkg::Post-Invoke { "/path-to/my-script"; };


            and remember to make it executable.



            Cannot find right now information on how to pass parameter or input to the script.

            If can be of help, when running apt on command line, you should find the command line in the environment variable SUDO_COMMAND.






            share|improve this answer





















            • i modified that script to find all the .desktop files automatically , so far my problem is resolved , thanks !
              – daisy
              Sep 30 '11 at 23:44















            up vote
            5
            down vote



            accepted










            If the script do not takes parameters, add a file in /etc/apt/apt.conf.d/, for example 92local (numbers are used to force execution order of scripts in that directory), with the following content:



            DPkg::Post-Invoke { "/path-to/my-script"; };


            and remember to make it executable.



            Cannot find right now information on how to pass parameter or input to the script.

            If can be of help, when running apt on command line, you should find the command line in the environment variable SUDO_COMMAND.






            share|improve this answer





















            • i modified that script to find all the .desktop files automatically , so far my problem is resolved , thanks !
              – daisy
              Sep 30 '11 at 23:44













            up vote
            5
            down vote



            accepted







            up vote
            5
            down vote



            accepted






            If the script do not takes parameters, add a file in /etc/apt/apt.conf.d/, for example 92local (numbers are used to force execution order of scripts in that directory), with the following content:



            DPkg::Post-Invoke { "/path-to/my-script"; };


            and remember to make it executable.



            Cannot find right now information on how to pass parameter or input to the script.

            If can be of help, when running apt on command line, you should find the command line in the environment variable SUDO_COMMAND.






            share|improve this answer












            If the script do not takes parameters, add a file in /etc/apt/apt.conf.d/, for example 92local (numbers are used to force execution order of scripts in that directory), with the following content:



            DPkg::Post-Invoke { "/path-to/my-script"; };


            and remember to make it executable.



            Cannot find right now information on how to pass parameter or input to the script.

            If can be of help, when running apt on command line, you should find the command line in the environment variable SUDO_COMMAND.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Sep 30 '11 at 14:01









            enzotib

            61.6k5128152




            61.6k5128152












            • i modified that script to find all the .desktop files automatically , so far my problem is resolved , thanks !
              – daisy
              Sep 30 '11 at 23:44


















            • i modified that script to find all the .desktop files automatically , so far my problem is resolved , thanks !
              – daisy
              Sep 30 '11 at 23:44
















            i modified that script to find all the .desktop files automatically , so far my problem is resolved , thanks !
            – daisy
            Sep 30 '11 at 23:44




            i modified that script to find all the .desktop files automatically , so far my problem is resolved , thanks !
            – daisy
            Sep 30 '11 at 23:44












            up vote
            0
            down vote













            I have found a way to get the commandline of the APT command executed:



            Create a file /etc/apt/apt.conf.d/90my_dpkg_post_invoke with content



            DPkg::Post-Invoke { "/usr/local/lib/my_dpkg_post_invoke.sh"; }


            Create an executable file /usr/local/lib/my_dpkg_post_invoke.sh with content



            #!/bin/bash
            APTPID=$( ps -ho ppid "${PPID}" )
            APTPID="${APTPID## }" # trim leading spaces
            APTCMD=$( ps -ho args "${APTPID}" )
            APTCMD="${APTCMD## }" # trim leading spaces
            echo "#### APT Command: ${APTCMD}"


            Now you can extend the executable file with a test if the ${APTCMD} contains a string you want to trigger an action for.






            share|improve this answer

























              up vote
              0
              down vote













              I have found a way to get the commandline of the APT command executed:



              Create a file /etc/apt/apt.conf.d/90my_dpkg_post_invoke with content



              DPkg::Post-Invoke { "/usr/local/lib/my_dpkg_post_invoke.sh"; }


              Create an executable file /usr/local/lib/my_dpkg_post_invoke.sh with content



              #!/bin/bash
              APTPID=$( ps -ho ppid "${PPID}" )
              APTPID="${APTPID## }" # trim leading spaces
              APTCMD=$( ps -ho args "${APTPID}" )
              APTCMD="${APTCMD## }" # trim leading spaces
              echo "#### APT Command: ${APTCMD}"


              Now you can extend the executable file with a test if the ${APTCMD} contains a string you want to trigger an action for.






              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                I have found a way to get the commandline of the APT command executed:



                Create a file /etc/apt/apt.conf.d/90my_dpkg_post_invoke with content



                DPkg::Post-Invoke { "/usr/local/lib/my_dpkg_post_invoke.sh"; }


                Create an executable file /usr/local/lib/my_dpkg_post_invoke.sh with content



                #!/bin/bash
                APTPID=$( ps -ho ppid "${PPID}" )
                APTPID="${APTPID## }" # trim leading spaces
                APTCMD=$( ps -ho args "${APTPID}" )
                APTCMD="${APTCMD## }" # trim leading spaces
                echo "#### APT Command: ${APTCMD}"


                Now you can extend the executable file with a test if the ${APTCMD} contains a string you want to trigger an action for.






                share|improve this answer












                I have found a way to get the commandline of the APT command executed:



                Create a file /etc/apt/apt.conf.d/90my_dpkg_post_invoke with content



                DPkg::Post-Invoke { "/usr/local/lib/my_dpkg_post_invoke.sh"; }


                Create an executable file /usr/local/lib/my_dpkg_post_invoke.sh with content



                #!/bin/bash
                APTPID=$( ps -ho ppid "${PPID}" )
                APTPID="${APTPID## }" # trim leading spaces
                APTCMD=$( ps -ho args "${APTPID}" )
                APTCMD="${APTCMD## }" # trim leading spaces
                echo "#### APT Command: ${APTCMD}"


                Now you can extend the executable file with a test if the ${APTCMD} contains a string you want to trigger an action for.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 4 hours ago









                Jeroen Vermeulen - MageHost

                22026




                22026






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f63717%2fexecute-command-after-dpkg-installation%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest




















































































                    Popular posts from this blog

                    How to send String Array data to Server using php in android

                    Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

                    Is anime1.com a legal site for watching anime?