Last active
January 11, 2023 11:17
-
-
Save faveoled/83cffdcba001ccd1185b00ca9ecd971e to your computer and use it in GitHub Desktop.
Unpack AppImage without root rights and AppImage execution
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/bash | |
| # usage: ./unpack-appimage.sh <appimage_file.AppImage> | |
| APP_IMAGE=$(readlink -f $1) | |
| APP_IMAGE_FILE=$(basename ${APP_IMAGE}) | |
| APP_DIR=$(dirname $APP_IMAGE) | |
| APP_IMAGE=$(readlink -f $1) | |
| ELFSIZE=$(readelf -h $APP_IMAGE) | |
| START_OF_SECTION=$(echo $ELFSIZE | grep -oP "(?<=Start of section headers: )[0-9]+") | |
| SECTION_SIZE=$(echo $ELFSIZE | grep -oP "(?<=Size of section headers: )[0-9]+") | |
| SECTION_NO=$(echo $ELFSIZE | grep -oP "(?<=Number of section headers: )[0-9]+") | |
| APPIMG_OFFSET=$(( $START_OF_SECTION + $SECTION_SIZE * $SECTION_NO )) | |
| unsquashfs -offset ${APPIMG_OFFSET} -dest ${APP_DIR}/squashfs-root ${APP_IMAGE} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment