392 lines
11 KiB
RPMSpec
392 lines
11 KiB
RPMSpec
%define tty_group 4
|
|
|
|
Name: filesystem
|
|
Version: 2.3
|
|
Release: 9mamba
|
|
Summary: The basic directory layout for a Linux system
|
|
Group: System/Configuration
|
|
Vendor: openmamba
|
|
Distribution: openmamba
|
|
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
|
|
URL: https://www.pathname.com/fhs/
|
|
License: Public Domain
|
|
## AUTOBUILDREQ-BEGIN
|
|
## AUTOBUILDREQ-END
|
|
BuildArch: noarch
|
|
|
|
%description
|
|
The filesystem package is one of the basic packages that is installed on an openmamba Linux system.
|
|
Filesystem contains the basic directory layout for a Linux operating system, including the correct permissions for the directories.
|
|
|
|
%prep -q
|
|
|
|
%build
|
|
|
|
%install
|
|
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
|
|
install -d %{buildroot}/{boot,dev,etc/opt,home,mnt,proc}
|
|
install -d %{buildroot}/{root,tmp,usr/local,var,opt,initrd}
|
|
|
|
for dirname in %{buildroot}/usr %{buildroot}/usr/local; do
|
|
install -d $dirname/{bin,etc,include,%_lib,share,src}
|
|
%if "%_lib" != "lib"
|
|
install -d $dirname/lib
|
|
%endif
|
|
# ln -s share/{man,doc,info} $dirname
|
|
install -d $dirname/share/{dict,doc,info,locale,man,empty}
|
|
install -d $dirname/share/{nls,misc,terminfo,zoneinfo}
|
|
install -d $dirname/share/man/man{1,2,3,4,5,6,7,8}
|
|
done
|
|
|
|
install -d %{buildroot}/usr/local/games
|
|
#ln -s ../share/man %{buildroot}/usr/local/man
|
|
install -d %{buildroot}/usr/local/man
|
|
|
|
install -d %{buildroot}/var/{lock,log,mail,spool}
|
|
install -d %{buildroot}/var/{tmp,opt,cache,lib/misc,local}
|
|
install -d %{buildroot}/opt/{bin,doc,include,info}
|
|
install -d %{buildroot}/opt/{%_lib,man/man{1,2,3,4,5,6,7,8}}
|
|
install -d %{buildroot}/var/lock/subsys
|
|
|
|
install -d %{buildroot}/media
|
|
install -d %{buildroot}/run
|
|
install -d %{buildroot}/srv
|
|
install -d %{buildroot}/sys
|
|
|
|
# Owning /bin and /sbin symlinks
|
|
ln -s usr/bin %{buildroot}/bin
|
|
ln -s usr/sbin %{buildroot}/sbin
|
|
ln -s bin %{buildroot}/usr/sbin
|
|
|
|
# Owning /lib and /lib64 symlinks
|
|
ln -s usr/lib %{buildroot}/lib
|
|
%if "%_lib" != "lib"
|
|
ln -s usr/%_lib %{buildroot}/%_lib
|
|
%endif
|
|
|
|
#ln -s bin %{buildroot}/usr/sbin
|
|
#ln -s bin %{buildroot}/usr/local/sbin
|
|
ln -s ../var/tmp %{buildroot}/usr
|
|
ln -s ../mail %{buildroot}/var/spool/mail
|
|
ln -s ../run %{buildroot}/var/run
|
|
|
|
%clean
|
|
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
|
|
|
|
# Warning: do not execute scripts here, because this
|
|
# package shouldn't have any dependency
|
|
#%pre
|
|
#[ -L /usr/local/man ] && rm -f /usr/local/man || :
|
|
|
|
%pre
|
|
[ -L /var/run ] || {
|
|
# /var/run -> /run migration
|
|
mv /var/run /var/run.rpmold
|
|
for f in /var/run.rpmold/*; do
|
|
b=`basename $f`
|
|
[ -e /run/$b ] || mv $f /run/
|
|
done
|
|
}
|
|
# /usr/sbin -> /usr/bin merge
|
|
[ -L /usr/sbin ] || {
|
|
echo "Migrating /usr/sbin to /usr/bin..."
|
|
for d in /usr/sbin /usr/local/sbin; do
|
|
for f in $d/*; do
|
|
dest=${d/sbin/bin}/`basename $f`
|
|
if [ -e $dest ]; then
|
|
#echo "$f exists as $dest"
|
|
if [ -L $f ]; then
|
|
linkdest=`readlink $f`
|
|
#echo "$f is a symlink to $linkdest"
|
|
/usr/bin/rm -f $f
|
|
elif [ -L $dest ]; then
|
|
linkdest=`readlink $dest`
|
|
#echo "$dest is a symlink to $linkdest"
|
|
/usr/bin/rm -f $dest && mv $f $dest
|
|
else
|
|
#echo "$f exists as a file also as $linkdest"
|
|
/usr/bin/rm -f $f
|
|
fi
|
|
else
|
|
if [ -L $f ]; then
|
|
linkdest=`readlink $f`
|
|
if [ "${linkdest:0:3}" = "../" ]; then
|
|
fulllinkdest=`readlink -f $f`
|
|
#echo "$f is a symlink pointing to ../ -> fixing"
|
|
/usr/bin/ln -s $fulllinkdest $dest
|
|
/usr/bin/rm -f $f
|
|
else
|
|
/usr/bin/mv $f $dest
|
|
fi
|
|
else
|
|
/usr/bin/mv $f $dest
|
|
fi
|
|
fi
|
|
done
|
|
/usr/bin/rmdir $d || /usr/bin/mv $d $d.notmigrated
|
|
/usr/bin/ln -s bin $d
|
|
done
|
|
}
|
|
:
|
|
|
|
%post
|
|
/sbin/ldconfig
|
|
if [ $1 -ge 1 ]; then
|
|
groupadd tty -g %{tty_groupid} 2>/dev/null || true
|
|
fi
|
|
:
|
|
|
|
%triggerpostun -- filesystem < 2.3
|
|
# /bin and /sbin are removed during old filesystem postun
|
|
[ -e /bin ] || /usr/bin/ln -s usr/bin /bin
|
|
[ -e /sbin ] || /usr/bin/ln -s usr/sbin /sbin
|
|
:
|
|
|
|
%posttrans
|
|
# usr merge
|
|
[ -L /bin -a -L /sbin ] || {
|
|
# /bin -> /usr/bin and /sbin -> /usr/sbin migration
|
|
for f in mv rm rmdir ln; do
|
|
[ -e /usr/bin/$f ] || cp /bin/$f /usr/bin/$f
|
|
done
|
|
for d in bin sbin; do
|
|
[ -L /$d ] && continue
|
|
echo "Migrating /$d to /usr/$d..."
|
|
for f in /$d/*; do
|
|
dest=/usr$f
|
|
if [ -e $dest ]; then
|
|
#echo "$f exists as $dest"
|
|
if [ -L $f ]; then
|
|
linkdest=`readlink $f`
|
|
#echo "$f is a symlink to $linkdest"
|
|
/usr/bin/rm -f $f
|
|
elif [ -L $dest ]; then
|
|
linkdest=`readlink $dest`
|
|
#echo "$dest is a symlink to $linkdest"
|
|
/usr/bin/rm -f $dest && mv $f $dest
|
|
else
|
|
#echo "$f exists as a file also as $linkdest"
|
|
/usr/bin/rm -f $f
|
|
fi
|
|
else
|
|
if [ -L $f ]; then
|
|
linkdest=`readlink $f`
|
|
if [ "${linkdest:0:3}" = "../" ]; then
|
|
fulllinkdest=`readlink -f $f`
|
|
#echo "$f is a symlink pointing to ../ -> fixing"
|
|
/usr/bin/ln -s $fulllinkdest $dest
|
|
/usr/bin/rm -f $f
|
|
else
|
|
/usr/bin/mv $f $dest
|
|
fi
|
|
else
|
|
/usr/bin/mv $f $dest
|
|
fi
|
|
fi
|
|
done
|
|
/usr/bin/rmdir /$d || /usr/bin/mv /$d /$d.notmigrated
|
|
/usr/bin/ln -s usr/$d /$d
|
|
done
|
|
}
|
|
[ -e /bin ] || /usr/bin/ln -s usr/bin /bin
|
|
[ -e /sbin ] || /usr/bin/ln -s usr/sbin /sbin
|
|
[ -e /lib ] || /usr/bin/ln -s usr/lib /lib
|
|
%ifarch x86_64 aarch64
|
|
[ -e /lib64 ] || /usr/bin/ln -s usr/lib64 /lib64
|
|
%endif
|
|
[ -e /usr/sbin ] || /usr/bin/ln -s bin /usr/sbin
|
|
[ -e /usr/local/sbin ] || /usr/bin/ln -s bin /usr/local/sbin
|
|
:
|
|
|
|
%files
|
|
%defattr(-,root,root)
|
|
%attr(0755,root,root) %dir /
|
|
/bin
|
|
%dir /boot
|
|
%dir /dev
|
|
%dir /etc
|
|
%dir /etc/opt
|
|
%dir /home
|
|
/%_lib
|
|
%if "%_lib" != "lib"
|
|
/lib
|
|
%endif
|
|
%dir /media
|
|
%dir /mnt
|
|
%dir /proc
|
|
%attr(0750,root,root) %dir /root
|
|
%dir /run
|
|
/sbin
|
|
%dir /srv
|
|
%dir /sys
|
|
%attr(1777,root,root) %dir /tmp
|
|
|
|
%dir /usr
|
|
%dir /usr/bin
|
|
%dir /usr/etc
|
|
%dir /usr/include
|
|
%dir /usr/lib
|
|
%if "%_lib" != "lib"
|
|
%dir /usr/lib64
|
|
%endif
|
|
/usr/sbin
|
|
%dir /usr/src
|
|
%dir /usr/share
|
|
%dir /usr/share/dict
|
|
%dir /usr/share/doc
|
|
%dir /usr/share/empty
|
|
%dir /usr/share/info
|
|
%dir /usr/share/locale
|
|
%dir /usr/share/man
|
|
%dir /usr/share/man/man*
|
|
%dir /usr/share/nls
|
|
%dir /usr/share/misc
|
|
%dir /usr/share/terminfo
|
|
%dir /usr/share/zoneinfo
|
|
|
|
%dir /usr/local
|
|
%dir /usr/local/bin
|
|
%dir /usr/local/etc
|
|
%dir /usr/local/games
|
|
%dir /usr/local/include
|
|
%dir /usr/local/lib
|
|
%if "%_lib" != "lib"
|
|
%dir /usr/local/lib64
|
|
%endif
|
|
%dir /usr/local/man
|
|
#/usr/local/sbin
|
|
%dir /usr/local/share
|
|
%dir /usr/local/share/dict
|
|
%dir /usr/local/share/doc
|
|
%dir /usr/local/share/info
|
|
%dir /usr/local/share/locale
|
|
%dir /usr/local/share/man
|
|
%dir /usr/local/share/man/man*
|
|
%dir /usr/local/share/misc
|
|
%dir /usr/local/share/nls
|
|
%dir /usr/local/share/terminfo
|
|
%dir /usr/local/share/zoneinfo
|
|
%dir /usr/local/src
|
|
|
|
%dir /var
|
|
%dir /var/cache
|
|
%dir /var/lib
|
|
%dir /var/lib/misc
|
|
%dir /var/local
|
|
%attr(1775,root,tty) %dir %{_localstatedir}/lock
|
|
%attr(0755,root,root) %dir %{_localstatedir}/lock/subsys
|
|
%dir /var/log
|
|
%dir /var/mail
|
|
%dir /var/opt
|
|
/var/run
|
|
%dir /var/spool
|
|
/var/spool/mail
|
|
%attr(1777,root,root) %dir /var/tmp
|
|
|
|
%dir /opt
|
|
%dir /opt/bin
|
|
%dir /opt/doc
|
|
%dir /opt/include
|
|
%dir /opt/info
|
|
%dir /opt/%_lib
|
|
%dir /opt/man
|
|
/opt/man/man*
|
|
|
|
/usr/tmp
|
|
|
|
%changelog
|
|
* Mon Sep 04 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 2.3-9mamba
|
|
- own lib and lib64 dirs and symlinks
|
|
|
|
* Sat Sep 02 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 2.3-8mamba
|
|
- posttrans: ensure /lib and /lib64 symlinks exist or create
|
|
|
|
* Sat Apr 15 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 2.3-7mamba
|
|
- provide pre script to merge /usr/sbin to /usr/bin; own /sbin, /bin, /usr/sbin
|
|
|
|
* Sun Apr 25 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 2.3-6mamba
|
|
- don't own /dev/pts
|
|
|
|
* Mon Apr 19 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 2.3-5mamba
|
|
- try performing migration in posttrans to fix problematic long-term updates
|
|
|
|
* Fri Mar 05 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 2.3-4mamba
|
|
- use /usr/bin/bash insted of /usr/bin/sh in posttrans script
|
|
- add triggerpostun to try to fix further problems
|
|
|
|
* Tue Mar 02 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 2.3-3mamba
|
|
- add -p /usr/bin/sh to posttrans as fix attempt for symlink disappearing after upgrade
|
|
|
|
* Tue Mar 02 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 2.3-2mamba
|
|
- fix attempt for symlink disappearing after upgrade
|
|
|
|
* Tue Mar 02 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 2.3-1mamba
|
|
- update to 2.3
|
|
- migrate /bin and /sbin files to /usr/bin and /usr/sbin and make the former symlinks
|
|
|
|
* Tue Nov 24 2020 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2-21mamba
|
|
- specfile fixes with recent rpm
|
|
|
|
* Tue Jun 25 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2-20mamba
|
|
- fix /var/lock permissions to avoid conflicting with liblockdev
|
|
|
|
* Sun Mar 17 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2-19mamba
|
|
- migrate /var/run to a symlink of /run
|
|
|
|
* Tue Dec 11 2018 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2-18mamba
|
|
- own root dir with 0755 permissions
|
|
|
|
* Sun Oct 20 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2-17mamba
|
|
- own /usr, /etc, /opt, /var and more directories
|
|
|
|
* Thu Jul 19 2012 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2-16mamba
|
|
- create /var/spool/mail symlink to /var/mail for standard location compatibility
|
|
|
|
* Sat Apr 30 2011 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2-15mamba
|
|
- added /run directory (see http://lwn.net/Articles/436012/)
|
|
|
|
* Tue Feb 01 2011 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2-14mamba
|
|
- remove obsolete dir /initrd
|
|
- fix files list to remove rpm 5 warnings
|
|
|
|
* Sun May 18 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2-13mamba
|
|
- specfile updated
|
|
|
|
* Thu Sep 15 2005 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2-12qilnx
|
|
- add /sys directory
|
|
|
|
* Thu Aug 04 2005 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2-11qilnx
|
|
- remove %pre script so that the package doesn't depend on /bin/sh
|
|
|
|
* Mon Apr 04 2005 Davide Madrisan <davide.madrisan@qilinux.it> 2.2-10qilnx
|
|
- make /usr/local/man a directory to avoid the error "cpio: rename failed"
|
|
on a system where the directory already exists
|
|
- added /media and /srv directories
|
|
|
|
* Thu Mar 31 2005 Davide Madrisan <davide.madrisan@qilinux.it> 2.2-9qilnx
|
|
- added games and man in `/usr/local' (FHS 2.3 requirement)
|
|
|
|
* Thu Apr 29 2004 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2-8qilnx
|
|
- set tty by groupid, not name because in install phase group cannot be resolved
|
|
|
|
* Fri Apr 09 2004 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2-7qilnx
|
|
- fixed /var/tmp permissions
|
|
|
|
* Fri Apr 09 2004 Silvan Calarco <silvan.calarco@mambasoft.it> 2.2-6qilnx
|
|
- changed /var/lock and /var/run permissions
|
|
|
|
* Tue May 27 2003 Alessandro Ramazzina <alessandro.ramazzina@qinet.it> 2.2-5qilnx
|
|
- added /usr/share/empty to the files list
|
|
|
|
* Tue May 27 2003 Alessandro Ramazzina <alessandro.ramazzina@qinet.it> 2.2-4qilnx
|
|
- added /usr/share/empty
|
|
|
|
* Wed Apr 23 2003 Silvan Calarco <silvan.calarco@qinet.it> 2.2-3qilnx
|
|
- added /var/lock/subsys
|
|
|
|
* Wed Apr 23 2003 Silvan Calarco <silvan.calarco@qinet.it> 2.2-2qilnx
|
|
- added /initrd
|
|
|
|
* Mon Apr 14 2003 Silvan Calarco <silvan.calarco@qinet.it> 2.2-1qilnx
|
|
- first build
|