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