【发布时间】:2017-03-28 00:53:17
【问题描述】:
我正在尝试创建一个 RPM 来解压缩 tar,更改一些权限,然后根据进程回显某些内容。这是有问题的.spec 文件。
Summary: Linux agent V.1
Name: Agent
Version: 1.0
Release: 1
License: GPL
Source: Agent.tar.gz
Vendor: test
Packager: test
%description
Test Linux agent
%prep
if ps aux | grep "[u]cx"; then
pkill -f ucx
else
echo "Current agent is not running."
fi
%setup -n Agent
%install
cp -r /root/rpmbuild/BUILD/Agent /local/0/opt
cd /local/0/opt/Agent
chown -R root.root *
cd bin/
chown root.root test1 test2
chmod 775 test1 test2
chmod +s test1 test2
if ps aux | grep "[u]cy"; then
echo "managerup"
else
echo "manager down"
fi
%files
%clean
rm -rf /root/rpmbuild/BUILD/Agent
在构建时,.spec 文件会干净地构建并创建一个 rpm。它还运行命令,我在/local/0/opt 中获得相关文件。有问题的构建命令是rpmbuild -ba agent.spec。我已经尝试在详细模式下执行此操作,它也没有真正给我一个错误。
但是,生成的.rpm 文件是空的,实际上并没有做任何事情。我认为这是.spec 文件的问题。但是,由于输出根本没有给我一个错误,我不确定问题是什么。
我一直关注http://www.rpm.org/max-rpm/s1-rpm-build-creating-spec-file.html
我认为问题出在%files 部分。我希望它只是将 tar 部署到 local/0/opt,但我对在哪里声明安装目录以及在哪里声明我想要的包中的内容感到困惑。
【问题讨论】: