rpm、yum、编译安装轻松管理centos7程序包(9)
- UID
- 1066743
|
rpm、yum、编译安装轻松管理centos7程序包(9)
8、查询某包安装或卸载时执行脚本;
rpm -q --scripts PACKAGE_NAME
# rpm -q --scripts zsh
\postinstall scriptlet (using /bin/sh):
if [ "$1" = 1 ]; then
if [ ! -f /etc/shells ] ; then
echo "/usr/bin/zsh" > /etc/shells
echo "/bin/zsh" >> /etc/shells
else
grep -q "^/usr/bin/zsh$" /etc/shells || echo "/usr/bin/zsh" >> /etc/shells
grep -q "^/bin/zsh$" /etc/shells || echo "/bin/zsh" >> /etc/shells
fi
fi
if [ -f /usr/share/info/zsh.info.gz ]; then
# This is needed so that --excludedocs works.
/sbin/install-info /usr/share/info/zsh.info.gz /usr/share/info/dir \
--entry="* zsh: (zsh). An enhanced bourne shell."
fi
preuninstall scriptlet (using /bin/sh):
if [ "$1" = 0 ] ; then
if [ -f /usr/share/info/zsh.info.gz ]; then
# This is needed so that --excludedocs works.
/sbin/install-info --delete /usr/share/info/zsh.info.gz /usr/share/info/dir \
--entry="* zsh: (zsh). An enhanced bourne shell."
fi
fi
postuninstall scriptlet (using /bin/sh):
if [ "$1" = 0 ] && [ -f /etc/shells ] ; then
sed -i '\!^/usr/bin/zsh$!d' /etc/shells
sed -i '\!^/bin/zsh$!d' /etc/shells
fi
脚本有四类:
preinstall:安装过程开始之前执行的脚本;
postinstall:安装过程后执行的脚本;
preuninstall:卸载前执行的脚本;
postuninstall:卸载过程完成之后执行的脚本; |
|
|
|
|
|