A utility script that converts bash scripts into Debian (.deb) packages for easy installation and distribution.
- 🚀 Convert any bash script to a proper Debian package
- 📦 Automatic package structure generation
- 🔧 Configurable installation paths and metadata
- 🎯 Smart script naming (separates package name from script name)
- ✨ Proper dependency handling
- 🧹 Clean uninstallation support
- 🎨 Colorized output for better user experience
Install the required tools:
sudo apt-get install dpkg-dev fakeroot./To_DEB.sh -s script.sh -n package-name./To_DEB.sh \
-s fakeap.sh \
-n fakeap-tool \
-v 2.1.0 \
-d "WiFi Access Point creation tool" \
-m "user@example.com" \
-S fakeapThis creates a package named fakeap-tool that installs a script named fakeap.
| Option | Description |
|---|---|
-s, --script FILE |
Path to the bash script to convert |
-n, --name NAME |
Package name (lowercase, no spaces) |
| Option | Description | Default |
|---|---|---|
-v, --version VERSION |
Package version | 1.0.0 |
-d, --description DESC |
Package description | "Converted bash script" |
-m, --maintainer EMAIL |
Maintainer email | "$(whoami) <$(whoami)@localhost>" |
-D, --depends DEPS |
Dependencies (comma-separated) | None |
-p, --path PATH |
Install path | /usr/local/bin |
-a, --arch ARCH |
Architecture | all |
-o, --output DIR |
Output directory | ./deb_packages |
-S, --script-name NAME |
Name for installed script | Auto-derived from package name |
-h, --help |
Show help message | - |
The script automatically derives clean script names from package names:
fakeap.deb→fakeapmy-tool.deb→my-toolawesome-script→awesome-scriptnetwork-tool→network(removes-toolsuffix)
You can override this with the -S option:
./To_DEB.sh -s script.sh -n complex-package-name -S simple-nameAfter creating the package:
# Install the package
sudo dpkg -i ./deb_packages/package-name_1.0.0_all.deb
# Run your script
script-name
# Remove the package
sudo dpkg -r package-name./To_DEB.sh -s backup.sh -n backup-toolCreates: backup-tool_1.0.0_all.deb, installs script as backup
./To_DEB.sh \
-s monitoring.sh \
-n system-monitor \
-v 3.2.1 \
-d "System monitoring utility" \
-m "admin@company.com" \
-D "curl,jq,systemd" \
-p "/usr/bin" \
-S sysmonCreates: system-monitor_3.2.1_all.deb, installs script as sysmon in /usr/bin
./To_DEB.sh \
-s fakeap.sh \
-n fakeap \
-v 1.5.0 \
-d "Create fake WiFi access points for testing" \
-m "security@example.com" \
-D "hostapd,dnsmasq"Generated packages include:
- Control file: Package metadata and dependencies
- Postinst script: Makes installed script executable
- Prerm script: Cleanup during removal
- Your script: Installed to specified path
The script validates:
- ✅ Package name format (lowercase, alphanumeric +
-,.,+) - ✅ Script file existence
- ✅ Required tools availability
- ✅ Proper shebang in script (adds if missing)
Missing tools error:
sudo apt-get install dpkg-dev fakerootPermission denied:
chmod +x To_DEB.shInvalid package name:
- Use lowercase letters only
- No spaces or special characters except
-,.,+ - Must start with alphanumeric character
View package details:
dpkg-deb --info package.deb
dpkg-deb --contents package.debThe script provides colorized output:
- 🔵 INFO: General information
- 🟢 SUCCESS: Operations completed successfully
- 🟡 WARNING: Non-critical issues
- 🔴 ERROR: Critical errors
- Fork the repository
- Create a feature branch
- Make your changes
- Test with various scripts
- Submit a pull request
This project is open source. Feel free to modify and distribute.