Salve apt- dependências no arquivo de texto

1

Eu gostaria de salvar a lista com dependências para programas instalados em um arquivo de texto. O motivo pelo qual eu gostaria de fazer isso é, por exemplo, se eu for instalar um meta-pacote, que por sua vez dependeria de vários outros pacotes, que não são removidos removendo-se o meta-pacote sozinho.

Eu sei que posso fazer isso com:

sudo apt-get install kubuntu-desktop | tee log_file.txt

Mas isso salva toda a saída do comando. Eu gostaria de ter apenas uma lista com o pacote instalado e dependências para que eu possa usar este comando para remover o pacote e as dependências:

 sudo apt remove $(cat log_file.txt)

Eu acho que deveria ser possível, é apenas além do meu conhecimento de Bash e shell-scripting. Então dicas seriam apreciadas.

    
por Mitra Mai 26.11.2015 / 10:35

1 resposta

0

Usando apt-cache e awk

apt-cache showpkg kubuntu-desktop | awk '/Dependencies:/,/Provides:/ {for(i=1;i<NF;i++) {if(i%3==0) {print $i}}}' | tee log_file.txt

Exemplo (com ubuntu-desktop , desculpe)

% apt-cache showpkg ubuntu-desktop | awk '/Dependencies:/,/Provides:/ {for(i=1;i<NF;i++) {if(i%3==0) {print $i}}}' > out     

% cat out
alsa-base
alsa-utils
anacron
at-spi2-core
baobab
bc
ca-certificates
checkbox-gui
dmz-cursor-theme
doc-base
eog
evince
file-roller
fonts-dejavu-core
fonts-freefont-ttf
foomatic-db-compressed-ppds
gedit
genisoimage
ghostscript-x
gnome-calculator
gnome-font-viewer
gnome-menus
gnome-power-manager
gnome-screenshot
gnome-session-canberra
gnome-system-log
gnome-system-monitor
gstreamer1.0-alsa
gstreamer1.0-plugins-base-apps
gstreamer1.0-pulseaudio
gucharmap
gvfs-bin
inputattach
language-selector-gnome
libatk-adaptor
libnotify-bin
libpam-systemd
libsasl2-modules
lightdm
memtest86+
nautilus
nautilus-sendto
notify-osd
openprinting-ppds
printer-driver-pnm2ppa
pulseaudio
rfkill
seahorse
software-center
software-properties-gtk
ssh-askpass-gnome
system-config-printer-gnome
ubuntu-artwork
ubuntu-drivers-common
ubuntu-release-upgrader-gtk
ubuntu-session
ubuntu-settings
ubuntu-sounds
ubuntu-sso-client-qt
unity
unity-control-center
unity-greeter
unity-settings-daemon
unzip
update-manager
update-notifier
wireless-tools
wpasupplicant
xdg-user-dirs
xdg-user-dirs-gtk
xdiagnose
xkb-data
xorg
yelp
zenity
zip
acpi-support
activity-log-manager
aisleriot
app-install-data-partner
apport-gtk
avahi-autoipd
avahi-daemon
bluez
bluez-cups
branding-ubuntu
brasero
brltty
cheese
cups
cups-bsd
cups-client
cups-filters
deja-dup
empathy
example-content
firefox
fonts-droid
fonts-guru
fonts-kacst-one
fonts-khmeros-core
fonts-lao
fonts-liberation
fonts-lklug-sinhala
fonts-nanum
fonts-sil-abyssinica
fonts-sil-padauk
fonts-takao-pgothic
fonts-thai-tlwg
fonts-tibetan-machine
gcc
gnome-accessibility-themes
gnome-bluetooth
gnome-disk-utility
gnome-keyring
gnome-mahjongg
gnome-mines
gnome-orca
gnome-screensaver
gnome-sudoku
gnome-terminal
gnupg-agent
gvfs-fuse
hplip
ibus
ibus-gtk
ibus-gtk3
ibus-table
im-config
kerneloops-daemon
landscape-client-ui-install
laptop-detect
libgail-common
libnss-mdns
libpam-gnome-keyring
libproxy1-plugin-gsettings
libproxy1-plugin-networkmanager
libqt4-sql-sqlite
libreoffice-calc
libreoffice-gnome
libreoffice-impress
libreoffice-math
libreoffice-ogltrans
libreoffice-pdfimport
libreoffice-style-human
libreoffice-writer
libwmf0.2-7-gtk
make
mousetweaks
nautilus-share
network-manager-gnome
network-manager-pptp
network-manager-pptp-gnome
onboard
overlay-scrollbar
pcmciautils
plymouth-theme-ubuntu-logo
policykit-desktop-privileges
printer-driver-brlaser
printer-driver-c2esp
printer-driver-foo2zjs
printer-driver-min12xxw
printer-driver-ptouch
printer-driver-pxljr
printer-driver-sag-gdi
printer-driver-splix
pulseaudio-module-bluetooth
pulseaudio-module-x11
python3-aptdaemon.pkcompat
qt-at-spi
remmina
rhythmbox
rhythmbox-plugin-magnatune
shotwell
simple-scan
sni-qt
speech-dispatcher
telepathy-idle
thunderbird
thunderbird-gnome-support
totem
transmission-gtk
ttf-ancient-fonts-symbola
ttf-indic-fonts-core
ttf-ubuntu-font-family
ubuntu-docs
unity-webapps-common
usb-creator-gtk
vino
whoopsie
xcursor-themes
xdg-utils
xterm
xul-ext-ubufox
zeitgeist-core
zeitgeist-datahub
    
por A.B. 26.11.2015 / 10:38