Skip to content

Commit fb3ce6b

Browse files
committed
Add support for extract *.rpm files
1 parent 0d7249a commit fb3ce6b

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

climate

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ extract () {
8080
*.tgz) mkdir -p ${1%.tgz} && tar xzf $1 -C ${1%.tgz}/ ;;
8181
*.zip) unzip $1 -d ${1%.zip}/ ;;
8282
*.7z) 7za e $1 -o${1%.7z}/ ;;
83+
*.rpm) mkdir -p ${1%.rpm} && rpm2cpio $1 | (cd ${1%.rpm} && cpio -idmv) ;;
8384
*) printf "${RED}'$1' cannot be extracted.\n" ;;
8485
esac
8586
else
@@ -93,6 +94,7 @@ extract () {
9394
*.tgz) mkdir -p $2 && tar xzf $1 -C $2 ;;
9495
*.zip) unzip $1 -d $2 ;;
9596
*.7z) 7z e $1 -o$2/ ;;
97+
*.rpm) mkdir -p $2 && rpm2cpio $1 | (cd $2 && cpio -idmv) ;;
9698
*) printf "${RED}'$1' cannot be extracted.\n" ;;
9799
esac
98100
fi

install

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ cat > $CLIMATE_COMPLETION << EOF
208208
COMPREPLY=(\${COMPREPLY[@]} \$( eval compgen -f -X '!*.tgz' -- \"\$cur\" ))
209209
COMPREPLY=(\${COMPREPLY[@]} \$( eval compgen -f -X '!*.zip' -- \"\$cur\" ))
210210
COMPREPLY=(\${COMPREPLY[@]} \$( eval compgen -f -X '!*.7z' -- \"\$cur\" ))
211+
COMPREPLY=(\${COMPREPLY[@]} \$( eval compgen -f -X '!*.rpm' -- \"\$cur\" ))
211212
compopt -o nospace -o dirnames -o filenames;
212213
return 0
213214
;;
@@ -339,6 +340,8 @@ main() {
339340
system_verify "sshfs" "sshfs" "fuse-sshfs"
340341
system_verify "gawk" "gawk" "gawk"
341342
system_verify "jq" "jq" "jq"
343+
system_verify "rpm2cpio" "rpm2cpio" "rpm2cpio"
344+
system_verify "cpio" "cpio" "cpio"
342345

343346
npm_verify "http-server" "http-server"
344347
npm_verify "is-up" "is-up-cli"

0 commit comments

Comments
 (0)