Skip to content

Darwinian2/App2Appimage

Repository files navigation

AppImage Creator Script

A comprehensive bash script to convert compiled Linux applications into portable AppImage files.

Features

  • ✅ Automatic executable detection
  • ✅ Dependency bundling (shared libraries)
  • ✅ Automatic .desktop file generation
  • ✅ Icon detection and packaging
  • ✅ Downloads appimagetool automatically
  • ✅ Creates proper AppDir structure
  • ✅ Includes AppRun launcher with proper environment setup

Requirements

  • Linux system (x86_64)
  • bash
  • wget (for downloading appimagetool)
  • Basic utilities (find, ldd, cp, etc.)

Installation

  1. Download the script:
wget https://your-url/create-appimage.sh
chmod +x create-appimage.sh

Or simply make it executable if you already have it:

chmod +x create-appimage.sh

Usage

Basic Usage

./create-appimage.sh <app-folder>

The script will auto-detect the executable and create an AppImage with default settings.

With App Name

./create-appimage.sh <app-folder> <app-name>

With App Name and Version

./create-appimage.sh <app-folder> <app-name> <version>

Examples

Example 1: Simple Application

# You have a folder structure like:
myapp/
  ├── myapp (executable)
  ├── config.txt
  └── data/

# Create AppImage:
./create-appimage.sh ./myapp
# Output: myapp-1.0-x86_64.AppImage

Example 2: Application with Specific Name

# Specify the app name:
./create-appimage.sh ./myapp "My Cool App" 2.1
# Output: My Cool App-2.1-x86_64.AppImage

Example 3: Complex Application with Dependencies

# Application folder structure:
myapp/
  ├── bin/
  │   └── myapp (executable)
  ├── lib/
  │   ├── libcustom.so
  │   └── libhelper.so.1
  ├── share/
  │   ├── icon.png
  │   └── data/
  └── README.md

# Create AppImage:
./create-appimage.sh ./myapp MyApplication 3.0
# The script will:
# - Detect the executable in bin/
# - Copy all .so files from lib/
# - Detect and bundle system dependencies
# - Use icon.png as the application icon
# - Create: MyApplication-3.0-x86_64.AppImage

What the Script Does

  1. Validates Input: Checks if the application folder exists
  2. Detects Executable: Finds the main executable file
  3. Creates AppDir Structure:
    AppName.AppDir/
    ├── AppRun (launcher script)
    ├── AppName.desktop
    ├── AppName.png (icon)
    ├── AppName (main executable)
    └── usr/
        ├── bin/ (application files)
        ├── lib/ (bundled libraries)
        └── share/ (desktop file and icon)
    
  4. Bundles Dependencies: Uses ldd to detect and copy required shared libraries
  5. Creates Metadata: Generates .desktop file and copies/creates icon
  6. Builds AppImage: Uses appimagetool to package everything

Application Folder Requirements

Your application folder should contain:

Minimum Requirements:

  • At least one executable file

Recommended Structure:

myapp/
├── myapp (or bin/myapp)          # Main executable
├── *.so* files                    # Shared libraries (if any)
└── icon.png (optional)            # Application icon

Supported Structures:

Flat Structure:

myapp/
├── myapp
├── libcustom.so
└── data/

Organized Structure:

myapp/
├── bin/
│   └── myapp
├── lib/
│   └── *.so
└── share/
    └── icon.png

Complex Structure:

myapp/
├── myapp
├── lib/
├── plugins/
├── resources/
└── config/

Dependency Handling

The script automatically:

  • Detects dependencies using ldd
  • Copies non-system libraries (libraries not in /lib or /usr/lib)
  • Includes any .so files found in your application folder
  • Sets up LD_LIBRARY_PATH in the AppRun launcher

Manual Dependency Addition

If you need to add specific libraries, place them in your application folder before running the script:

myapp/
├── myapp
└── extra-libs/
    └── libspecial.so

Icon Handling

The script searches for icons in this order:

  1. Files matching *icon*.png, *icon*.svg, or *icon*.ico
  2. Files matching {appname}.png, {appname}.svg, or {appname}.ico

If no icon is found:

  • Creates a placeholder icon (if ImageMagick is installed)
  • Or creates an empty icon file

Providing Your Own Icon

Place a PNG icon in your application folder:

myapp/
├── myapp
└── icon.png (256x256 recommended)

Troubleshooting

"No executable found"

  • Make sure your executable has execute permissions: chmod +x myapp/myapp
  • Verify the file is actually an executable: file myapp/myapp

"AppImage doesn't run"

  • Check if all dependencies are bundled: ldd myapp/myapp
  • Try running with APPIMAGE_EXTRACT_AND_RUN=1 ./MyApp.AppImage
  • Extract and debug: ./MyApp.AppImage --appimage-extract

Missing Dependencies

  • The script bundles non-system libraries automatically
  • For system libraries, ensure they're available on target systems
  • Use ldd to check what's missing

Large AppImage Size

  • Remove unnecessary files from your application folder before creating AppImage
  • Consider excluding documentation or dev files

Advanced Usage

Environment Variables

The AppRun launcher sets up:

  • LD_LIBRARY_PATH - for bundled libraries
  • PATH - includes the usr/bin directory
  • XDG_DATA_DIRS - for application data

Customizing the AppImage

After the script completes, you can:

  1. Extract the AppImage:
./MyApp-1.0-x86_64.AppImage --appimage-extract
  1. Modify the extracted squashfs-root/ directory

  2. Recreate the AppImage:

appimagetool-x86_64.AppImage squashfs-root/ MyApp-1.0-custom-x86_64.AppImage

Output

The script creates:

  • {AppName}-{Version}-x86_64.AppImage - The final AppImage file
  • Downloads appimagetool-x86_64.AppImage (if not present) - Kept for future use

Testing Your AppImage

# Make executable (script does this automatically)
chmod +x MyApp-1.0-x86_64.AppImage

# Run it
./MyApp-1.0-x86_64.AppImage

# Test on different system
scp MyApp-1.0-x86_64.AppImage user@othersystem:
ssh user@othersystem './MyApp-1.0-x86_64.AppImage'

Common Use Cases

Qt Application

# Ensure Qt libraries are in the app folder
myapp/
├── myapp
└── lib/
    ├── libQt5Core.so.5
    ├── libQt5Gui.so.5
    └── libQt5Widgets.so.5

./create-appimage.sh ./myapp "My Qt App" 1.0

Python Application (with PyInstaller)

# After PyInstaller creates dist/myapp/
./create-appimage.sh ./dist/myapp

Go Application

# Static binary (no dependencies)
myapp/
└── myapp

./create-appimage.sh ./myapp

Notes

  • The script creates x86_64 AppImages only
  • System libraries (glibc, etc.) are not bundled - ensure compatibility with target systems
  • AppImages work best with forward compatibility (run on newer systems than built on)
  • For maximum compatibility, build on an older Linux distribution

License

This script is provided as-is for creating AppImages from your applications.

Support

For AppImage-related questions, visit:

For script issues, check the error messages - they're designed to be helpful!

About

A quick and dirty way to convert self-contained Linux applications into AppImage files.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages