Linux/macOS: Retrieve RPMs from .sh file without running the script
August 28, 2025 Leave a comment
Problem
Sometimes vendors ship their software as a single self-extracting .sh installer that contains multiple .rpm or other files inside.
Running the .sh directly might trigger installation logic you don’t want, so the challenge is: How can we safely unpack the RPMs without executing the script?
Solution
Most vendor installers provide built-in extraction flags that allow you to unpack it safely.
First, check whether your script supports extraction options:
- Run it with
--help. - Or open the file in a text editor (
vi,vim,less) and search for the section that lists available options. - Look for keywords like
--target,--noexec, or--keep.
In my case, the script showed this usage block:
$0 [options] [--] [additional arguments to embedded script]
Options:
--confirm Ask before running embedded script
--quiet Do not print anything except error messages
--noexec Do not run embedded script
--keep Do not erase target directory after running
--noprogress Do not show the progress during decompression
--nox11 Do not spawn an xterm
--nochown Do not give the extracted files to the current user
--target dir Extract directly to a target directory
(absolute or relative path)
--tar arg1 [arg2 ...] Access the contents of the archive through tar
-- Pass following arguments to the embedded script
The key flags here are:
--target-> specifies the output directory for extracted files--noexec-> prevents the embedded installer logic from executing
Here’s how I safely extracted the files from my .sh installer. You might need to create an extract directory before:
$ sh flashgrid_cluster_node_update-25.5.89.70767.sh --target extract/ --noexec
Creating directory extract/
Verifying archive integrity... All good.
Uncompressing update 100%
Checking the number of files extracted, shows 46:
$ ll extract/ | wc -l
46
