On 26/11/20 08:31, Michael D. Setzer II wrote: > On 25 Nov 2020 at 11:58, Mayavimmer wrote: > >> How do I sync rpm packages with another computer? >> I have a list of the remote's rpms generated with "rpm -qa". >> I expect to have to modify a couple of packages in the list due to >> hardware dependent rpms like xorg. >> Otherwise it should be a simple matter of downloading the rpms from the >> edited list and then installing them. >> Or is there already a script for this? > > Rather than a using rpm -qa list, I use > rpm --qf "%{NAME}.%{ARCH}\n" -qa > > I use a script listrpm to make a listing > #!/usr/bin/bash > rpm --qf "%{NAME}.%{ARCH}\n" -qa | sort | grep -v gpg-pubkey > > installed_pkgs"$(date +%F)".txt > > Then you can copy the file, and run dnf install with that piped into it. > Also, do this if I create a machine with a clean install of an OS, and then > want to add the missing packages. Sometimes get errors on packages that > might no longer be available, but then just delete those lines from file. > > Good Luck.
Ah, good idea to exclude gpg-pubkey. Why only use NAME and ARCH? Anyway, summary of interesting points, so far: * There is probably no ready made script, then write one. * Let's call the two hosts Master and Clone. * Should probably install Master-only packages first, then remove Clone-only ones. * Clone the Master repo configuration, possibly removing Clone-only repos? .... But could have problems removing rpms! .... And may not want redundant repos?? .... Maybe solve this problem by inverting the order like this: ........ 1. Remove Clone-only rpms (ugh, could remove too much!) ........ 2. Zero Clone repo config and replace with Master repo config ........ 3. Install * Prepare rpmlist for easy parsing, maybe use the tilde char: .... rpm -qa --qf="%{NAME}-%{EVR}.%{ARCH}\n" # almost same as rpm -qa .... rpm -qa --qf="%{NAME}~%{EVR}~%{ARCH}\n" # almost same as rpm -qa * Identify special rpms to exclude from cloning: .... *-gpg-pubkey-* .... Some xorg rpm tied to a non default graphics card .... Other rpms that were installed non from repo in Master * What to do when downgrading some rpms?? * Ok, here is a first attempt at the install-first-then-remove case: .... 1. Ensure Clone repo config is the same Master's. .... 2. Master # rpm -qa --qf="%{NAME}~%{EVR}~%{ARCH}\n" ........ | sort | grep -v gpg-pubkey > master-rpms ........ # Note: still not exactly the same as rpm -qa .... 3. Clone # rpm -qa --qf="%{NAME}~%{EVR}~%{ARCH}\n" ........ | sort | grep -v gpg-pubkey > clone-rpms .... 4. Compare the two lists in various ways, using tilde fields. .... 4. Edit master-rpms to eliminate unwanted rpms. .... 5. Clone # dnf install $(<edited-master-rpms) .... # Now do it again to compare .... 6. Clone # rpm -qa --qf="%{NAME}~%{EVR}~%{ARCH}\n" ........ | sort | grep -v gpg-pubkey > clone-rpms .... 7. Clone # vimdiff edited-master-rpms clone-rpms .... 8. Repeat until all differences are sorted out _______________________________________________ users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org