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