I've just created a small DEB package, just to see how it works. My file structure was the following:
~/temp/myapp_1.0
▶ tree
.
├── DEBIAN
│ ├── control
│ └── postinst
└── usr
└── bin
├── myapp
├── myapp.deps.json
├── myapp.dll
├── myapp.pdb
└── myapp.runtimeconfig.json
Basically, I created a Hello-World dotnet app.
My control
file is just:
Package: myapp
Version: 1.0
Maintainer: marcin
Architecture: all
Description: demo
and my postinst
is:
echo "echo (from postinst)"
I created DEB with dpkg-deb --build myapp_1.0
, and then installed it with sudo dpkg -i myapp_1.0.deb
I see that /usr/bin
contains all my app's files as expected, and the app works when invoked with myapp
.
Then, I decided to remove it with sudo apt remove myapp
. It removed all of the app's files from /usr/bin
. My question is: how did it know which files belong to it? I thought it would remove just the binary /usr/bin/myapp
, but it also got rid of the myapp.dll
, and all the rest.
Is it always the case that apt remove something
will remove the program completely (and apt purge something
will also remove all configs)? How does it know where to look? Will it also remove files that my app would create during runtime?