sudhirgoogle
asked on
Query Regarding RPM spec file
Hello Experts,
I am dealing with RPM spec file as shown below, could you please explain me what exactly the 'umask 022' command does during the installation and uninstall ?? to which directory it sets those permission and spec file also has 'chmod 777 /opt/cps/platform/sips' command. what is the order of precedence.
#=Begin Preamble================== ========== ========== ========== =
# (C) platformyright 2008 cps Systems, Inc.
# Name : opensips.spec
# Description :cps Repackaged opensips 1.8
# 03/23/2012 cps Initial Version , David
#=End Preamble================== ========== ========== ========== ===
Group: DevBase
License: None
Name: cps-opensips
Version: %PRODUCT_VERSION
Release: 1
Summary: cps repackaged opensips package.
Vendor: cps Systems, Inc
provides: cps-opensips
#requires: linux base only
%description
Repackaged OpenSips as the SIP Server Proxy providor for Voipserver.
This package is intended to provide sips for platform
%files
%attr(0500, root,root) /opt/cps/platform/sips/ins tall_sips. sh
%attr(0666, root,root) /opt/cps/platform/sips/*
%pre
umask 022
echo "Inside %pre section"
if [ "$1" = "1" ];
then
	mkdir -p /opt/cps/platform/sips
	chmod 777 /opt/cps/platform/sips
fi
%post
umask 022
echo "Inside %post section"
if [ "$1" = "1" ];
then
echo "--- Installing cps-opensips as sips package --- "
cd /opt/cps/platform/sips/
/bin/bash ./install_sips.sh
RC=$?
[ "$RC" == "0" ] || echo "ERROR:Sips Installer exit code $RC"
[ "$RC" == "0" ] || exit 1
fi
exit 0
%postun
echo "Inside %postun section"
%preun
echo "Inside %preun section"
I am dealing with RPM spec file as shown below, could you please explain me what exactly the 'umask 022' command does during the installation and uninstall ?? to which directory it sets those permission and spec file also has 'chmod 777 /opt/cps/platform/sips' command. what is the order of precedence.
#=Begin Preamble==================
# (C) platformyright 2008 cps Systems, Inc.
# Name : opensips.spec
# Description :cps Repackaged opensips 1.8
# 03/23/2012 cps Initial Version , David
#=End Preamble==================
Group: DevBase
License: None
Name: cps-opensips
Version: %PRODUCT_VERSION
Release: 1
Summary: cps repackaged opensips package.
Vendor: cps Systems, Inc
provides: cps-opensips
#requires: linux base only
%description
Repackaged OpenSips as the SIP Server Proxy providor for Voipserver.
This package is intended to provide sips for platform
%files
%attr(0500, root,root) /opt/cps/platform/sips/ins
%attr(0666, root,root) /opt/cps/platform/sips/*
%pre
umask 022
echo "Inside %pre section"
if [ "$1" = "1" ];
then
	mkdir -p /opt/cps/platform/sips
	chmod 777 /opt/cps/platform/sips
fi
%post
umask 022
echo "Inside %post section"
if [ "$1" = "1" ];
then
echo "--- Installing cps-opensips as sips package --- "
cd /opt/cps/platform/sips/
/bin/bash ./install_sips.sh
RC=$?
[ "$RC" == "0" ] || echo "ERROR:Sips Installer exit code $RC"
[ "$RC" == "0" ] || exit 1
fi
exit 0
%postun
echo "Inside %postun section"
%preun
echo "Inside %preun section"
ASKER
umask mention in both %pre and %post section, is that mandotory ??
what will happen if i didn't specify umask in spec file ?
%attr(0500, root,root) /opt/cps/platform/sips/ins tall_sips. sh -> after installation what will be the permission for this file ?
what will happen if i didn't specify umask in spec file ?
%attr(0500, root,root) /opt/cps/platform/sips/ins
ASKER
Please advice ASAP
Not specifying umask would lead to you getting whatever it was set to beforehand (you always have a umask setting).
%attr(0500, root,root) /opt/cps/platform/sips/ins tall_sips. sh owner root, group root, permissions -r-x------
%attr(0500, root,root) /opt/cps/platform/sips/ins
ASKER
Thanks duncan_roe. As per my understanding we cann't set umask for particular folder, when we set umask its applicable to complete file-system hierarchy, including the ' / ' root filesystem .---> is my understanding correct ??
the umask set by RPM will remain persistent after reboot ??
just for sake of successful installation, RPM temporarily sets the umask for the whole linux filesystem so that it won't run into permission issues -> is my understanding correct ?
the umask set by RPM will remain persistent after reboot ??
just for sake of successful installation, RPM temporarily sets the umask for the whole linux filesystem so that it won't run into permission issues -> is my understanding correct ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Now I come to think of it, any umask set by RPM Installer is lost when it terminates (because that process has terminated and umask is per-process).
(I tested this by starting a shell and changing its umask. New umask is lost when shell exits).
(I tested this by starting a shell and changing its umask. New umask is lost when shell exits).
ASKER
Thanks for your solution
a file is created its permission are masked by the umask value; e.g permission of 777 with
umask 022 result in 777 & ~022 --> 755 (rwxr-xr-x)