Rename a file during install of a Debian package
Solution 1
You cannot rename files using dh_install
(via the debian/install
). You will need to rename it during the debian/rules
"build" target before you get to the dh_install
invocation.
Solution 2
From Debian bug 245554 already mentioned:
this can already be easily solved if you use dh >= 9 and dh-exec. Just make your .install file executable, add #!/usr/bin/dh-exec to the top, and you can use "source => dest", like this:
#!/usr/bin/dh-exec
debian/default.conf => /etc/my-package/start.conf
Related videos on Youtube
somasekhar
Hi, I am Martin Ueding, a physicist (Dr.), Machine Learning researcher and programmer. My areas of interest are natural language processing, theoretical physics, numerical methods and high performance programming. My strongest programming languages are C++, Python, R and Bash.
Updated on September 18, 2022Comments
-
somasekhar over 1 year
I have a python script that I want to package for Debian. I use a debian/install file where I wrote
auto_dice.py /usr/bin/
Linitan then complains about the .py extension (script-with-language-extension).
I then changed it to
auto_dice.py /usr/bin/autodice.py
which causes an error because it interpreted
autodice.py
as a directory.How can I do the rename there? I do not want to rename my python script in the sources.
-
somasekhar about 13 yearsso it will be
build: \\ mv auto_dice.py autodice
? -
Kees Cook about 13 yearslikely the mv would happen in the target directory rather than the build directory, but yeah, you'd have to add the move before calling dh_install.
-
Matrix_Neo about 12 yearsFor a bug report requesting this feature, see bugs.debian.org/cgi-bin/bugreport.cgi?bug=245554
-
zerkms almost 11 years@Kees Cook: if you rename it in the target directory - would apt-get still be able to remove the file after package removal/upgrading?
-
Alexis Wilke over 2 yearsThis definitely is the best way. Not much to do really, just make sure you have
dh-exec
installed and then enter the list of files to be installed with a different name. Very easy!