- Debian
- Debian-based Linux Distributions, such as:
- Ubuntu
- Mint
- Netrunner
You wish to reinstall all packages that are dependent by a meta package.
Problem
If you execute the command:
Code: Select all
sudo apt-get install --reinstall kxstudio-meta-non-free
Expected Result
Apt-Get should install all the dependencies that are part of the meta package.
Solution
Follow the instructions to create and give apt-reinstall-meta an executable permission.
- Depending in your desktop environment:
- For GNOME/Unity, open gnome-terminal.
- For KDE, open up Konsole.
- For XFCE including the others, run xterm.
- As root, execute the following command into the terminal:
Enter your user password when prompted.Code: Select all
sudo nano /usr/local/bin/apt-reinstall-meta
- Copy the code into nano. In nano, hold Control + Shift and press V.
Do Ctrl+O and Ctrl+X to save and exit.Code: Select all
#!/bin/bash # Check if the user is in root mode if [ "$(id -u)" != "0" ] then echo "You must be rooted to install packages that are related to a meta package." 2>&1 exit 1 fi # Check to see if the meta package is not given by the user. if [ -z "$1" ] then echo "Example meta package: kubuntu-desktop" exit 1 fi # Search for packages that is depended by the meta-package # and ask the user if s/he wants to reinstall all the packages. apt-cache depends $1 | awk -F ":" '{print $2}' | \ sed '/^$/d' | xargs sudo apt-get \ install --reinstall --install-recommends exit 0
- Execute the command to give apt-reinstall-meta an executable permission.
Code: Select all
sudo chmod a+x /usr/local/bin/apt-reinstall-meta
- You're done. Now execute whatever meta package you want to reinstall. This will reinstall all of the dependent packages. One example is kxstudio-meta-non-free.
Code: Select all
sudo apt-reinstall-meta kxstudio-meta-non-free
This will check to see if you are running as root, check to be sure that the string is not empty, search for packages that is part of the meta package, and asks if you want to install them.
Credits