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