# # spec file for package filesystem # # Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # # norootforbuild Name: filesystem License: GPLv2+ Group: System/Fhs AutoReqProv: on Summary: Basic Directory Layout Version: 11.4 Release: 5 BuildRoot: %{_tmppath}/%{name}-%{version}-build Obsoletes: aaa_dir Provides: aaa_dir Source: directory.list Source1: filesystem.links Source2: languages Source3: ghost.list Source64: directory.list64 %prep %setup -c -n filesystem -T %install function create_dir () { local MODE=$1 local OWNR=$2 local GRUP=$3 local NAME=$4 local XTRA=$5 local BDIR=`dirname $NAME` test -d "$RPM_BUILD_ROOT/$NAME" && { echo "dir $NAME does already exist" ; echo "input out of sequence ?" ; exit 1 ; } test -n "$BDIR" -a ! -d $RPM_BUILD_ROOT$BDIR && create_dir 0755 root root $BDIR mkdir -m $MODE $RPM_BUILD_ROOT/$NAME echo "$XTRA%%dir %%attr($MODE,$OWNR,$GRUP) $NAME" >> filesystem.list } rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT # generic directories first echo "%%defattr(-,root,root)" > filesystem.list { cat %{SOURCE0} %ifarch s390x %sparc x86_64 ppc64 ppc cat %{SOURCE64} %endif } | while read MOD OWN GRP NAME ; do create_dir $MOD $OWN $GRP $NAME done # ghost files next cat %{SOURCE3} | while read MOD OWN GRP NAME ; do %ifarch s390 s390x case $NAME in /media/floppy|/media/cdrom) continue ;; esac %endif create_dir $MOD $OWN $GRP $NAME "%%verify(not mode) %%ghost " done # arch specific leftovers for march in \ %ifarch %ix86 i586-suse-linux \ %else %ifarch %sparc sparc-suse-linux sparc64-suse-linux \ %else %ifarch ppc powerpc-suse-linux \ %else %ifarch ppc64 powerpc64-suse-linux \ %else %ifarch %arm %{_target_cpu}-suse-linux-gnueabi \ %else %{_target_cpu}-suse-linux \ %endif %endif %endif %endif %endif ; do create_dir 0755 root root /usr/$march for xdir in bin include lib ; do create_dir 0755 root root /usr/$march/$xdir done done %ifarch ia64 create_dir 0755 root root /emul/ia32-linux %endif # now do the links while read SRC DEST ; do case $SRC in "") continue ;; \#*) echo "comment: $SRC $DEST" ;; *) case $SRC in /*) test -d $RPM_BUILD_ROOT/$SRC || { echo "link src does not exist" ; exit 1 ; } ;; *) test -d $RPM_BUILD_ROOT/`dirname $DEST`/$SRC || { echo "link src does not exist" ; exit 1 ; } ;; esac ln -sf $SRC $RPM_BUILD_ROOT$DEST echo "%%dir $DEST" >> filesystem.list ;; esac done < %{SOURCE1} # Create the locale directories: while read LANG ; do create_dir 0755 root root /usr/share/locale/$LANG/LC_MESSAGES done < %{SOURCE2} RPM_INSTALL_PREFIX=$RPM_BUILD_ROOT export RPM_BUILD_ROOT # check, if all home directories are present. UNFOUND=false UNFOUND_DIRS= OLDIFS="$IFS" IFS=":" while read LOGIN PASSWD UID_T GID_T NAME HOME_DIR SHELL_T ; do test "$LOGIN" = "abuild" && continue test "$LOGIN" = "icecream" && continue test -n "$HOME_DIR" || continue test "$UID_T" -gt 100 && continue test -d $RPM_BUILD_ROOT/$HOME_DIR && continue echo $HOME_DIR does not exist. UNFOUND=true UNFOUND_DIRS="$UNFOUND_DIRS $HOME_DIR" done < /etc/passwd IFS=$OLDIFS if test "$UNFOUND" = true ; then echo There are home directories defined, which are not present. echo Unfound: $UNFOUND_DIRS exit 1 fi # # now check, if all files of aaa_base have a directory in this package # NON_EXISTING_DIR= for FILE in `rpm -ql aaa_base` ; do test -d $FILE && continue case $FILE in /sbin/init.d*|/usr/share/doc/support/*|/lib/mkinitrd/scripts/*) continue ;; esac test -d $RPM_BUILD_ROOT/`dirname $FILE` || { echo `dirname $FILE` for $FILE is not in filesystem. NON_EXISTING_DIR="$NON_EXISTING_DIR `dirname $FILE`" } done test -n "$NON_EXISTING_DIR" && { echo NON_EXISTING_DIR=$NON_EXISTING_DIR exit 1 } %pre -p os.remove ("/usr/include/X11") os.remove ("/usr/lib/X11") %files -f filesystem.list %description This package installs the basic directory structure. It also includes the home directories of system users. %changelog