]> git.pld-linux.org Git - packages/FHS.git/blob - FHS.spec
7ddc231cb5a0ac87d4557cfccef98b9d9245eea9
[packages/FHS.git] / FHS.spec
1 # NOTE
2 # - don't use %{_*dir} macros for paths defined by FHS
3 # - do not add any dependencies to this pkg, FHS should be the first package being installed
4 # - do not use any other user/group than "root", as then we have to depend on "setup" package.
5 #   But: root %attr+chown in %post means integrity verification (rpm -V) error.
6 #   Maybe use non-root %attr+numeric chown in %post (without setup dependency)? The only disadvantage
7 #   seems to be a warning message on install.
8 Summary:        Basic FHS 3.0 filesystem layout
9 Summary(de.UTF-8):      Grundlegende Dateisystemstruktur
10 Summary(fr.UTF-8):      Arborescence de base du système de fichiers
11 Summary(pl.UTF-8):      Podstawowy układ katalogów systemu Linux zgodny z FHS 3.0
12 Summary(tr.UTF-8):      Temel dosya sistemi yapısı
13 Name:           FHS
14 Version:        3.0
15 Release:        6
16 License:        GPL
17 Group:          Base
18 URL:            http://refspecs.linuxfoundation.org/fhs.shtml
19 # list of languages for localized man pages directories
20 Source0:        locale-dirs
21 BuildRequires:  mktemp
22 BuildRequires:  rpmbuild(macros) >= 1.213
23 Conflicts:      setup < 2.7
24 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
25
26 # nothing to put there
27 %define         _enable_debug_packages  0
28
29 %if "%{_lib}" == "lib64"
30 %define         with_lib64      1
31 %endif
32 %if "%{_lib}" == "libx32"
33 %define         with_libx32     1
34 %define         with_lib64      1
35 %else
36 %ifarch %{x8664}
37 # x32 as additional ABI
38 %define         with_libx32     1
39 %endif
40 %endif
41
42 # avoid rpm 4.4.9 adding rm -rf buildroot, we need the dirs to check consistency
43 %define         __spec_clean_body       %{nil}
44
45 # doesn't contain any files, but we're not noarch package
46 %define         no_install_post_strip   1
47 %define         no_install_post_chrpath 1
48 %define         no_install_post_compress_modules        1
49
50 # we have to use numeric uids/groups. see comment above
51 %define         gid_uucp        14
52 %define         gid_mail        12
53
54 %description
55 This package contains the basic directory layout for a Linux system,
56 including the proper permissions for the directories. This layout
57 conforms to the Filesystem Hierarchy Standard (FHS) %{version}.
58
59 %description -l de.UTF-8
60 Dieses Paket enthält die grundlegende Verzeichnisstruktur eines
61 Linux-Systems, einschließlich der entsprechenden Zugriffsrechte. Diese
62 Struktur entspricht dem Filesystem Hierarchy Standard (FHS) %{version}.
63
64 %description -l fr.UTF-8
65 Ce package contient l'arborescence type pour système Linux y compris
66 les permissions adéquates pour les répertoires. Cette arborescence est
67 conforme au standard "Filesystem Hierarchy Standard" (FHS) %{version}.
68
69 %description -l pl.UTF-8
70 Pakiet ten zawiera informacje o podstawowej strukturze katalogów
71 systemu i praw dostępu do nich. Struktura katalogów jest zgodna z FHS
72 %{version}.
73
74 %package debug
75 Summary:        Debug information directory hierarchy
76 Group:          Development/Debug
77
78 %description debug
79 This package provides directory hierarchy for debug information
80 contained in debuginfo rpm packages.
81
82 %prep
83 %setup -qcT
84 cp -p %{SOURCE0} .
85
86 %install
87 rm -rf $RPM_BUILD_ROOT
88
89 install -d \
90         $RPM_BUILD_ROOT/{bin,boot,dev,etc,home,opt,run,srv,sys} \
91         $RPM_BUILD_ROOT/etc/{X11,opt} \
92         $RPM_BUILD_ROOT/lib/modules \
93         $RPM_BUILD_ROOT/{mnt,media,proc,root/tmp,sbin,tmp} \
94         $RPM_BUILD_ROOT/usr/{bin,games,include,lib,libexec,sbin,share,src} \
95         $RPM_BUILD_ROOT/usr/share/{color/icc,dict,doc,games,info,misc,ppd,tmac,xml} \
96         $RPM_BUILD_ROOT/usr/lib/games \
97         $RPM_BUILD_ROOT/usr/local/{bin,etc,games,include,lib,libexec,sbin,share/{color/icc,doc,info,man},src} \
98         $RPM_BUILD_ROOT/var/{cache,crash,db,games,lib/{color/icc,misc},local,lock,log,mail,opt,run,spool,tmp,yp}
99
100 %if %{with lib64}
101 install -d $RPM_BUILD_ROOT{/lib64,/usr/lib64/games,/usr/local/lib64}
102 %endif
103 %if %{with libx32}
104 install -d $RPM_BUILD_ROOT{/libx32,/usr/libx32/games,/usr/local/libx32}
105 %endif
106
107 install -d $RPM_BUILD_ROOT/usr/share/man/man{1,2,3,4,5,6,7,8}
108 install -d $RPM_BUILD_ROOT/usr/local/share/man/man{1,2,3,4,5,6,7,8}
109
110 for i in $(seq 0 255); do
111         install -d "$RPM_BUILD_ROOT$(printf '/usr/lib/.build-id/%02x' $i)"
112 done
113
114 > %{name}.lang
115 for mloc in $(cat locale-dirs); do
116         echo "%%lang($mloc) %dir /usr/share/man/${mloc}" >> %{name}.lang
117         for manp in man{1,2,3,4,5,6,7,8}; do
118                 install -d $RPM_BUILD_ROOT/usr/share/man/${mloc}/${manp}
119                 echo "%%lang($mloc) %dir /usr/share/man/${mloc}/${manp}" >> %{name}.lang
120         done
121 done
122
123 %clean
124 cd $RPM_BUILD_ROOT
125
126 check_filesystem_dirs() {
127         RPMFILES="%{_rpmdir}/%{name}-%{version}-%{release}.%{_target_cpu}.rpm %{_rpmdir}/%{name}-debug-%{version}-%{release}.%{_target_cpu}.rpm"
128         TMPFILE=$(mktemp)
129         find | sed -e 's|^\.||g' -e '/^$/d' | LC_ALL=C sort > $TMPFILE
130
131         if rpm -qpl $RPMFILES | grep -v '^/$' | LC_ALL=C sort | diff -u $TMPFILE - ; then
132                 rm -rf $RPM_BUILD_ROOT
133         else
134                 echo -e "\nNot so good, some directories are not included in package\n"
135                 exit 1
136         fi
137         rm -f $TMPFILE
138 }
139 check_filesystem_dirs
140
141 %pretrans -p <lua>
142 st = posix.stat("/usr/local/share/man")
143 if st and st.type == "link" then
144     os.remove("/usr/local/share/man")
145 end
146
147 %post -p <lua>
148 --# XXX: it is 2009, what uucp?! but we use /var/lock/subsys, so change it just to root?
149 posix.chown("/var/mail", 0, %{gid_mail})
150 posix.chown("/var/lock", 0, %{gid_uucp})
151
152 %files -f %{name}.lang
153 %defattr(644,root,root,755)
154 %dir /
155 %dir /bin
156 %dir /boot
157 %dir /dev
158 %dir /etc
159 %dir /etc/X11
160 %dir /etc/opt
161 %dir /home
162 %dir /lib
163 %dir /lib/modules
164 %dir /media
165 %dir /mnt
166 %dir /opt
167 %dir %attr(555,root,root) %verify(not group) /proc
168 %dir %attr(700,root,root) /root
169 %dir %attr(700,root,root) /root/tmp
170 %dir /run
171 %dir /sbin
172 %dir %attr(755,root,root) /srv
173 %dir %attr(555,root,root) /sys
174 %dir %attr(1777,root,root) /tmp
175 %dir /usr
176 %dir /usr/bin
177 %dir /usr/games
178 %dir /usr/include
179 %dir /usr/lib
180 %dir /usr/libexec
181 %dir /usr/lib/games
182 %dir /usr/sbin
183 %dir /usr/share
184 %dir /usr/share/color
185 %dir /usr/share/color/icc
186 %dir /usr/share/dict
187 %dir /usr/share/doc
188 %dir /usr/share/games
189 %dir /usr/share/info
190 %dir /usr/share/man
191 %dir /usr/share/man/man[1-8]
192 %dir /usr/share/misc
193 %dir /usr/share/ppd
194 %dir /usr/share/tmac
195 %dir /usr/share/xml
196 %dir /usr/src
197 %dir /usr/local
198 %dir /usr/local/bin
199 %dir /usr/local/etc
200 %dir /usr/local/games
201 %dir /usr/local/include
202 %dir /usr/local/lib
203 %dir /usr/local/libexec
204 %dir /usr/local/sbin
205 %dir /usr/local/share
206 %dir /usr/local/share/color
207 %dir /usr/local/share/color/icc
208 %dir /usr/local/share/doc
209 %dir /usr/local/share/info
210 %dir /usr/local/share/man
211 %dir /usr/local/share/man/man[1-8]
212 %dir /usr/local/src
213 %dir /var
214 %dir /var/cache
215 %dir /var/crash
216 %dir /var/db
217 %dir /var/games
218 %dir /var/lib
219 %dir /var/lib/color
220 %dir /var/lib/color/icc
221 %dir /var/lib/misc
222 %dir /var/local
223 %dir %attr(1771,root,root) /var/lock
224 %dir %attr(751,root,root) /var/log
225 %dir %attr(2775,root,root) /var/mail
226 %dir /var/opt
227 %dir /var/run
228 %dir /var/spool
229 %dir /var/yp
230 %dir %attr(1777,root,root) /var/tmp
231 %if %{with lib64}
232 %dir /lib64
233 %dir /usr/lib64
234 %dir /usr/lib64/games
235 %dir /usr/local/lib64
236 %endif
237 %if %{with libx32}
238 %dir /libx32
239 %dir /usr/libx32
240 %dir /usr/libx32/games
241 %dir /usr/local/libx32
242 %endif
243
244 %files debug
245 %defattr(644,root,root,755)
246 %dir /usr/lib/.build-id
247 %dir /usr/lib/.build-id/[0-9af][0-9af]
This page took 0.108852 seconds and 3 git commands to generate.