1

I have a Qt application that I want to deploy as a deb package. I have been reading so many sources, all slightly different - most of what I did follows this How To: preparing an application for submission to the Ubuntu Software Centre

I must create a folder structure in /usr/share/My Company's Folder/ (The spaces and special characters in the path are an unfortunate requirement; the uppercase names also... the program was ported from windows).

/usr/share/My Company's Folder/MainProject/content

I created a package... and it seems to work, installs in the correct location, and surprisingly the program even works after that.

The Problem: I cannot use space in path names. I created an "install" file as shown in the link above. It does what it is supposed to - but I get a error if I am trying to place items in /usr/share/My Company's Folder/ - I could only get it to work by using /usr/share/MyCompanyFolder/ (no spaces or special characters".

Setup:

~/working_directory
  mainproject-1.0
     mainproject_1
        content
  mainproject-1.0.tar.gz

Inside mainproject-1.0 I ran

dh_make --copyright gpl -f ../mainproject-1.0.tar.gz 

select s, press enter... Then I modified the files in the debian folder created.

Created an "install" file in debian folder as well:

mainproject_1/* /usr/share/My Company's Folder/MainProject

Ran

dpkg-buildpackage -rfakeroot [email protected]

It works, creates installer, installer works...

But I cannot make a folder path with spaces, which is what I really need.

Note:

Tried unsuccessfully

"/usr/share/My\ Company\'s\ Folder/"
"/usr/share/My Company's Folder/"
/usr/share/My\ Company\'s\ Folder/
/usr/share/My\040Company's\040Folder/
/usr/share/My?Company's?Folder/

After much searching I found this info

you can't install files with space with dh_install (= debian/*install files)
you have to rename/install them explicitly in debian/rules with install, mv or cp
e.g. with dh tiny rules:

override_dh_install
     dh_install
     install -m 644 "fi le" "debian/tmp/usr/share/fi_le"

So I tried to add in the debian/rules file (showing line numbers)

12 %:
13  dh $@ 
14
15 override_dh_install:
16  dh_install
17  install -m 644 "debian/mainproject/usr/share/MyCompanyFolder" "debian/mainproject/usr/share/My Company's Folder"

latest error - with this command:

make[1]: Entering directory `/home/me/working_directory/mainproject-1.0'
dh_install
install -m 644 "My Company's Folder" "debian/mainproject/usr/share/MyCompanyFolder"
install: cannot stat `My Company's Folder': No such file or directory
make[1]: *** [override_dh_install] Error 1
make[1]: Leaving directory `/home/me/working_directory/mainproject-1.0'
make: *** [binary] Error 2
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2

Alternatively tried

12 %:
13  dh $@ 
14
15 override_dh_install:
16  dh_install
17  mv -r "debian/mainproject/usr/share/MyCompanyFolder" "debian/mainproject/usr/share/My Company's Folder"

And as result the folder structure inside debian looks correct, but I got errors about invalid folders...

objdump: 'debian/mainproject/usr/share/My': No such file
objdump: 'Company's': No such file
.....

mkdir then cp should have the same result as mv but unfortunately they kept placing one folder inside the other... * is seen as an actual name...

It really seems like I am getting nowhere.

Update: the answer to my question is, use the mv command in a postinstall file.

3
  • Line 17 in "alternatively tried" still needs spaces escaped. :)
    – Thomas Ward
    Oct 1, 2014 at 22:11
  • Story of my life... escaping spaces or placing ANY character results in the created folder getting that character... but when I look in debian folder, after the mv the folder structure is as expected - it works... Some other process that is performed after the mv/cp fails using the created folder
    – Thalia
    Oct 1, 2014 at 22:18
  • Everything using the path with spaces in it will need extra quoting on places using the name. This gets even worse when trying to read this name out of a file and use it -- "Lets see, was that three or four backslashes needed..." . You will be in a world of pain which never ends. Just don't use special characters like spaces and quotes in files or directories.
    – ubfan1
    Oct 2, 2014 at 4:50

3 Answers 3

1

It's a trick

There is directories layout:
mytest-0.1/debian/changelog
             /compat
             /control
             /install
             /rules
mytest-0.1/usr/share/my company/file_a
                               /file_b
                               /file_c'

Modify install file as follows

usr/share/           /usr/

Then packs your deb package

$mytest-0.1>dpkg-buildpackage -rfakeroot -uc -us -tc

Wish it can help you

2
  • Welcome to Ask Ubuntu! I recommend editing this answer to expand it with specific details about how to do this. It seems to me, that there are some important intermediate steps and explanations missing. (See also How do I write a good answer? for general advice about what sorts of answers are considered most valuable on Ask Ubuntu.) Sep 14, 2015 at 14:23
  • Thank you, I am not able to test right now - I will when I have a chance, it seems interesting.
    – Thalia
    Sep 14, 2015 at 14:56
1

Well, your final approach to use the postinstall is a good way to do so. But the reason, for the failure of your first try ,is actually that , the patch inside the Debian's install script (that is debian/rules debian/install also probably something else) is based on the Debian package, not the path you are thinking on your computer. It is the path compared with the whole package's folder. That's why it will give you the output that "no such file"

Sorry for my poor English, I wish I've got your problem right,and explained it well.

If I were you , I would reach for the Debian maintainers I knew for help, or see other packages packed by others. (You can get the sources of most of the packages easily in your terminal)

0

You last example didn't have the -p argument in the mkdir, so the directory did not get created in the specified path. The rest should have worked. You will have continuous problems with names containing special characters like quotes, but if the requirement is to install to such a name, your approach to simply do the install to a normal directory, then rename it at the end is a good one. You avoid all the nonsense with the required quoting in your script, and let the end uses deal with it. When the end users cry loud enough, maybe something reasonable will happen like not having to use such names on a Linux system, where they will cause problems.

3
  • I had the -p option... at some point there was also an option on mv... it just did not help. I removed them... the mkdir and mv or cp work inside the debian folder anyway. The subsequent steps fail...
    – Thalia
    Oct 1, 2014 at 21:41
  • I am giving up, will install in a path with no spaces. Would have been good to figure it out, at least learn more about the installer and how to set the rules file properly... If I ever figure it out I will post an update. I will give it a bit more time, if can't find something that works I will accept this answer.
    – Thalia
    Oct 2, 2014 at 15:06
  • I figured out how to create a postinst file to move / rename directories. But given the fact that spaces in names create so many issues... Giving up on spaces.
    – Thalia
    Oct 3, 2014 at 18:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .