# Prerequisites for Running the Dify Plugin Repackaging Script: unzip, yum, and dnf Explained

> Learn the Dify plugin repackaging script prerequisites including unzip yum and dnf. Ensure seamless installation on RPM and Debian systems.

- Repository: [Junjie.M/dify-plugin-repackaging](https://github.com/junjiem/dify-plugin-repackaging)
- Tags: how-to-guide
- Published: 2026-03-05

---

**To run the Dify plugin repackaging script, you must have `unzip` installed; on RPM-based systems, the script automatically installs it using `yum` or `dnf`, while Debian-based systems require manual installation via `apt-get`.**

The `junjiem/dify-plugin-repackaging` repository provides a Bash utility that extracts and repackages Dify plugin archives. Before executing the main script, you must ensure your environment meets specific prerequisites for running the Dify plugin repackaging script, particularly regarding archive extraction tools and package managers.

## Core Prerequisites for the Dify Plugin Repackaging Script

### The `unzip` Utility

The script requires the **`unzip`** command-line tool to extract `.zip` plugin archives. In [`plugin_repackaging.sh`](https://github.com/junjiem/dify-plugin-repackaging/blob/main/plugin_repackaging.sh), the extraction operation appears at lines 104-105:

```bash
install_unzip
unzip -o ${PACKAGE_PATH} -d ${CURR_DIR}/${PACKAGE_NAME}

```

If `unzip` is not present in your system `PATH`, the script attempts to install it automatically using the system's package manager.

### Package Managers: `yum` and `dnf`

For automatic dependency resolution, the script relies on **RPM-based package managers**. The `install_unzip()` helper function at lines 148-153 in [`plugin_repackaging.sh`](https://github.com/junjiem/dify-plugin-repackaging/blob/main/plugin_repackaging.sh) implements the following logic:

```bash
install_unzip(){
    if ! command -v unzip &> /dev/null; then
        echo "Installing unzip ..."
        yum -y install unzip
        if [ $? -ne 0 ]; then
            echo "Install unzip failed."
            exit 1
        fi
    fi
}

```

On modern RHEL 8+, CentOS Stream, or Fedora systems where `yum` has been replaced by **`dnf`**, the script will fail unless you pre-install `unzip` manually or modify the script to use `dnf` instead.

## How the Script Handles Missing Dependencies

When you invoke [`./plugin_repackaging.sh`](https://github.com/junjiem/dify-plugin-repackaging/blob/main/./plugin_repackaging.sh), the execution flow follows this sequence:

1.  **Check Phase**: The script calls `install_unzip()` to verify that `unzip` exists.
2.  **Install Phase**: If missing, it attempts `yum -y install unzip`.
3.  **Extract Phase**: Upon successful installation (or if already present), it executes `unzip -o ${PACKAGE_PATH} -d ...` to extract the plugin archive.

If the automatic installation fails (for example, on a Debian system without `yum`), the script exits with code 1 and prints "Install unzip failed."

## Installation Commands by Operating System

### RPM-Based Systems (RHEL, CentOS, Fedora)

On systems where `yum` or `dnf` is available, you can either let the script auto-install `unzip` or pre-install it:

```bash

# For older RHEL/CentOS 7

sudo yum -y install unzip

# For RHEL 8+, CentOS Stream, Fedora

sudo dnf -y install unzip

```

Then run the script:

```bash
sudo ./plugin_repackaging.sh /path/to/dify-plugin.zip

```

### Debian-Based Systems (Ubuntu, Debian)

Since these distributions lack `yum`/`dnf`, you **must** install `unzip` manually before running the script:

```bash
sudo apt-get update && sudo apt-get install -y unzip
./plugin_repackaging.sh /path/to/dify-plugin.zip

```

### Docker Environment

The provided `Dockerfile` handles prerequisites automatically by installing `unzip` via `apt-get`:

```dockerfile
RUN apt-get update && apt-get install -y curl unzip && \
    chmod +x /plugin_repackaging.sh

```

Build and run:

```bash
docker build -t dify-plugin-repackager .
docker run --rm -v $(pwd):/work dify-plugin-repackager \
    ./plugin_repackaging.sh /work/dify-plugin.zip

```

## Summary

- **The Dify plugin repackaging script requires `unzip`** to extract plugin archives from `.zip` files.
- **On RPM-based systems** (RHEL, CentOS, Fedora), the script automatically installs `unzip` using `yum` or `dnf` if missing.
- **On Debian-based systems** (Ubuntu, Debian), you must manually install `unzip` via `apt-get` before running the script, as the automatic installer relies on `yum`.
- **The `install_unzip()` function** in [`plugin_repackaging.sh`](https://github.com/junjiem/dify-plugin-repackaging/blob/main/plugin_repackaging.sh) (lines 148-153) handles the dependency check and installation logic.

## Frequently Asked Questions

### Can I run the Dify plugin repackaging script without root privileges?

No, you typically need root privileges because the script attempts to install system packages using `yum -y install unzip`. Package manager operations require elevated permissions. If you pre-install `unzip` manually as a non-root user in a user-local directory, you could modify the script to skip the `install_unzip` check.

### What happens if both `yum` and `dnf` are unavailable on my system?

If neither package manager is present (common on Alpine Linux, Arch Linux, or minimal containers), the `install_unzip()` function will fail with the message "Install unzip failed." and exit with code 1. You must install `unzip` manually using your distribution's package manager (e.g., `apk add unzip` for Alpine or `pacman -S unzip` for Arch) before executing the script.

### Does the script check for `unzip` before attempting extraction?

Yes, the script explicitly checks for the `unzip` binary before extraction. At line 104, it calls `install_unzip`, which uses `command -v unzip &> /dev/null` to verify existence. If missing, it triggers the installation routine; if present, extraction proceeds immediately at line 105 with `unzip -o ${PACKAGE_PATH} -d ...`.

### Is `curl` a prerequisite for running the script?

No, `curl` is not required to execute [`plugin_repackaging.sh`](https://github.com/junjiem/dify-plugin-repackaging/blob/main/plugin_repackaging.sh) itself. It appears only in the `Dockerfile` (line 11) to download the script into the container image during the build process. Once the script resides on your system, only `unzip` and a compatible package manager (or manual installation capability) are necessary.