The stupid may misunderstand something. The blind may not notice some warnings.
Since deafness correlates with stupidity, Ubuntu users may not need to hack any dependencies.
They might be perfectly happy with ALSA and PulseAudio.
DISCLAIMER: This "howto" is useless and harmful for Ubuntu newbies. If they want to read something about "secret esoteric knowledge", they may better try a sort of "official documentation", for example: _http://www.debian.org/doc/debian-policy/ch-relationships.html#s7.6.2
EXPERIMENT 1: Replacing deb-packages, forcing their removal
To demonstrate the technique, we can create three simple deb-packages:
1. mumu,
2. mumu-client,
3. anti-mumu
The package "mumu-client" depends on "mumu".
The package "anti-mumu" is a replacement for "mumu".
The packages "mumu" and "mumu-client" will be installed with Debian package manager (dpkg).
Then, the package "mumu" will be replaced with "anti-mumu" without breaking dependencies.
Install "build-essential":
Code: Select all
$ sudo apt-get install build-essential
Create a folder for experiments:
Code: Select all
$ mkdir exp-mumu
$ cd exp-mumu
1. Package "mumu"
Create a simple script with a text editor of your choice:
Code: Select all
#!/bin/sh
echo Mumu
exit 0
Save it as "mumu.sh" and make it executable:
Code: Select all
$ chmod +x mumu.sh
Code: Select all
$ ls
mumu.sh
Code: Select all
$ ./mumu.sh
Mumu
Now we can create a Debian package "mumu"
Code: Select all
$ mkdir mumu
$ cd mumu
$ mkdir DEBIAN
We have to create a "control" file inside "DEBIAN" folder.
You can use a text editor of your choice (e.g. pluma, gedit, kate, leafpad, mousepad, etc.)
Code: Select all
$ pluma DEBIAN/control
This command will open the "pluma" text editor. Type there the package info (and save):
Code: Select all
Package: mumu
Version: 1.0
Architecture: all
Maintainer: mumu.org
Description: Print "Mumu" on the terminal
Create "usr/bin" folder inside "mumu"
Code: Select all
$ mkdir -p usr/bin/
Copy the script "mumu.sh" into "mumu/usr/bin/"
Code: Select all
$ cp ../mumu.sh usr/bin/
File list of the folder "mumu":
Code: Select all
$ tree -ifFC ../mumu
../mumu
../mumu/DEBIAN/
../mumu/DEBIAN/control
../mumu/usr/
../mumu/usr/bin/
../mumu/usr/bin/mumu.sh*
3 directories, 2 files
Code: Select all
$ tree -FC ../mumu
../mumu
├── DEBIAN/
│ └── control
└── usr/
└── bin/
└── mumu.sh*
3 directories, 2 files
Now we can build a debian package:
Code: Select all
$ cd ..
$ ls
mumu
Code: Select all
$ dpkg-deb --build mumu
dpkg-deb: building package `mumu' in `mumu.deb'.
Code: Select all
$ ls -1
mumu
mumu.deb
Code: Select all
$ dpkg-deb --info mumu.deb
new debian package, version 2.0.
size 602 bytes: control archive=224 bytes.
108 bytes, 5 lines control
Package: mumu
Version: 1.0
Architecture: all
Maintainer: mumu.org
Description: Print "Mumu" on the terminal
Now we can install "mumu.deb"
Code: Select all
$ sudo dpkg -i mumu.deb
This will install "mumu.sh" into /usr/bin
Code: Select all
$ ls /usr/bin | grep mumu
mumu.sh
You can run it from terminal:
Code: Select all
$ mumu.sh
Mumu
Now you can open the list of installed packages with a text editor of your choice, for example:
Code: Select all
$ pluma /var/lib/dpkg/status
and find there new package "mumu":
Code: Select all
$ cat /var/lib/dpkg/status | grep -A4 mumu
Package: mumu
Status: install ok installed
Maintainer: mumu.org
Architecture: all
Version: 1.0
Description: Print "Mumu" on the terminal
Notice that the file /var/lib/dpkg/status can also be hacked (you can edit dependencies, for example).
NOTE: mumu.deb can be easily deinstalled with "dpkg":
Code: Select all
$ sudo dpkg --purge mumu
2. Package "mumu-client"
Create a simple script with a text editor of your choice:
Code: Select all
#!/bin/sh
echo Mumu-Client
exit 0
Save it as "mumu-client.sh" and make it executable:
Code: Select all
$ chmod +x mumu-client.sh
Code: Select all
$ ls -1
mumu
mumu-client.sh
mumu.deb
mumu.sh
Code: Select all
$ ./mumu-client.sh
Mumu-Client
Now we can create a Debian package "mumu-client"
Code: Select all
$ mkdir mumu-client
$ cd mumu-client
$ mkdir DEBIAN
Create the "DEBIAN/control" with a text editor of your choice:
Code: Select all
$ pluma DEBIAN/control
Code: Select all
Package: mumu-client
Version: 1.0
Architecture: all
Maintainer: mumu.org
Depends: mumu
Description: Print "Mumu-Client" on the terminal
Create "usr/bin" folder inside "mumu-client"
Code: Select all
$ mkdir -p usr/bin/
Copy the script "mumu-client.sh" into "mumu-client/usr/bin/"
Code: Select all
$ cp ../mumu-client.sh usr/bin/
File list of the folder "mumu-client":
Code: Select all
$ tree -ifFC ../mumu-client
../mumu-client
../mumu-client/DEBIAN/
../mumu-client/DEBIAN/control
../mumu-client/usr/
../mumu-client/usr/bin/
../mumu-client/usr/bin/mumu-client.sh*
3 directories, 2 files
Code: Select all
$ tree -FC ../mumu-client
../mumu-client
├── DEBIAN/
│ └── control
└── usr/
└── bin/
└── mumu-client.sh*
3 directories, 2 files
Now we can build a debian package "mumu-client":
Code: Select all
$ cd ..
$ ls -1
mumu
mumu-client
mumu-client.sh
mumu.deb
mumu.sh
Code: Select all
$ dpkg-deb --build mumu-client
dpkg-deb: building package `mumu-client' in `mumu-client.deb'.
Code: Select all
$ ls -1
mumu
mumu-client
mumu-client.deb
mumu-client.sh
mumu.deb
mumu.sh
Code: Select all
$ dpkg-deb --info mumu-client.deb
new debian package, version 2.0.
size 632 bytes: control archive=243 bytes.
137 bytes, 7 lines control
Package: mumu-client
Version: 1.0
Architecture: all
Maintainer: mumu.org
Depends: mumu
Description: Print "Mumu-Client" on the terminal
Now we can install "mumu-client.deb"
Code: Select all
$ sudo dpkg -i mumu-client.deb
This will install "mumu-client.sh" into /usr/bin
Code: Select all
$ ls /usr/bin | grep mumu-client
mumu-client.sh
You can run it from terminal:
Code: Select all
$ mumu-client.sh
Mumu-Client
Code: Select all
$ cat /var/lib/dpkg/status | grep -A7 mumu-client
Package: mumu-client
Status: install ok installed
Maintainer: mumu.org
Architecture: all
Version: 1.0
Depends: mumu
Description: Print "Mumu-Client" on the terminal
NOTE: mumu-client.deb can be easily deinstalled with "dpkg":
Code: Select all
$ sudo dpkg --purge mumu-client
3. Package "anti-mumu"
Create a simple script with a text editor of your choice:
Code: Select all
#!/bin/sh
echo Anti-Mumu
exit 0
Save it as "anti-mumu.sh" and make it executable:
Code: Select all
$ chmod +x anti-mumu.sh
Code: Select all
$ ls -1
anti-mumu.sh
mumu
mumu-client
mumu-client.deb
mumu-client.sh
mumu.deb
mumu.sh
Code: Select all
$ ./anti-mumu.sh
Anti-Mumu
Now we can create a Debian package "anti-mumu"
Code: Select all
$ mkdir anti-mumu
$ cd anti-mumu
$ mkdir DEBIAN
Create the "DEBIAN/control" with a text editor of your choice:
Code: Select all
$ pluma DEBIAN/control
Code: Select all
Package: anti-mumu
Version: 1.0
Architecture: all
Maintainer: mumu.org
Conflicts: mumu
Replaces: mumu
Provides: mumu
Description: Print "Anti-Mumu" on the terminal
This means that the package "anti-mumu" is a replacement for "mumu".
Create "usr/bin" folder inside "anti-mumu"
Code: Select all
$ mkdir -p usr/bin/
Copy the script "anti-mumu.sh" into "anti-mumu/usr/bin/"
Code: Select all
$ cp ../anti-mumu.sh usr/bin/
File list of the folder "mumu":
Code: Select all
$ tree -ifFC ../anti-mumu
../anti-mumu
../anti-mumu/DEBIAN/
../anti-mumu/DEBIAN/control
../anti-mumu/usr/
../anti-mumu/usr/bin/
../anti-mumu/usr/bin/anti-mumu.sh*
3 directories, 2 files
Code: Select all
$ tree -FC ../anti-mumu
../anti-mumu
├── DEBIAN/
│ └── control
└── usr/
└── bin/
└── anti-mumu.sh*
3 directories, 2 files
Now we can build a debian package "anti-mumu":
Code: Select all
$ cd ..
$ ls -1
anti-mumu
anti-mumu.sh
mumu
mumu-client
mumu-client.deb
mumu-client.sh
mumu.deb
mumu.sh
Code: Select all
$ dpkg-deb --build anti-mumu
dpkg-deb: building package `anti-mumu' in `anti-mumu.deb'.
Code: Select all
$ ls -1
anti-mumu
anti-mumu.deb
anti-mumu.sh
mumu
mumu-client
mumu-client.deb
mumu-client.sh
mumu.deb
mumu.sh
Code: Select all
$ dpkg-deb --info anti-mumu.deb
new debian package, version 2.0.
size 644 bytes: control archive=257 bytes.
165 bytes, 9 lines control
Package: anti-mumu
Version: 1.0
Architecture: all
Maintainer: mumu.org
Conflicts: mumu
Replaces: mumu
Provides: mumu
Description: Print "Anti-Mumu" on the terminal
WARNING: The blind and the stupid are not supposed to install such packages.
If you believe that you are not blind and stupid, you may try to install "anti-mumu.deb"
Code: Select all
$ sudo dpkg -i anti-mumu.deb
Selecting previously unselected package anti-mumu.
dpkg: considering removing mumu in favour of anti-mumu ...
dpkg: yes, will remove mumu in favour of anti-mumu
(Reading database ... 271727 files and directories currently installed.)
Unpacking anti-mumu (from anti-mumu.deb) ...
Setting up anti-mumu (1.0) ...
"anti-mumu.deb" was installed,
"mumu.deb" was removed
In other words, "mumu.deb" was replaced with "anti-mumu.deb".
Code: Select all
$ ls -1 /usr/bin | grep mumu
anti-mumu.sh
mumu-client.sh
Code: Select all
$ anti-mumu.sh
Anti-Mumu
$ mumu-client.sh
Mumu-Client
$ mumu.sh
mumu.sh: command not found
Code: Select all
$ cat /var/lib/dpkg/status | grep -A9 anti-mumu
Package: anti-mumu
Status: install ok installed
Maintainer: mumu.org
Architecture: all
Version: 1.0
Replaces: mumu
Provides: mumu
Conflicts: mumu
Description: Print "Anti-Mumu" on the terminal
________________________________________
Now we can re-install "mumu.deb"
Code: Select all
$ sudo dpkg --force-conflicts -i mumu.deb
dpkg: regarding mumu.deb containing mumu:
anti-mumu conflicts with mumu
mumu (version 1.0) is to be installed.
dpkg: warning: ignoring conflict, may proceed anyway!
(Reading database ... 271727 files and directories currently installed.)
Unpacking mumu (from mumu.deb) ...
Setting up mumu (1.0) ...
Code: Select all
$ ls -1 /usr/bin | grep mumu
anti-mumu.sh
mumu-client.sh
mumu.sh
Code: Select all
$ sudo dpkg --purge anti-mumu
(Reading database ... 271727 files and directories currently installed.)
Removing anti-mumu ...
Code: Select all
$ ls -1 /usr/bin | grep mumu
mumu-client.sh
mumu.sh
Code: Select all
$ cat /var/lib/dpkg/status | grep -A3 mumu
Package: mumu
Status: install ok installed
Maintainer: mumu.org
Architecture: all
Version: 1.0
Description: Print "Mumu" on the terminal
--
Package: mumu-client
Status: install ok installed
Maintainer: mumu.org
Architecture: all
Version: 1.0
Depends: mumu
Description: Print "Mumu-Client" on the terminal
"mumu.deb" was re-installed
"anti-mumu.deb" was removed
"mumu-client" remains installed
If, for some strange reason, such experiments cause troubles, you may try a magic command:
Code: Select all
$ sudo apt-get -f install
See also:
Code: Select all
$ man apt-get | grep -A12 "fix-broken"
-f, --fix-broken
Fix; attempt to correct a system with broken dependencies in place.
This option, when used with install/remove, can omit any packages
to permit APT to deduce a likely solution. If packages are
specified, these have to completely correct the problem. The option
is sometimes necessary when running APT for the first time; APT
itself does not allow broken package dependencies to exist on a
system. It is possible that a system's dependency structure can be
so corrupt as to require manual intervention (which usually means
using dselect(1) or dpkg --remove to eliminate some of the
offending packages). Use of this option together with -m may
produce an error in some situations. Configuration Item:
APT::Get::Fix-Broken.