Output a custom message during a dpkg package installation - installation

I am trying to install create a simple .deb dpkg package.
I have seen multiple packages where, during installation, they output custom messages like Reboot after installation! or Clearing caches or (in the case of iOS) Thanks to [developer]!.
I can't seem to find any way to replicate this myself during installation of my package.
How do I output a custom message to the terminal while dpkg is installing my package?

You can do this by providing a postinst script to the package.
See section 7.6 What is a Debian preinst, postinst, prerm, and postrm script?

Related

pip install psd-tools3 => FileNotFoundError: [Errno 2] No such file or directory

I was trying to install Ursina but I was having trouble getting all the required packages I needed to run my code properly. Come to find out, there's a package that refuses to install called 'psd-tools3' that won't install, no matter what I do.
I've been using cmd commands like 'pip install psd-tools3' and 'pip3 install psd-tools3' but no other commands work (i.e. 'sudo pip install psd-tools3' doesn't work because my PC doesn't know what 'sudo' means and doesn't run). I've tried installing required packages for this package, but nothing works. It just keeps giving me this error:
enter image description here
I would really appreciate the help with this problem. All I can really assume is that the Python file '_version' hasn't been created and that's what's throwing the whole program off. If there is a way to add this manually and then install it, I would appreciate steps to do that as well.
I was running this on a Lenovo Thinkpad (Windows 10) on Python 3.10 (I also have Python 3.8.3 but that was installed with the 3.10) and I made sure all packages and pip are up-to-date. Still having this problem and I don't know why.
Seems to me like the issue is on the side of the maintainers of psd-tools3.
For example, looking at the content of the latest source distribution on PyPI, we can see that it does not contain any _version.py file.
This needs to be solved by the project's maintainers, but they do not have a ticket tracker. On the other hand there seems to be an "Author" email address on the project's PyPI page as well as in the project's setup.py script.
A solution might be to clone the project's source code repository (with git), and try to install from the local clone.
Just simply try
pip install psd-tools3==1.9.0
Or
pip install psd-tools3==1.8.2
This should work on your pc as well. I was having same issue, and then I tried this It worked for me

Check if Chocolatey Package is Install or Upgrade

Is there any way, within the chocolateyinstall.ps1 file, to check if the process was triggered with the Upgrade command versus the Install command?
I tried using things like "choco list --lo" and "choco outdated", but those kept bringing up the package currently being installed - even if it hadn't yet been fully installed. I was hoping there was some sort of environment variable or something easy that I've overlooked.
Thanks!

Error: unable to locate package libpam-google-authenticator

I'm having trouble setting up 2 factor authentication in Ubuntu Server 18.04.
I'm following this tutorial: http://www.ubuntuboss.com/how-to-set-up-2-factor-authentication-in-ubuntu-server-18-04/
But on the first step when I try to install the package I get the package not found error as seen in the title.
sudo apt-get install libpam-google-authenticator
I have looked around to see if the package has been updated and goes by a different name and I am sure I have the most recent version of the package manager.
Has the package changed or is there anyway around this problem.
Had the same problem. Turned out it's because Ubuntu Server doesn't include the Universe Repository.
Add this line
sudo add-apt-repository universe
Then run the command again and it will install.
I found a way round this issue,
/tmp$ wget http://launchpadlibrarian.net/326531917/libpam-google-authenticator_20170702-1_amd64.deb
I was able to manually install it via this link and installed the missing dependencies the same way and was able to finish the tutorial as normal.

How to uninstall another package before installing current one with dpkg?

I need to uninstall another package before current package being installed, I tried put dpkg --remove com.foo.foo.another in preinst file, which doesn't work, it throws error dpkg: error: dpkg status database is locked by another process. How can I achieve that? Appreciate!
You can't do that. Dpkg locks its database for the whole process of installation - none of your scripts will be able to do anything like installing or uninstalling a package.
I had a similar problem. I wanted to install debian package manually during installation of my app. My app had a daemon which I launched as part of installation. To solve my problem in the daemon I waited until dpkg releases the lock and then installed the package. It's very important that I did it in a daemon as it's detached from postinst script, so dpkg can happily finish the installation.
You probably need to do something similar.

How to install eclim with brew or other package manager?

I am trying to install eclim to my system for code completion in vim. But as far as the eclim website has mentioned, the only installation method seems to be downloading the bin or source code to your system and executing the installation command manually. But I really hate installing stuff in this way as it pollutes your system directories. I tried to use brew but there doesn't seem to be a formula named "eclim". So is there really no way for me to install eclim with a package manager on mac?
I tried to use brew but there doesn't seem to be a formula named "eclim". So is there really no way for me to install eclim with a package manager on mac?
Write the missing formula.

Resources