google / rpmpack

rpmpack (tar2rpm) - package rpms in pure golang or cli
Apache License 2.0
116 stars 32 forks source link

Subprocess failed. Error #55

Closed Aquarian-Age closed 3 years ago

Aquarian-Age commented 3 years ago

tar2rpm -name "ccal" -version "0.0.1" -release "v0.6.9" -arch "x86_64" -licence "MIT" -prein "/usr/bin/ccal-single" -file "ccal.rpm" ccal.tar

sudo zypper in ccal.rpm

正在加载软件源数据...
正在读取已安装的软件包...
正在解决软件包依赖关系...

将安装以下 1 个新软件包:
  ccal

1 个软件包将新装.
总下载大小:0 B。已缓存:2.6 MiB。 操作完成后,将使用额外的 5.8 MiB。
继续吗? [y/n/v/...? 显示全部选项] (y): y
在缓存 ccal.rpm 中                                                                                (1/1),   2.6 MiB (解压后   5.8 MiB)

正在检查文件冲突: ..............................................................................................................[完毕]
(1/1) 正在安装:ccal-0.0.1-v0.6.9.x86_64 ........................................................................................[错误]
安装 ccal-0.0.1-v0.6.9.x86_64 失败:
错误: Subprocess failed. Error: RPM 失败: /var/tmp/rpm-tmp.UtwbaF: line 1: /usr/bin/ccal-single: No such file or directory
error: %prein(ccal-0:0.0.1-v0.6.9.x86_64) scriptlet failed, exit status 127
error: ccal-0:0.0.1-v0.6.9.x86_64: install failed

What should I do?

jarondl commented 3 years ago

Look at the flag help: https://github.com/google/rpmpack/blob/0a97c2c4b6884bcf351800f7e2fa2d6a8836c8e9/cmd/tar2rpm/main.go#L52 The content of prein should be the scriptlet itself: something you can run on the target host, e.g. a list of commands or something. It seems like you passed in /usr/bin/ccal-single, which tries to run this command, but it does not exist on the target host.

Either you want to include this file in your installation, and then use postin (which should work because the file is already there), or you want to replace the flag value with the contents of the file (in bash you can do -prein="$(cat /usr/bin/ccal-single)"