summaryrefslogtreecommitdiff
path: root/rpmpopt.in
blob: b3156ad043df0ea263a2e85ddefa2f76e42e10dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
#/*! \page config_rpmpopt Default configuration: @RPMCONFIGDIR@/rpmpopt-@VERSION@
# \verbatim
#
# This file *should not be modified*. Local customizations
# belong in /etc/popt, not here. This file will be replaced
# whenever a new version of RPM is installed.
#
# Note: Not all popt aliases are documented. This is a decision on my
# part as to which are the more important aliases. Feel free to clip
# a copy of the alias/exec here and place in /etc/popt or ~/.popt with
# your own words added. It's easier than arguing about how many options
# fit on the head of an executable :-)
#

rpm	alias --scripts --qf '\
%|PRETRANS?{pretrans scriptlet\
%|PRETRANSPROG?{ (using[ %{PRETRANSPROG}])}|:\n%{PRETRANS}\n}:\
{%|PRETRANSPROG?{pretrans program:[ %{PRETRANSPROG}]\n}|}|\
\
%|PREIN?{preinstall scriptlet\
%|PREINPROG?{ (using[ %{PREINPROG}])}|:\n%{PREIN}\n}:\
{%|PREINPROG?{preinstall program:[ %{PREINPROG}]\n}|}|\
\
%|POSTIN?{postinstall scriptlet\
%|POSTINPROG?{ (using[ %{POSTINPROG}])}|:\n%{POSTIN}\n}:\
{%|POSTINPROG?{postinstall program:[ %{POSTINPROG}]\n}|}|\
\
%|PREUN?{preuninstall scriptlet\
%|PREUNPROG?{ (using[ %{PREUNPROG}])}|:\n%{PREUN}\n}:\
{%|PREUNPROG?{preuninstall program:[ %{PREUNPROG}]\n}|}|\
\
%|POSTUN?{postuninstall scriptlet\
%|POSTUNPROG?{ (using[ %{POSTUNPROG}])}|:\n%{POSTUN}\n}:\
{%|POSTUNPROG?{postuninstall program:[ %{POSTUNPROG}]\n}|}|\
\
%|POSTTRANS?{posttrans scriptlet\
%|POSTTRANSPROG?{ (using[ %{POSTTRANSPROG}])}|:\n%{POSTTRANS}\n}:\
{%|POSTTRANSPROG?{posttrans program:[ %{POSTTRANSPROG}]\n}|}|\
\
%|VERIFYSCRIPT?{verify scriptlet\
%|VERIFYSCRIPTPROG?{ (using[ %{VERIFYSCRIPTPROG}])}|:\n%{VERIFYSCRIPT}\n}:\
{%|VERIFYSCRIPTPROG?{verify program:[ %{VERIFYSCRIPTPROG}]\n}|}|\
' \
	--POPTdesc=$"list install/erase scriptlets from package(s)"

rpm	alias --setperms -q --qf '[\[ -L %{FILENAMES:shescape} \] || chmod %7{FILEMODES:octal} %{FILENAMES:shescape}\n]' \
		   --pipe "grep -v \(none\) | grep '^. -L ' | sed 's/chmod .../chmod /' | sh" \
	--POPTdesc=$"set permissions of files in a package"

rpm	alias --setugids -q --qf \
        '[ch %{FILEUSERNAME:shescape} %{FILEGROUPNAME:shescape} %{FILENAMES:shescape}\n]' \
        --pipe "(echo 'ch() { chown -h -- \"$1\" \"$3\";chgrp -h -- \"$2\" \"$3\"; }';grep '^ch '|grep -v \(none\))|sh" \
	--POPTdesc=$"set user/group ownership of files in a package"

rpm	alias --conflicts	--qf \
  "[%|VERBOSE?{%{CONFLICTFLAGS:deptype}: }:{}|%{CONFLICTNEVRS}\n]" \
	--POPTdesc=$"list capabilities this package conflicts with"
rpm	alias --obsoletes	--qf \
  "[%|VERBOSE?{%{OBSOLETEFLAGS:deptype}: }:{}|%{OBSOLETENEVRS}\n]" \
	--POPTdesc=$"list other packages removed by installing this package"
rpm	alias --provides	--qf \
  "[%|VERBOSE?{%{PROVIDEFLAGS:deptype}: }:{}|%{PROVIDENEVRS}\n]" \
	--POPTdesc=$"list capabilities that this package provides"

rpm	alias --requires	--qf \
  "[%|VERBOSE?{%{REQUIREFLAGS:deptype}: }:{}|%{REQUIRENEVRS}\n]" \
	--POPTdesc=$"list capabilities required by package(s)"
rpm	alias -R --requires

rpm    alias --suggests        --qf \
  "[%|SUGGESTSFLAGS:depflag_strong?{}:{%{SUGGESTSNAME} %{SUGGESTSFLAGS:depflags} %{SUGGESTSVERSION}\n}|]" \
	--POPTdesc=$"list capabilities this package suggests"

rpm    alias --recommends      --qf \
  "[%|SUGGESTSFLAGS:depflag_strong?{%{SUGGESTSNAME} %{SUGGESTSFLAGS:depflags} %{SUGGESTSVERSION}\n}|]" \
	--POPTdesc=$"list capabilities this package recommends"

rpm    alias --enhances        --qf \
  "[%|ENHANCESFLAGS:depflag_strong?{}:{%{ENHANCESNAME} %{ENHANCESFLAGS:depflags} %{ENHANCESVERSION}\n}|]" \
	--POPTdesc=$"list capabilities this package enhances"

rpm    alias --supplements     --qf \
  "[%|ENHANCESFLAGS:depflag_strong?{%{ENHANCESNAME} %{ENHANCESFLAGS:depflags} %{ENHANCESVERSION}\n}|]" \
	--POPTdesc=$"list capabilities this package supplements"

rpm	alias --info --qf '\
Name        : %{NAME}\n\
%|EPOCH?{Epoch       : %{EPOCH}\n}|\
Version     : %{VERSION}\n\
Release     : %{RELEASE}\n\
Architecture: %{ARCH}\n\
Install Date: %|INSTALLTIME?{%{INSTALLTIME:date}}:{(not installed)}|\n\
Group       : %{GROUP}\n\
Size        : %{LONGSIZE}\n\
%|LICENSE?{License     : %{LICENSE}}|\n\
Signature   : %|DSAHEADER?{%{DSAHEADER:pgpsig}}:{%|RSAHEADER?{%{RSAHEADER:pgpsig}}:{%|SIGGPG?{%{SIGGPG:pgpsig}}:{%|SIGPGP?{%{SIGPGP:pgpsig}}:{(none)}|}|}|}|\n\
Source RPM  : %{SOURCERPM}\n\
Build Date  : %{BUILDTIME:date}\n\
Build Host  : %{BUILDHOST}\n\
Relocations : %|PREFIXES?{[%{PREFIXES} ]}:{(not relocatable)}|\n\
%|PACKAGER?{Packager    : %{PACKAGER}\n}|\
%|VENDOR?{Vendor      : %{VENDOR}\n}|\
%|URL?{URL         : %{URL}\n}|\
%|BUGURL?{Bug URL     : %{BUGURL}\n}|\
Summary     : %{SUMMARY}\n\
Description :\n%{DESCRIPTION}\n\
Distribution: %{DISTRIBUTION}\n' \
	--POPTdesc=$"list descriptive information from package(s)"

rpm	alias --changelog --qf '[* %{CHANGELOGTIME:day} %{CHANGELOGNAME}\n%{CHANGELOGTEXT}\n\n]' \
	--POPTdesc=$"list change logs for this package"

rpm	alias --xml --qf '[%{*:xml}\n]' \
	--POPTdesc=$"list metadata in xml"

rpm	alias --triggerscripts --qf '\
[trigger%{TRIGGERTYPE} scriptlet (using %{TRIGGERSCRIPTPROG}) -- %{TRIGGERCONDS}\n\
%{TRIGGERSCRIPTS}\n]'
rpm	alias --triggers --triggerscripts \
	--POPTdesc=$"list trigger scriptlets from package(s)"

rpm	alias --last --qf '%|INSTALLTIME?{%{INSTALLTIME}}:{000000000}| %{NVRA} %|INSTALLTIME?{%{INSTALLTIME:date}}:{(not installed)}|\n' \
	--pipe "sort -r -n | sed 's,^[0-9]\+ ,,' | awk '{printf(\"%-45s %-s\n\", $1, substr($0,length($1)+2))}' " \
	--POPTdesc=$"list package(s) by install time, most recent first"

rpm	alias --dupes   --qf '%|SOURCERPM?{%{name}.%{arch}}:{%|ARCH?{%{name}}:{%{name}-%{version}}|}|\n' --pipe "sort | uniq -d" \
	--POPTdesc=$"list duplicated packages"

rpm	alias --filesbypkg --qf '[%-25{=NAME} %{FILENAMES}\n]' \
	--POPTdesc=$"list all files from each package"

rpm	alias --fileclass --qf '[%{FILENAMES}\t%{FILECLASS}\n]' \
	--POPTdesc=$"list file names with classes"

rpm	alias --filecolor --qf '[%{FILENAMES}\t%{FILECOLORS}\n]' \
	--POPTdesc=$"list file names with colors"

rpm     alias --fscontext --qf '[%{FILENAMES}\n]' \
        --pipe "xargs ls --scontext | awk '{printf(\"%s %s\n\", $2, $1)}'" \
        --POPTdesc=$"list file names with security context from file system"

rpm	alias --fileprovide --qf '[%{FILENAMES}\t%{FILEPROVIDE}\n]' \
	--POPTdesc=$"list file names with provides"

rpm	alias --filerequire --qf '[%{FILENAMES}\t%{FILEREQUIRE}\n]' \
	--POPTdesc=$"list file names with requires"

rpm	alias --filecaps --qf '[%{FILENAMES}\t%|FILECAPS?{%{FILECAPS}}|\n]' \
	--POPTdesc=$"list file names with POSIX1.e capabilities"

# colon separated i18n domains to use as PO catalogue lookaside for
# retrieving header group/description/summary.
rpm alias --i18ndomains --define '_i18ndomains !#:+'

#==============================================================================
#	[--ftpport <port>]	"port number of ftp server (or proxy)"
rpm	alias --ftpport		--define '_httpport !#:+'
#	[--ftpproxy <host>]	"hostname or IP of ftp proxy"
rpm	alias --ftpproxy	--define '_httpproxy !#:+'
#	[--httpport <port>]	"port number of http server (or proxy)"
rpm	alias --httpport	--define '_httpport !#:+'
#	[--httpproxy <host>]	"hostname or IP of http proxy"
rpm	alias --httpproxy	--define '_httpproxy !#:+'

# Minimally preserve commonly used switches from cli split-up
rpm	exec --addsign		rpmsign --addsign
rpm	exec --delsign		rpmsign --delsign
rpm	exec --resign		rpmsign --resign
rpm	exec --checksig		rpmkeys --checksig
rpm	exec -K			rpmkeys --checksig
rpm	exec --import		rpmkeys --import
rpm	exec --initdb		rpmdb --initdb
rpm	exec --rebuilddb	rpmdb --rebuilddb
rpm	exec --verifydb		rpmdb --verifydb
rpm	exec --specfile		rpmspec -q

#==============================================================================
rpmbuild alias --ftpport		--define '_httpport !#:+'
rpmbuild alias --ftpproxy	--define '_httpproxy !#:+'
rpmbuild alias --httpport	--define '_httpport !#:+'
rpmbuild alias --httpproxy	--define '_httpproxy !#:+'
rpmbuild alias --with		--define "_with_!#:+     --with-!#:+" \
	--POPTdesc=$"enable configure <option> for build" \
	--POPTargs=$"<option>"
rpmbuild alias --without	--define "_without_!#:+  --without-!#:+" \
	--POPTdesc=$"disable configure <option> for build" \
	--POPTargs=$"<option>"
# Build policies enabled from command line. Last policy applies.
rpmbuild alias --buildpolicy --define '__os_install_post %{_rpmconfigdir}/brp-!#:+' \
	--POPTdesc=$"set buildroot <policy> (e.g. compress man pages)" \
	--POPTargs=$"<policy>"
# Minimally preserve rpmbuild's --sign functionality
rpmbuild alias --sign \
	--pipe "grep '.*: .*\.rpm$'|cut -d: -f2|xargs -r rpm --addsign" \
	--POPTdesc=$"generate GPG signature"

rpmsign alias --key-id  --define '_gpg_name !#:+' \
	--POPTdesc=$"key id/name to sign with" \
	--POPTargs=$"<id>"
rpmsign alias --digest-algo --define '_gpg_digest_algo !#:+' \
	--POPTdesc=$"override default digest algorithm (eg sha1/sha256)" \
	--POPTargs=$"<algorithm>"

rpmspec	alias --conflicts	--qf \
  "[%|VERBOSE?{%{CONFLICTFLAGS:deptype}: }:{}|%{CONFLICTNEVRS}\n]" \
	--POPTdesc=$"list capabilities this package conflicts with"
rpmspec	alias --obsoletes	--qf \
  "[%|VERBOSE?{%{OBSOLETEFLAGS:deptype}: }:{}|%{OBSOLETENEVRS}\n]" \
	--POPTdesc=$"list other packages removed by installing this package"
rpmspec	alias --provides	--qf \
  "[%|VERBOSE?{%{PROVIDEFLAGS:deptype}: }:{}|%{PROVIDENEVRS}\n]" \
	--POPTdesc=$"list capabilities that this package provides"
rpmspec	alias --requires	--qf \
  "[%|VERBOSE?{%{REQUIREFLAGS:deptype}: }:{}|%{REQUIRENEVRS}\n]" \
	--POPTdesc=$"list capabilities required by package(s)"
rpmspec	alias --buildconflicts	--srpm --conflicts \
	--POPTdesc=$"list capabilities conflicting with build of this package"
rpmspec	alias --buildrequires	--srpm --requires \
	--POPTdesc=$"list capabilities required to build this package"
# \endverbatim
#*/