Remove hardcoded path for multiuser support
[platform/upstream/filesystem.git] / packaging / filesystem.spec
1 %bcond_with wayland
2 %bcond_with x
3 %define disable_docs_package 1
4 %define debug_package %{nil}
5
6 Name:           filesystem
7 Version:        3.1
8 Release:        0
9 License:        Public Domain
10 Summary:        The basic directory layout for a Linux system
11 Url:            https://fedorahosted.org/filesystem
12 Group:          Base/Configuration
13 BuildRequires:  pkgconfig(libtzplatform-config)
14 Requires(pre): setup
15 Source2:        languages
16 Source3:        languages.man
17 Source1001:     %{name}.manifest
18
19 %description
20 The filesystem package is one of the basic packages that is installed
21 on a Linux system. Filesystem contains the basic directory layout
22 for a Linux operating system, including the correct permissions for
23 the directories.
24
25 %prep
26 rm -f $RPM_BUILD_DIR/filelist
27
28 %build
29 cp %{SOURCE1001} .
30
31 %install
32 function create_dir () {
33     local MODE=$1
34     case "$MODE" in
35      \#*) return ;;
36     esac
37     local OWNR=$2
38     local GRUP=$3
39     local NAME=$4
40     local XTRA=$5
41     local BDIR=`dirname $NAME`
42     test -d "$RPM_BUILD_ROOT/$NAME" && { echo "dir $NAME does already exist" ; echo "input out of sequence ?" ; exit 1 ; }
43     test -n "$BDIR" -a ! -d $RPM_BUILD_ROOT$BDIR && create_dir 0755 root root $BDIR
44     mkdir -m $MODE $RPM_BUILD_ROOT/$NAME
45     echo "$XTRA%%dir %%attr($MODE,$OWNR,$GRUP) $NAME" >> $RPM_BUILD_DIR/filelist
46 }
47
48 cd %{buildroot}
49
50 mkdir -p boot dev \
51 %if %{with x}
52         etc/X11/{applnk,fontpath.d} \
53         usr/share/{xsessions,X11} \
54 %endif
55         etc/{xdg/autostart,ld.so.conf.d,opt,pm/{config.d,power.d,sleep.d},xinetd.d,skel,sysconfig,pki} \
56         home media mnt proc root run/lock srv sys tmp \
57         usr/{bin,etc,games,include,%{_lib}/{pkgconfig,games,sse2,tls,X11,pm-utils/{module.d,power.d,sleep.d}},lib/{games,locale,modules,sse2},libexec,local/{bin,etc,games,lib,%{_lib},sbin,src,share/{applications,man/man{1,2,3,4,5,6,7,8,9,n,1x,2x,3x,4x,5x,6x,7x,8x,9x},info},libexec,include,},sbin,share/{help/C,aclocal,applications,augeas/lenses,backgrounds,desktop-directories,dict,doc,empty,games,ghostscript/conf.d,gnome,icons,idl,info,man/man{1,2,3,4,5,6,7,8,9,n,1x,2x,3x,4x,5x,6x,7x,8x,9x,0p,1p,3p},mime-info,misc,omf,pixmaps,sounds,themes},src,src/kernels,src/debug} \
58         var/{adm,empty,gopher,lib/{empty,games,misc,rpm-state},local,lock/subsys,log,nis,preserve,run,spool/{mail,lpd,uucp},tmp,db,cache,opt,games,yp} \
59         %{buildroot}%{TZ_SYS_DB} \
60         %{buildroot}%{TZ_SYS_RO_APP}
61
62 ln -snf ../var/tmp usr/tmp
63 ln -snf spool/mail var/mail
64 ln -snf usr/bin bin
65 ln -snf usr/sbin sbin
66 ln -snf usr/lib lib
67 ln -snf usr/%{_lib} %{_lib}
68
69 # Create the locale directories:
70 while read LANG ; do
71   echo "%lang(${LANG}) %ghost %config(missingok) /usr/share/locale/${LANG}" >>$RPM_BUILD_DIR/filelist
72   create_dir 0755 root root /usr/share/locale/$LANG/LC_MESSAGES
73   create_dir 0755 root root /usr/share/help/$LANG
74 done < %{SOURCE2}
75 # Create the locale directories for man:
76 while read LANG ; do
77   create_dir 0755 root root /usr/share/man/$LANG
78   for sec in 1 2 3 4 5 6 7 8 9 n; do
79     create_dir 0755 root root /usr/share/man/$LANG/man$sec
80 ##"%lang(${LANG}) %ghost %config(missingok)"
81   done
82 done < %{SOURCE3}
83
84
85 %pretrans -p <lua>
86 --#
87 --# If we are running in pretrans in a fresh root, there is no /usr and symlinks.
88 --# We cannot be sure, to be the very first rpm in the transaction list,
89 --# so, let's create the toplevel symlinks here and the directories they point to.
90 --# When our rpm is unpacked by cpio, it will set all permissions and modes later.
91 --#
92
93 if posix.stat("/usr") == nil then
94     posix.mkdir("/usr")
95 end
96
97 for i,dir in ipairs({"/lib", "/%{_lib}", "/sbin", "/bin"}) do
98     if posix.stat("/usr"..dir) == nil then
99         posix.mkdir("/usr"..dir)
100         if posix.stat(dir, "mode") == nil then
101             posix.symlink("usr"..dir, dir)
102         end
103     end
104 end
105
106 return 0
107
108 %post -p <lua>
109 posix.symlink("../run", "/var/run")
110 posix.symlink("../run/lock", "/var/lock")
111
112 %files -f filelist
113 %manifest %{name}.manifest
114 %defattr(0755,root,root,-)
115 %dir %attr(555,root,root)
116 /bin
117 %attr(555,root,root) /boot
118 /dev
119 %dir /etc
120 %if %{with x}
121 %{_sysconfdir}/X11
122 %endif
123 %{_sysconfdir}/xdg
124 %{_sysconfdir}/opt
125 %{_sysconfdir}/pm
126 %{_sysconfdir}/xinetd.d
127 %{_sysconfdir}/skel
128 %{_sysconfdir}/sysconfig
129 %{_sysconfdir}/pki
130 /home
131 /lib
132 #%ifarch x86_64 ppc ppc64 sparc sparc64 s390 s390x
133 /%{_lib}
134 #%endif
135 /media
136 %dir /mnt
137 %dir %attr(755,root,root) %{TZ_SYS_DB}
138 %attr(555,root,root) /proc
139 %attr(550,root,root) /root
140 /run
141 /sbin
142 /srv
143 /sys
144 %attr(1777,root,root) /tmp
145 %dir /usr
146 %attr(755,root,root) %{TZ_SYS_RO_APP}
147 %attr(555,root,root) /usr/bin
148 /usr/etc
149 /usr/games
150 /usr/include
151 %attr(555,root,root) /usr/lib
152 #%ifarch x86_64 ppc ppc64 sparc sparc64 s390 s390x
153 %attr(555,root,root) /usr/%{_lib}
154 #%endif
155 /usr/libexec
156 /usr/local
157 %attr(555,root,root) /usr/sbin
158 %dir /usr/share
159 /usr/share/aclocal
160 /usr/share/applications
161 /usr/share/help/C
162 /usr/share/augeas
163 /usr/share/backgrounds
164 /usr/share/desktop-directories
165 /usr/share/dict
166 /usr/share/doc
167 %attr(555,root,root) %dir /usr/share/empty
168 /usr/share/games
169 /usr/share/ghostscript
170 /usr/share/gnome
171 /usr/share/icons
172 /usr/share/idl
173 /usr/share/info
174 %dir /usr/share/locale
175 %dir /usr/share/man
176 /usr/share/mime-info
177 /usr/share/misc
178 /usr/share/omf
179 /usr/share/pixmaps
180 /usr/share/sounds
181 /usr/share/themes
182 %if %{with x}
183 /usr/share/xsessions
184 /usr/share/X11
185 %endif
186 /usr/src
187 /usr/tmp
188 %dir /var
189 %{_localstatedir}/adm
190 %{_localstatedir}/cache
191 %{_localstatedir}/db
192 %{_localstatedir}/empty
193 %{_localstatedir}/games
194 %{_localstatedir}/gopher
195 %{_localstatedir}/lib
196 %{_localstatedir}/local
197 %ghost %dir %attr(755,root,root) %{_localstatedir}/lock
198 %ghost %{_localstatedir}/lock/subsys
199 %{_localstatedir}/log
200 %{_localstatedir}/mail
201 %{_localstatedir}/nis
202 %{_localstatedir}/opt
203 %{_localstatedir}/preserve
204 %ghost %attr(755,root,root) %{_localstatedir}/run
205 %dir %{_localstatedir}/spool
206 %attr(755,root,root) %{_localstatedir}/spool/lpd
207 %attr(775,root,mail) %{_localstatedir}/spool/mail
208 %attr(755,uucp,uucp) %{_localstatedir}/spool/uucp
209 %attr(1777,root,root) %{_localstatedir}/tmp
210 %{_localstatedir}/yp
211
212 %changelog