]> git.pld-linux.org Git - packages/FHS.git/blob - FHS.spec
- check_filesystem_dirs cleanup
[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 %{version} 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 %{version}
12 Summary(tr.UTF-8):      Temel dosya sistemi yapısı
13 Name:           FHS
14 Version:        3.0
15 Release:        1
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 %prep
75 %setup -qcT
76 cp -p %{SOURCE0} .
77
78 %install
79 rm -rf $RPM_BUILD_ROOT
80
81 install -d \
82         $RPM_BUILD_ROOT/{bin,boot,dev,etc,home,opt,run,srv,sys} \
83         $RPM_BUILD_ROOT/etc/{X11,opt} \
84         $RPM_BUILD_ROOT/lib/modules \
85         $RPM_BUILD_ROOT/{mnt,media,proc,root/tmp,sbin,tmp} \
86         $RPM_BUILD_ROOT/usr/{bin,games,include,lib,sbin,share,src} \
87         $RPM_BUILD_ROOT/usr/share/{color/icc,dict,doc,games,info,misc,ppd,tmac,xml} \
88         $RPM_BUILD_ROOT/usr/lib/games \
89         $RPM_BUILD_ROOT/usr/local/{bin,etc,games,include,lib,sbin,share/{color/icc,doc,info,man},src} \
90         $RPM_BUILD_ROOT/var/{cache,crash,db,games,lib/{color/icc,misc},local,lock,log,mail,opt,run,spool,tmp,yp}
91
92 %if %{with lib64}
93 install -d $RPM_BUILD_ROOT{/lib64,/usr/lib64/games,/usr/local/lib64}
94 %endif
95 %if %{with libx32}
96 install -d $RPM_BUILD_ROOT{/libx32,/usr/libx32/games,/usr/local/libx32}
97 %endif
98
99 install -d $RPM_BUILD_ROOT/usr/share/man/man{1,2,3,4,5,6,7,8}
100 install -d $RPM_BUILD_ROOT/usr/local/share/man/man{1,2,3,4,5,6,7,8}
101
102 > %{name}.lang
103 for mloc in $(cat locale-dirs); do
104         echo "%%lang($mloc) %dir /usr/share/man/${mloc}" >> %{name}.lang
105         for manp in man{1,2,3,4,5,6,7,8}; do
106                 install -d $RPM_BUILD_ROOT/usr/share/man/${mloc}/${manp}
107                 echo "%%lang($mloc) %dir /usr/share/man/${mloc}/${manp}" >> %{name}.lang
108         done
109 done
110
111 %clean
112 cd $RPM_BUILD_ROOT
113
114 check_filesystem_dirs() {
115         RPMFILE=%{name}-%{version}-%{release}.%{_target_cpu}.rpm
116         TMPFILE=$(mktemp)
117         find | sed -e 's|^\.||g' -e '/^$/d' | LC_ALL=C sort > $TMPFILE
118
119         if rpm -qpl %{_rpmdir}/$RPMFILE | grep -v '^/$' | LC_ALL=C sort | diff -u $TMPFILE - ; then
120                 rm -rf $RPM_BUILD_ROOT
121         else
122                 echo -e "\nNot so good, some directories are not included in package\n"
123                 exit 1
124         fi
125         rm -f $TMPFILE
126 }
127 check_filesystem_dirs
128
129 %pretrans -p <lua>
130 st = posix.stat("/usr/local/share/man")
131 if st and st.type == "link" then
132     os.remove("/usr/local/share/man")
133 end
134
135 %post -p <lua>
136 --# XXX: it is 2009, what uucp?! but we use /var/lock/subsys, so change it just to root?
137 posix.chown("/var/mail", 0, %{gid_mail})
138 posix.chown("/var/lock", 0, %{gid_uucp})
139
140 %files -f %{name}.lang
141 %defattr(644,root,root,755)
142 %dir /
143 %dir /bin
144 %dir /boot
145 %dir /dev
146 %dir /etc
147 %dir /etc/X11
148 %dir /etc/opt
149 %dir /home
150 %dir /lib
151 %dir /lib/modules
152 %dir /media
153 %dir /mnt
154 %dir /opt
155 %dir %attr(555,root,root) %verify(not group) /proc
156 %dir %attr(700,root,root) /root
157 %dir %attr(700,root,root) /root/tmp
158 %dir /run
159 %dir /sbin
160 %dir %attr(755,root,root) /srv
161 %dir /sys
162 %dir %attr(1777,root,root) /tmp
163 %dir /usr
164 %dir /usr/bin
165 %dir /usr/games
166 %dir /usr/include
167 %dir /usr/lib
168 %dir /usr/lib/games
169 %dir /usr/sbin
170 %dir /usr/share
171 %dir /usr/share/color
172 %dir /usr/share/color/icc
173 %dir /usr/share/dict
174 %dir /usr/share/doc
175 %dir /usr/share/games
176 %dir /usr/share/info
177 %dir /usr/share/man
178 %dir /usr/share/man/man[1-8]
179 %dir /usr/share/misc
180 %dir /usr/share/ppd
181 %dir /usr/share/tmac
182 %dir /usr/share/xml
183 %dir /usr/src
184 %dir /usr/local
185 %dir /usr/local/bin
186 %dir /usr/local/etc
187 %dir /usr/local/games
188 %dir /usr/local/include
189 %dir /usr/local/lib
190 %dir /usr/local/sbin
191 %dir /usr/local/share
192 %dir /usr/local/share/color
193 %dir /usr/local/share/color/icc
194 %dir /usr/local/share/doc
195 %dir /usr/local/share/info
196 %dir /usr/local/share/man
197 %dir /usr/local/share/man/man[1-8]
198 %dir /usr/local/src
199 %dir /var
200 %dir /var/cache
201 %dir /var/crash
202 %dir /var/db
203 %dir /var/games
204 %dir /var/lib
205 %dir /var/lib/color
206 %dir /var/lib/color/icc
207 %dir /var/lib/misc
208 %dir /var/local
209 %dir %attr(1771,root,root) /var/lock
210 %dir %attr(751,root,root) /var/log
211 %dir %attr(2775,root,root) /var/mail
212 %dir /var/opt
213 %dir /var/run
214 %dir /var/spool
215 %dir /var/yp
216 %dir %attr(1777,root,root) /var/tmp
217 %if %{with lib64}
218 %dir /lib64
219 %dir /usr/lib64
220 %dir /usr/lib64/games
221 %dir /usr/local/lib64
222 %endif
223 %if %{with libx32}
224 %dir /libx32
225 %dir /usr/libx32
226 %dir /usr/libx32/games
227 %dir /usr/local/libx32
228 %endif
This page took 0.068733 seconds and 3 git commands to generate.