我是运行centos Linux的非root用户.....问题是我有所需的rpm文件我不知道如何将它们安装到我的主目录中作为非root用户。任何帮助都会不胜感激,谢谢。
答案 0 :(得分:3)
这个漂亮的小脚本(unPack_rpm.sh)会将rpm包解压缩到包名为...的文件夹中。
#!/bin/bash
# Purpose: Unpack RPM archives (author: @unSpawn)
# Args: /path/to/archive
# Deps: Bash, GNU utils, RPM
rpmDetails() { for Q in changelog provides requires scripts triggers triggerscripts; do
rpm -q -p --${Q} "${f}" 2>&1 | grep -v NOKEY > "${Q}.log"; done; }
rpmUnpack() { f=$(readlink -f "${f}"); file "${f}"|grep -q "RPM.v" && \
{ d=$(basename "${f}" .rpm); d="./${d:=ERROR_$$}"; mkdir -p "${d}" && \
{ cd "${d}" && rpm2cpio "${f}" | cpio -idmv && rpmDetails "${f}"; }; }; }
for f in $@; do rpmUnpack "${f}"; done
exit 0
答案 1 :(得分:0)