Created
August 17, 2015 20:31
-
-
Save UtahDave/4378b1018cf07be963be to your computer and use it in GitHub Desktop.
RPM self installer using rpm -Uvh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # A self-extracting installer for RPMs | |
| # | |
| # To create: make a gzip-compressed tarball of RPMs (with no subdirectory), | |
| # convert to base64, then concatenate onto the end of this file:: | |
| # | |
| # cd /some/directory/of/rpm/files | |
| # tar -cz *.rpm | base64 -w0 >> selfinstaller.bzx | |
| main() { | |
| echo -e "\nSelf Extracting Installer\n" | |
| TMPDIR=`mktemp -d /tmp/selfextract.XXXXXX` | |
| trap 'rm -rf '$TMPDIR SIGINT SIGTERM EXIT | |
| ARCHIVE=`awk '/^__ARCHIVE_BELOW__/ { print NR + 1; exit 0; }' $0` | |
| tail -n+$ARCHIVE $0 | base64 -d | tar -C $TMPDIR -xz || \ | |
| { echo "Bad archive. Exiting."; return 1; } | |
| echo "Installing:" | |
| find $TMPDIR -name '*rpm' -print | awk -F/ '{ print $NF } END { print }' | |
| #yum localinstall --nogpgcheck -q -y $TMPDIR/*rpm | |
| rpm -Uvh $TMPDIR/*rpm | |
| return $? | |
| } | |
| main "$@" | |
| exit $? | |
| __ARCHIVE_BELOW__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This has trailing whitespace that breaks the script. Use this version instead.