unrpm

来自「手机嵌入式Linux下可用的busybox源码」· 代码 · 共 49 行

TXT
49
字号
#!/bin/sh## This should work with the GNU version of cpio and gzip!# This should work with the bash or ash shell!# Requires the programs (cpio, gzip, and the pager more or less).#usage() {echo "Usage: unrpm -l package.rpm            <List contents of rpm package>"echo "       unrpm -x package.rpm /foo/boo   <Extract rpm package to this directory,"echo "                                        put . for current directory>"  exit}rpm=$2 exist() {if [ "$rpm" = "" ]; thenusageelif [ ! -s "$rpm" ]; thenecho "Can't find $rpm!"exitfi}if [ "$1" = "" ]; thenusageelif [ "$1" = "-l" ]; thenexisttype more >/dev/null 2>&1 && pager=moretype less >/dev/null 2>&1 && pager=less[ "$pager" = "" ] && echo "No pager found!" && exit(echo -e "\nPress enter to scroll, q to Quit!\n" ; rpm2cpio $rpm | cpio -tv --quiet) | $pagerexitelif [ "$1" = "-x" ]; thenexistif [ "$3" = "" ]; thenusageelif [ ! -d "$3" ]; thenecho "No such directory $3!"exitfirpm2cpio $rpm | (umask 0 ; cd $3 ; cpio -idmuv) || exitechoecho "Extracted $rpm to $3!"exitelseusagefi

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?