Hello,

I recently discovered that I can uninstall my package as non-privileged user, although I'm executing the below code in preUninstallationActionList. This code is working in the installation process but when uninstalling it does not work. how can I limit the uninstall operation only for privileged users ?

<actionGroup>
    <actionList>
        <throwError>
            <text>This installation cannot be run with superuser privileges.</text>
            <ruleList>
                <isTrue value="${installer_is_root_install}"/>
                <platformTest>
                    <type>linux</type>
                </platformTest>
            </ruleList>
        </throwError>
        <throwError>
            <text>This installation can only be run with administrative privileges.</text>
            <ruleList>
                <isFalse value="${installer_is_root_install}"/>
                <platformTest>
                    <type>windows</type>
                </platformTest>
            </ruleList>
        </throwError>
    </actionList>
</actionGroup>

asked 10 Apr '13, 08:52

Ronen's gravatar image

Ronen
16565656
accept rate: 0%


The uninstaller ignores action errors to avoid a situation where a small error in uninstallation actions prevents user from uninstalling the package.

What you can do is show a message and then exit the installer - for example:

<actionGroup> <actionList> <actionGroup> <actionList> <showWarning> <text>This installation cannot be run with superuser privileges.</text> </showWarning> <exit> <exitCode>1</exitCode> </exit> </actionList> <ruleList> <isTrue value="${installer_is_root_install}"/> <platformTest> <type>linux</type> </platformTest> </ruleList> </actionGroup> <actionGroup> <actionList> <showWarning> <text>This installation can only be run with administrative privileges.</text> </showWarning> <exit> <exitCode>1</exitCode> </exit> </actionList> <ruleList> <isFalse value="${installer_is_root_install}"/> <platformTest> <type>windows</type> </platformTest> </ruleList> </actionGroup> </actionList> </actionGroup>

link

answered 11 Apr '13, 02:52

wojciechka's gravatar image

wojciechka ♦♦
7.8k61122
accept rate: 26%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×54
×1

Asked: 10 Apr '13, 08:52

Seen: 868 times

Last updated: 11 Apr '13, 02:52