busybox/pkgextract
2017-05-10 21:55:52 +01:00

23 lines
414 B
Bash
Executable File

#!/bin/sh
set -e
FPATH="$(realpath $1)"
FNAME="$(basename "$FPATH")"
PKG_NAME="$(echo "$FNAME" | sed 's|_.*||g')"
# Extract package control files
CTRL_PATH="/tmp/${PKG_NAME}-DEBIAN"
dpkg-deb -e "$FPATH" "$CTRL_PATH"
cd "$CTRL_PATH"
# Rename and move control info files
find * -exec mv "{}" "/var/lib/dpkg/info/$PKG_NAME.{}" \;
cd -
# If this fails, there was probably a
rmdir "$CTRL_PATH"
dpkg -i "$FPATH"