Files
openwrt/docs/README-dummy-pkg.md
2026-03-22 00:54:57 -07:00

2.5 KiB
Executable File

Dummy OPKG Package - hello-opkg

Package Information

  • Name: hello-opkg
  • Version: 1.0.0-1
  • Architecture: all (universal)
  • File: packages/hello-opkg_1.0.0-1_all.ipk
  • Size: ~812 bytes

What It Does

This is a minimal test package that installs a simple shell script at /usr/bin/hello-opkg.

When executed, the script prints:

Hello from the opkg dummy package!
Package: hello-opkg v1.0.0
This package was installed successfully.

Package Structure

The package follows standard IPK format:

hello-opkg_1.0.0-1_all.ipk
├── debian-binary       (format version: 2.0)
├── control.tar.gz      (package metadata)
│   └── control
└── data.tar.gz         (installed files)
    └── usr/bin/hello-opkg

Installation

On an OpenWRT device:

opkg install hello-opkg_1.0.0-1_all.ipk

Or from your repository:

opkg update
opkg install hello-opkg

Testing

# Run the installed script
hello-opkg

# Check package info
opkg status hello-opkg

# List installed files
opkg files hello-opkg

Removal

opkg remove hello-opkg

Troubleshooting "Malformed Package" Error

If you encounter a "malformed package" error, try:

  1. Check opkg version: Some older opkg versions are picky about format

    opkg --version
    
  2. Verify package structure:

    ar t hello-opkg_1.0.0-1_all.ipk
    # Should show: debian-binary, control.tar.gz, data.tar.gz
    
  3. Check file permissions: The script must be executable

    tar tzf <(ar p hello-opkg_1.0.0-1_all.ipk data.tar.gz)
    
  4. Try verbose installation:

    opkg install -V3 hello-opkg_1.0.0-1_all.ipk
    
  5. Inspect control file:

    ar p hello-opkg_1.0.0-1_all.ipk control.tar.gz | tar xzO ./control
    

Rebuilding the Package

Use the included build-ipk.sh script:

# Create package structure
mkdir -p my-package/CONTROL my-package/usr/bin

# Create control file
cat > my-package/CONTROL/control << 'EOF'
Package: my-package
Version: 1.0.0
Architecture: all
Maintainer: Your Name <you@example.com>
Description: My test package
EOF

# Add your files
echo '#!/bin/sh' > my-package/usr/bin/my-script
echo 'echo "Hello!"' >> my-package/usr/bin/my-script
chmod +x my-package/usr/bin/my-script

# Build it
./build-ipk.sh my-package packages/

Use Cases

  • Testing repository setup
  • Verifying package index generation
  • Testing upload scripts
  • Debugging package installation issues
  • CI/CD pipeline testing