File tree Expand file tree Collapse file tree
Fedora Atomic Desktops/install-removed-packages Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # !/usr/bin/env fish
2+
3+ set -l start_time (date +%s)
4+
5+ # Usage: howtoinstall PACKAGE
6+ # Example: howtoinstall firefox
7+
8+ # determine the available DNF version
9+ set DNF " "
10+ for cmd in dnf5 dnf dnf4
11+ if command -v $cmd > /dev/null
12+ set DNF $cmd
13+ echo " Using $cmd "
14+ break
15+ end
16+ end
17+ if not set -q DNF
18+ echo " Error: No suitable DNF version found." >&2
19+ exit 1
20+ end
21+
22+
23+ if test (count $argv ) -eq 0
24+ echo "
25+ Usage: howtoinstall PACKAGE
26+ Example: howtoinstall firefox
27+
28+ "
29+ exit 1
30+ end
31+
32+ set PACKAGE $argv [1]
33+
34+ echo " searching..."
35+ echo " These packages install \" $PACKAGE \" and require this many additional packages:"
36+
37+ touch howtoinstall-results
38+
39+ for pkg in ($DNF repoquery --whatrequires $PACKAGE 2>&1 | grep -v -e " Repository" -e " Last metadata" )
40+ set counter 0
41+ for dep in ($DNF repoquery --requires $pkg 2>&1 | grep -v -e " Repository" -e " Last metadata" )
42+ rpm -q $dep > /dev/null 2>&1 ; or begin
43+ set counter (math $counter + 1)
44+ echo $dep >> howtoinstall-log-$pkg
45+ end
46+ end
47+ echo " - $pkg : $counter " >> howtoinstall-results
48+ end
49+
50+
51+ set -l end_time (date +%s)
52+ echo " " >> howtoinstall-results
53+ echo " The search took $(math $end_time - $start_time ) seconds." >> howtoinstall-results
54+
55+ clear
56+ cat howtoinstall-results && rm -f howtoinstall-results
57+ echo
58+ echo ' Use "cat howtoinstall-log-packagename" to show what dependencies that package would install.'
59+ echo ' Use "rm howtoinstall-log-*" to remove those logs.'
You can’t perform that action at this time.
0 commit comments