我正在尝试在我的规范文件中使用以下代码,我正在将我的应用程序安装为独立的 tomcat 实例。
# Symlink $CATALINA_BASE/logs to /var/log/$SERVICE_NAME.
# If it's already there, we'll get rid of it and make a new symlink.
if [ -h "$RPM_INSTALL_PREFIX/logs" ]; then
# It's a symlink, so just remove it.
rm -f $RPM_INSTALL_PREFIX/logs
fi
# If it's still there, and it's a directory, see if we can rmdir it.
if [ -d "$RPM_INSTALL_PREFIX/logs" ]; then
rmdir $RPM_INSTALL_PREFIX/logs >/dev/null 2>&1 || :
fi
if [ -e "$RPM_INSTALL_PREFIX/logs" ]; then
# It's probably either a file or a dir, so we'll move it.
mv $RPM_INSTALL_PREFIX/logs $RPM_INSTALL_PREFIX/logs.rpmsave || :
fi
ln -s /var/log/$SERVICE_NAME $RPM_INSTALL_PREFIX/logs || :
当此代码运行时,-i
它会创建符号链接并将其保留在那里。
当我运行新版本的 rpm 时,-U
它会执行此代码并正确创建符号链接,但是当 rpm 命令退出时,符号链接会被删除。
如果我-U --force
第二次运行,则符号链接将保留。
我怎样才能-U
在不使用的情况下留下来--force
?