]> TLD Linux GIT Repositories - packages/FHS.git/blob - FHS.spec
- PLD merge
[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:        7
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
33 # avoid rpm 4.4.9 adding rm -rf buildroot, we need the dirs to check consistency
34 %define         __spec_clean_body       %{nil}
35
36 # doesn't contain any files, but we're not noarch package
37 %define         no_install_post_strip   1
38 %define         no_install_post_chrpath 1
39 %define         no_install_post_compress_modules        1
40
41 # we have to use numeric uids/groups. see comment above
42 %define         gid_uucp        14
43 %define         gid_mail        12
44
45 %description
46 This package contains the basic directory layout for a Linux system,
47 including the proper permissions for the directories. This layout
48 conforms to the Filesystem Hierarchy Standard (FHS) %{version}.
49
50 %description -l de.UTF-8
51 Dieses Paket enthält die grundlegende Verzeichnisstruktur eines
52 Linux-Systems, einschließlich der entsprechenden Zugriffsrechte. Diese
53 Struktur entspricht dem Filesystem Hierarchy Standard (FHS) %{version}.
54
55 %description -l fr.UTF-8
56 Ce package contient l'arborescence type pour système Linux y compris
57 les permissions adéquates pour les répertoires. Cette arborescence est
58 conforme au standard "Filesystem Hierarchy Standard" (FHS) %{version}.
59
60 %description -l pl.UTF-8
61 Pakiet ten zawiera informacje o podstawowej strukturze katalogów
62 systemu i praw dostępu do nich. Struktura katalogów jest zgodna z FHS
63 %{version}.
64
65 %package debug
66 Summary:        Debug information directory hierarchy
67 Summary(pl.UTF-8):      Hierarchia katalogów dla informacji diagnostycznych
68 Group:          Development/Debug
69
70 %description debug
71 This package provides directory hierarchy for debug information
72 contained in debuginfo rpm packages.
73
74 %description debug -l pl.UTF-8
75 Ten pakiet dostarcza hierarchię katalogów dla zawarych w pakietach
76 RPM debuginfo informacji pozwalających na śledzenie programów.
77
78 %prep
79 %setup -qcT
80 cp -p %{SOURCE0} .
81
82 %install
83 rm -rf $RPM_BUILD_ROOT
84
85 install -d \
86         $RPM_BUILD_ROOT/{bin,boot,dev,etc,home,opt,run,srv,sys} \
87         $RPM_BUILD_ROOT/etc/{X11,opt} \
88         $RPM_BUILD_ROOT/lib/modules \
89         $RPM_BUILD_ROOT/{mnt,media,proc,root/tmp,sbin,tmp} \
90         $RPM_BUILD_ROOT/usr/{bin,games,include,lib,libexec,sbin,share,src} \
91         $RPM_BUILD_ROOT/usr/share/{color/icc,dict,doc,games,info,misc,ppd,tmac,xml} \
92         $RPM_BUILD_ROOT/usr/lib/games \
93         $RPM_BUILD_ROOT/usr/local/{bin,etc,games,include,lib,libexec,sbin,share/{color/icc,doc,info,man},src} \
94         $RPM_BUILD_ROOT/var/{cache,crash,db,games,lib/{color/icc,misc},local,lock,log,mail,opt,run,spool,tmp,yp}
95
96 %if %{with lib64}
97 install -d $RPM_BUILD_ROOT{/lib64,/usr/lib64/games,/usr/local/lib64}
98 %endif
99
100 install -d $RPM_BUILD_ROOT/usr/share/man/man{1,2,3,4,5,6,7,8}
101 install -d $RPM_BUILD_ROOT/usr/local/share/man/man{1,2,3,4,5,6,7,8}
102
103 for i in $(seq 0 255); do
104         install -d "$RPM_BUILD_ROOT$(printf '/usr/lib/.build-id/%02x' $i)"
105 done
106
107 > %{name}.lang
108 for mloc in $(cat locale-dirs); do
109         echo "%%lang($mloc) %dir /usr/share/man/${mloc}" >> %{name}.lang
110         for manp in man{1,2,3,4,5,6,7,8}; do
111                 install -d $RPM_BUILD_ROOT/usr/share/man/${mloc}/${manp}
112                 echo "%%lang($mloc) %dir /usr/share/man/${mloc}/${manp}" >> %{name}.lang
113         done
114 done
115
116 %clean
117 cd $RPM_BUILD_ROOT
118
119 check_filesystem_dirs() {
120         RPMFILES="%{_rpmdir}/%{name}-%{version}-%{release}.%{_target_cpu}.rpm %{_rpmdir}/%{name}-debug-%{version}-%{release}.%{_target_cpu}.rpm"
121         TMPFILE=$(mktemp)
122         find | sed -e 's|^\.||g' -e '/^$/d' | LC_ALL=C sort > $TMPFILE
123
124         if rpm -qpl $RPMFILES | grep -v '^/$' | LC_ALL=C sort | diff -u $TMPFILE - ; then
125                 rm -rf $RPM_BUILD_ROOT
126         else
127                 echo -e "\nNot so good, some directories are not included in package\n"
128                 exit 1
129         fi
130         rm -f $TMPFILE
131 }
132 check_filesystem_dirs
133
134 %pretrans -p <lua>
135 st = posix.stat("/usr/local/share/man")
136 if st and st.type == "link" then
137     os.remove("/usr/local/share/man")
138 end
139
140 %post -p <lua>
141 --# XXX: it is 2009, what uucp?! but we use /var/lock/subsys, so change it just to root?
142 posix.chown("/var/mail", 0, %{gid_mail})
143 posix.chown("/var/lock", 0, %{gid_uucp})
144
145 %files -f %{name}.lang
146 %defattr(644,root,root,755)
147 %dir /
148 %dir /bin
149 %dir /boot
150 %dir /dev
151 %dir /etc
152 %dir /etc/X11
153 %dir /etc/opt
154 %dir /home
155 %dir /lib
156 %dir /lib/modules
157 %dir /media
158 %dir /mnt
159 %dir /opt
160 %dir %attr(555,root,root) %verify(not group) /proc
161 %dir %attr(700,root,root) /root
162 %dir %attr(700,root,root) /root/tmp
163 %dir /run
164 %dir /sbin
165 %dir %attr(755,root,root) /srv
166 %dir %attr(555,root,root) /sys
167 %dir %attr(1777,root,root) /tmp
168 %dir /usr
169 %dir /usr/bin
170 %dir /usr/games
171 %dir /usr/include
172 %dir /usr/lib
173 %dir /usr/libexec
174 %dir /usr/lib/games
175 %dir /usr/sbin
176 %dir /usr/share
177 %dir /usr/share/color
178 %dir /usr/share/color/icc
179 %dir /usr/share/dict
180 %dir /usr/share/doc
181 %dir /usr/share/games
182 %dir /usr/share/info
183 %dir /usr/share/man
184 %dir /usr/share/man/man[1-8]
185 %dir /usr/share/misc
186 %dir /usr/share/ppd
187 %dir /usr/share/tmac
188 %dir /usr/share/xml
189 %dir /usr/src
190 %dir /usr/local
191 %dir /usr/local/bin
192 %dir /usr/local/etc
193 %dir /usr/local/games
194 %dir /usr/local/include
195 %dir /usr/local/lib
196 %dir /usr/local/libexec
197 %dir /usr/local/sbin
198 %dir /usr/local/share
199 %dir /usr/local/share/color
200 %dir /usr/local/share/color/icc
201 %dir /usr/local/share/doc
202 %dir /usr/local/share/info
203 %dir /usr/local/share/man
204 %dir /usr/local/share/man/man[1-8]
205 %dir /usr/local/src
206 %dir /var
207 %dir /var/cache
208 %dir /var/crash
209 %dir /var/db
210 %dir /var/games
211 %dir /var/lib
212 %dir /var/lib/color
213 %dir /var/lib/color/icc
214 %dir /var/lib/misc
215 %dir /var/local
216 %dir %attr(1771,root,root) /var/lock
217 %dir %attr(751,root,root) /var/log
218 %dir %attr(2775,root,root) /var/mail
219 %dir /var/opt
220 %dir /var/run
221 %dir /var/spool
222 %dir /var/yp
223 %dir %attr(1777,root,root) /var/tmp
224 %if %{with lib64}
225 %dir /lib64
226 %dir /usr/lib64
227 %dir /usr/lib64/games
228 %dir /usr/local/lib64
229 %endif
230
231 %files debug
232 %defattr(644,root,root,755)
233 %dir /usr/lib/.build-id
234 %dir /usr/lib/.build-id/[0-9a-f][0-9a-f]