Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a custom binary package. I am creating the package from a Makefile . Here is the code for the same :

FIREFOX_DIR = /usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}

build:
    mkdir -p $(app_source_dir)
    mkdir -p $(app_source_dir)/opt/Sapience/config
    mkdir -p $(app_source_dir)/opt/Sapience/firefox
    mkdir -p $(app_source_dir)/$(FIREFOX_DIR)/firefox-extension@sapience
    mkdir -p $(app_source_dir)/usr/bin
    mkdir -p $(app_source_dir)/DEBIAN
    cp $(RT)/../bin/sapiencecollector $(app_source_dir)/usr/bin/.
    cp $(RT)/../DEBIAN/control $(app_source_dir)/DEBIAN/.
    cp $(RT)/../DEBIAN/postinst $(app_source_dir)/DEBIAN/.
    cp $(RT)/../DEBIAN/prerm $(app_source_dir)/DEBIAN/.
    cp $(RT)/../config/conf.ini $(app_source_dir)/opt/Sapience/config/.
    cp -r $(RT)/../external/firefox-extension/* $(app_source_dir)/$(FIREFOX_DIR)/firefox-extension@sapience/.
    dpkg --build $(app_source_dir) $(app_name)-$(version).deb

I need to create a directory named Sapience inside /opt as part of my installation. In order to do that I am creating the same directory hierarchy inside the package directory. /opt is already present in Linux & I do not want to create it again on the machine I install the package. The package gets installed properly. When I try to remove the package using the command dpkg -r <pkgname> I get the following error : dpkg:warning : while removing , /opt directory is not empty so not removed.

I do not want to remove the /opt directory but still dpkg is trying to remove it. Could anyone let me know what changes I need to make to avoid dpkg to remove the directories.

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.